diff options
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -1323,6 +1323,47 @@ fi AC_MSG_RESULT($ac_cv___attribute___noreturn_function_pointer) ]) +dnl +dnl Test whether __attribute__((fallthrough)) can be used without warnings +dnl + +AC_DEFUN(AC_C___ATTRIBUTE___FALLTHROUGH, [ +AC_MSG_CHECKING([whether __attribute__((fallthrough)) can be used without warnings]) +AC_CACHE_VAL(ac_cv___attribute___fallthrough, [ +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors" +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ +#include <stdio.h> + +int +main(int argc, char **argv) +{ + int x = 1; + switch (x) + { + case 1: + printf ("x == %d\n", x); + __attribute__ ((fallthrough)); + case 2: + printf ("x == %d\n", x); + break; + default: + return 0; + } + return x; +} + ]])], +ac_cv___attribute___fallthrough=yes, +ac_cv___attribute___fallthrough=no)]) +CFLAGS="$save_CFLAGS" +if test "$ac_cv___attribute___fallthrough" = "yes"; then + AC_DEFINE(__ATTRIBUTE___FALLTHROUGH_OK, 1, + [define if your compiler allows __attribute__((fallthrough)) without a warning]) +fi +AC_MSG_RESULT($ac_cv___attribute___fallthrough) +]) + AC_DEFUN(AC_LBL_SSLEAY, [ # |