aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-04 10:32:11 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-04 10:32:11 +0300
commit85db559ed6a0df39587cad4d055020a84d18e04b (patch)
treecc493eee85f14f023d1700fab041c1aaef0cf14d /configure.ac
parent22aff9e263b1e753715c8417cd3ee61b61768104 (diff)
downloadlibmicrohttpd-85db559ed6a0df39587cad4d055020a84d18e04b.tar.gz
libmicrohttpd-85db559ed6a0df39587cad4d055020a84d18e04b.zip
Added support for "noreturn" function declaration.
It should help static analyzer to properly detect code paths.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac42
1 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 23d5a900..bd6bd899 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,6 @@
1# This file is part of libmicrohttpd. 1# This file is part of libmicrohttpd.
2# (C) 2006-2021 Christian Grothoff (and other contributing authors) 2# (C) 2006-2021 Christian Grothoff (and other contributing authors)
3# (C) 2014-2021 Evgeny Grin (Karlson2k)
3# 4#
4# libmicrohttpd is free software; you can redistribute it and/or modify 5# libmicrohttpd is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published 6# it under the terms of the GNU General Public License as published
@@ -1107,6 +1108,47 @@ AC_CHECK_HEADER([[search.h]],
1107 1108
1108AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]]) 1109AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]])
1109 1110
1111AC_CACHE_CHECK([for suported 'noreturn' keyword], [mhd_cv_decl_noreturn],
1112 [
1113 mhd_cv_decl_noreturn="none"
1114 save_CFLAGS="${CFLAGS}"
1115 CFLAGS="${CFLAGS} ${errattr_CFLAGS}"
1116 for decl_noret in '_Noreturn' '__attribute__((__noreturn__))' '__declspec(noreturn)'; do
1117 AC_LINK_IFELSE([AC_LANG_SOURCE(
1118 [[
1119#ifdef HAVE_STDLIB_H
1120#include <stdlib.h>
1121#endif
1122
1123${decl_noret} void myexitfunc(int code)
1124{
1125#ifdef HAVE_STDLIB_H
1126 exit (code);
1127#else
1128 (void)code;
1129#endif
1130}
1131
1132int main (int argc, char *const *argv)
1133{
1134 (void) argv;
1135 if (argc > 2)
1136 myexitfunc (2);
1137 return 0;
1138}
1139 ]]
1140 )], [mhd_cv_decl_noreturn="${decl_noret}"]
1141 )
1142 AS_IF([test "x${mhd_cv_decl_noreturn}" != "xnone"], [break])
1143 done
1144 CFLAGS="${save_CFLAGS}"
1145 ]
1146)
1147AS_VAR_IF([mhd_cv_decl_noreturn], ["none"],
1148 [AC_DEFINE([_MHD_NORETURN], [], [Define to supported 'noreturn' function declaration])],
1149 [AC_DEFINE_UNQUOTED([_MHD_NORETURN], [${mhd_cv_decl_noreturn}], [Define to supported 'noreturn' function declaration])]
1150)
1151
1110# Check for types sizes 1152# Check for types sizes
1111# Types sizes are used as an indirect indication of maximum allowed values for types 1153# Types sizes are used as an indirect indication of maximum allowed values for types
1112# which is used to exclude by preprocessor some compiler checks for values clips 1154# which is used to exclude by preprocessor some compiler checks for values clips