aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-04-05 22:49:05 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-04-08 17:34:10 +0000
commit57b2a84f3d900eb0b98157095c6aac07cec54fd9 (patch)
treeec069513b90f83bbb31843a17204ffb0fb97fa69 /configure.ac
parent434bbd67a06803ce6bb9a8e0adc6d596246bc458 (diff)
Use a single WS_NORETURN macro
Having to define two macros for marking a function as never returning seems a bit redundant. Merge the MSVC and GCC-like attributes into a single WS_NORETURN. Tested with Clang 3.7.1, GCC 4.4.7 and even GCC 4.1.2 using this small program (-Wall -Wextra, the first two generate warnings for uninitialized variables, the last one compiles without warnings): #include <stdlib.h> __attribute__((noreturn)) void foo() { exit(1); } __attribute__((noreturn)) void bar(); void bar() { exit(1); } int main() { int j, i; if (i) { bar(); return j; } foo(); return j; } Change-Id: I7d19c15e61b8f8fa4936864407199c4109f8cc82 Reviewed-on: https://code.wireshark.org/review/14822 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac13
1 files changed, 2 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 272af90a7b..50f6c85ff8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1221,8 +1221,10 @@ AC_SUBST(CFLAGS_SSE42)
#
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
AC_DEFINE(_U_, __attribute__((unused)), [Hint to the compiler that a function parameters is not used])
+ AC_DEFINE(WS_NORETURN, __attribute((noreturn)), [Hint to the compiler that a function never returns])
else
AC_DEFINE(_U_, , [Hint to the compiler that a function parameters is not used])
+ AC_DEFINE(WS_NORETURN, , [Hint to the compiler that a function never returns])
fi
# If we're running GCC or CLang, use FORTIFY_SOURCE=2
@@ -2651,17 +2653,6 @@ else
fi
AC_SUBST(LIBSSH_LIBS)
-#
-# Define WS_MSVC_NORETURN appropriately for declarations of routines that
-# never return (just like Charlie on the MTA).
-#
-# Note that MSVC++ expects __declspec(noreturn) to precede the function
-# name and GCC, as far as I know, expects __attribute__((noreturn)) to
-# follow the function name, so we need two different flavors of
-# noreturn tag.
-#
-AC_DEFINE(WS_MSVC_NORETURN,, [Define as the string to precede declarations of routines that never return])
-
dnl Checks for typedefs, structures, and compiler characteristics.
# AC_C_CONST