Skip to content

Commit

Permalink
fixup! Only define FALLTHROUGH when __attribute__((fallthrough)) is d…
Browse files Browse the repository at this point in the history
…etected.

Add -Werror to make sure that we detect it.
  • Loading branch information
nmathewson committed May 6, 2020
1 parent 9f4da41 commit a6e83f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ if test "$tor_cv_c_c99_designated_init" != "yes"; then
AC_MSG_ERROR([Your compiler doesn't support c99 designated initializers. This is required as of Tor 0.2.6.x])
fi

saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_CACHE_CHECK([for __attribute__((fallthrough))],
tor_cv_c_attr_fallthrough,
[AC_COMPILE_IFELSE(
Expand All @@ -364,6 +366,7 @@ AC_CACHE_CHECK([for __attribute__((fallthrough))],
case 2: fn(); break; } ]])],
[tor_cv_c_attr_fallthrough=yes],
[tor_cv_c_attr_fallthrough=no] )])
CFLAGS="$saved_CFLAGS"

if test "$tor_cv_c_attr_fallthrough" == "yes"; then
AC_DEFINE(HAVE_ATTR_FALLTHROUGH, [1], [defined if we have the fallthrough attribute.])
Expand Down

0 comments on commit a6e83f4

Please sign in to comment.