summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-02-09 10:27:18 -0600
committerMark Wielaard <mark@klomp.org>2018-02-10 03:19:26 +0100
commit555e15ebe8bf1eb33d00747173cfc80cc65648a4 (patch)
tree6aa9cca6e04514cbc45d88f96a873cc6a4767472 /configure.ac
parent240a068fcf3eb6bbcda525f80c8778de62621d9e (diff)
Use fallthrough attribute.
Use __attribute__ ((fallthrough)) to indicate switch case fall through instead of a comment. This ensures that the fallthrough warning is not triggered even if the file is pre-processed (hence stripping the comments) before it is compiled. The actual fallback implementation is hidden behind a FALLBACK macro in case the compiler doesn't support it. Finally, the -Wimplict-fallthrough warning was upgraded to only allow the attribute to satisfy it; a comment alone is no longer sufficient. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac6
1 files changed, 6 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 4ab8816a..4cdb12af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -456,6 +456,12 @@ CFLAGS="$old_CFLAGS"])
AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING,
[test "x$ac_cv_implicit_fallthrough" != "xno"])
+# Assume the fallthrough attribute is supported if -Wimplict-fallthrough is supported
+if test "$ac_cv_implicit_fallthrough" = "yes"; then
+ AC_DEFINE([HAVE_FALLTHROUGH], [1],
+ [Defined if __attribute__((fallthrough)) is supported])
+fi
+
dnl Check if we have argp available from our libc
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(