2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Move the check for the fallthrough attribute outside the warnings block.

Use AX_APPEND_FLAG instead of addind to CFLAGS directly.
This commit is contained in:
Todd C. Miller 2022-11-29 16:04:14 -07:00
parent 63e58cbbec
commit cfdcd96b63
2 changed files with 611 additions and 105 deletions

631
configure vendored
View File

@ -31802,7 +31802,40 @@ then :
printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h
CFLAGS="${CFLAGS} -fvisibility=hidden"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -fvisibility=hidden "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -fvisibility=hidden"; } >&5
(: CFLAGS already contains -fvisibility=hidden) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -fvisibility=hidden"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-fvisibility=hidden
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
@ -31889,7 +31922,40 @@ printf "%s\n" "$sudo_cv_var_hpux_declspec_libc_function" >&6; }
if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then
printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h
CFLAGS="${CFLAGS} -Bhidden_def"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Bhidden_def "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Bhidden_def"; } >&5
(: CFLAGS already contains -Bhidden_def) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Bhidden_def"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Bhidden_def
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
fi fi
@ -31939,7 +32005,40 @@ then :
printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h printf "%s\n" "#define HAVE_DSO_VISIBILITY 1" >>confdefs.h
CFLAGS="${CFLAGS} -xldscope=hidden"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -xldscope=hidden "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -xldscope=hidden"; } >&5
(: CFLAGS already contains -xldscope=hidden) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -xldscope=hidden"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-xldscope=hidden
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
@ -33563,46 +33662,290 @@ printf "%s\n" "#define os_init $OS_INIT" >>confdefs.h
if test -n "$GCC"; then if test -n "$GCC"; then
if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then #
CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith -Wno-unknown-pragmas -Wmissing-prototypes -Wwrite-strings" # The fallthrough attribute is supported by gcc 7.0 and clang 10.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wshadow" >&5 # This test relies on AC_LANG_WERROR.
printf %s "checking whether C compiler accepts -Wshadow... " >&6; } #
if test ${ax_cv_check_cflags___Wshadow+y} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports the fallthrough attribute" >&5
printf %s "checking whether $CC supports the fallthrough attribute... " >&6; }
if test ${sudo_cv_var_fallthrough_attribute+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else case e in #( else case e in #(
e) e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Wshadow"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
int int main(int argc, char *argv[])
main (void) {
{ int num = argc + 1;
switch (num) {
case 1:
num = 0;
__attribute__((__fallthrough__));
case 0:
num++;
}
return num;
}
;
return 0;
}
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO" if ac_fn_c_try_compile "$LINENO"
then : then :
ax_cv_check_cflags___Wshadow=yes
sudo_cv_var_fallthrough_attribute=yes
else case e in #( else case e in #(
e) ax_cv_check_cflags___Wshadow=no ;; e)
sudo_cv_var_fallthrough_attribute=no
;;
esac esac
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags ;; ;;
esac esac
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wshadow" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_fallthrough_attribute" >&5
printf "%s\n" "$ax_cv_check_cflags___Wshadow" >&6; } printf "%s\n" "$sudo_cv_var_fallthrough_attribute" >&6; }
if test "x$ax_cv_check_cflags___Wshadow" = xyes if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
printf "%s\n" "#define HAVE_FALLTHROUGH_ATTRIBUTE 1" >>confdefs.h
fi
if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
if test ${CFLAGS+y}
then : then :
CFLAGS="$CFLAGS -Wshadow"
case " $CFLAGS " in #(
*" -Wall "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wall"; } >&5
(: CFLAGS already contains -Wall) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wall"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #( else case e in #(
e) : ;; e)
CFLAGS=-Wall
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wmissing-prototypes "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wmissing-prototypes"; } >&5
(: CFLAGS already contains -Wmissing-prototypes) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wmissing-prototypes"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wmissing-prototypes
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wno-unknown-pragmas "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wno-unknown-pragmas"; } >&5
(: CFLAGS already contains -Wno-unknown-pragmas) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wno-unknown-pragmas"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wno-unknown-pragmas
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wpointer-arith "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wpointer-arith"; } >&5
(: CFLAGS already contains -Wpointer-arith) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wpointer-arith"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wpointer-arith
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wshadow "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wshadow"; } >&5
(: CFLAGS already contains -Wshadow) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wshadow"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wshadow
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wsign-compare "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wsign-compare"; } >&5
(: CFLAGS already contains -Wsign-compare) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wsign-compare"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wsign-compare
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wwrite-strings "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wwrite-strings"; } >&5
(: CFLAGS already contains -Wwrite-strings) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wwrite-strings"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wwrite-strings
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac esac
fi fi
@ -33641,7 +33984,40 @@ fi
printf "%s\n" "$ax_cv_check_cflags___Wvla" >&6; } printf "%s\n" "$ax_cv_check_cflags___Wvla" >&6; }
if test "x$ax_cv_check_cflags___Wvla" = xyes if test "x$ax_cv_check_cflags___Wvla" = xyes
then : then :
CFLAGS="$CFLAGS -Wvla"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wvla "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wvla"; } >&5
(: CFLAGS already contains -Wvla) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wvla"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wvla
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
else case e in #( else case e in #(
e) : ;; e) : ;;
esac esac
@ -33682,7 +34058,40 @@ fi
printf "%s\n" "$ax_cv_check_cflags___Walloca" >&6; } printf "%s\n" "$ax_cv_check_cflags___Walloca" >&6; }
if test "x$ax_cv_check_cflags___Walloca" = xyes if test "x$ax_cv_check_cflags___Walloca" = xyes
then : then :
CFLAGS="$CFLAGS -Walloca"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Walloca "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Walloca"; } >&5
(: CFLAGS already contains -Walloca) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Walloca"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Walloca
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
else case e in #( else case e in #(
e) : ;; e) : ;;
esac esac
@ -33723,64 +34132,154 @@ fi
printf "%s\n" "$ax_cv_check_cflags___Wtrampolines" >&6; } printf "%s\n" "$ax_cv_check_cflags___Wtrampolines" >&6; }
if test "x$ax_cv_check_cflags___Wtrampolines" = xyes if test "x$ax_cv_check_cflags___Wtrampolines" = xyes
then : then :
CFLAGS="$CFLAGS -Wtrampolines"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wtrampolines "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wtrampolines"; } >&5
(: CFLAGS already contains -Wtrampolines) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wtrampolines"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wtrampolines
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
else case e in #( else case e in #(
e) : ;; e) : ;;
esac esac
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports the fallthrough attribute" >&5 if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
printf %s "checking whether $CC supports the fallthrough attribute... " >&6; }
if test ${sudo_cv_var_fallthrough_attribute+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char *argv[]) if test ${CFLAGS+y}
{
int num = argc + 1;
switch (num) {
case 1:
num = 0;
__attribute__((__fallthrough__));
case 0:
num++;
}
return num;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then : then :
sudo_cv_var_fallthrough_attribute=yes case " $CFLAGS " in #(
*" -Wimplicit-fallthrough "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wimplicit-fallthrough"; } >&5
(: CFLAGS already contains -Wimplicit-fallthrough) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wimplicit-fallthrough"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #( else case e in #(
e) e)
sudo_cv_var_fallthrough_attribute=no CFLAGS=-Wimplicit-fallthrough
;; { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac esac
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_fallthrough_attribute" >&5
printf "%s\n" "$sudo_cv_var_fallthrough_attribute" >&6; }
if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
printf "%s\n" "#define HAVE_FALLTHROUGH_ATTRIBUTE 1" >>confdefs.h
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi fi
fi fi
if test X"$enable_werror" = X"yes"; then if test X"$enable_werror" = X"yes"; then
CFLAGS="${CFLAGS} -Werror"
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Werror "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Werror"; } >&5
(: CFLAGS already contains -Werror) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Werror"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Werror
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
fi fi
case "$host_os" in case "$host_os" in
# Avoid unwanted warnings on macOS # Avoid unwanted warnings on macOS
darwin*) CFLAGS="${CFLAGS} -Wno-deprecated-declarations";; darwin*)
if test ${CFLAGS+y}
then :
case " $CFLAGS " in #(
*" -Wno-deprecated-declarations "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Wno-deprecated-declarations"; } >&5
(: CFLAGS already contains -Wno-deprecated-declarations) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append CFLAGS " -Wno-deprecated-declarations"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else case e in #(
e)
CFLAGS=-Wno-deprecated-declarations
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
(: CFLAGS="$CFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
fi
;;
esac esac
fi fi

View File

@ -4649,7 +4649,7 @@ dnl
if test -n "$GCC"; then if test -n "$GCC"; then
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [ AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
AC_DEFINE(HAVE_DSO_VISIBILITY) AC_DEFINE(HAVE_DSO_VISIBILITY)
CFLAGS="${CFLAGS} -fvisibility=hidden" AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS])
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
]) ])
@ -4676,7 +4676,7 @@ else
) )
if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then
AC_DEFINE(HAVE_DSO_VISIBILITY) AC_DEFINE(HAVE_DSO_VISIBILITY)
CFLAGS="${CFLAGS} -Bhidden_def" AX_APPEND_FLAG([-Bhidden_def], [CFLAGS])
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
fi fi
@ -4685,7 +4685,7 @@ else
solaris2*) solaris2*)
AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [ AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [
AC_DEFINE(HAVE_DSO_VISIBILITY) AC_DEFINE(HAVE_DSO_VISIBILITY)
CFLAGS="${CFLAGS} -xldscope=hidden" AX_APPEND_FLAG([-xldscope=hidden], [CFLAGS])
LT_LDEXPORTS= LT_LDEXPORTS=
LT_LDDEP= LT_LDDEP=
]) ])
@ -5012,53 +5012,60 @@ dnl
dnl We add -Wall and -Werror after all tests so they don't cause failures dnl We add -Wall and -Werror after all tests so they don't cause failures
dnl dnl
if test -n "$GCC"; then if test -n "$GCC"; then
#
# The fallthrough attribute is supported by gcc 7.0 and clang 10.
# This test relies on AC_LANG_WERROR.
#
AC_CACHE_CHECK([whether $CC supports the fallthrough attribute],
[sudo_cv_var_fallthrough_attribute],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char *argv[])
{
int num = argc + 1;
switch (num) {
case 1:
num = 0;
__attribute__((__fallthrough__));
case 0:
num++;
}
return num;
}
]])],
[
sudo_cv_var_fallthrough_attribute=yes
],
[
sudo_cv_var_fallthrough_attribute=no]
)]
)
if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
AC_DEFINE(HAVE_FALLTHROUGH_ATTRIBUTE)
fi
if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
dnl dnl
dnl Default warnings for development use. dnl Default warnings for development use.
dnl dnl
CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith -Wno-unknown-pragmas -Wmissing-prototypes -Wwrite-strings" AX_APPEND_FLAG([-Wall], [CFLAGS])
AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"]) AX_APPEND_FLAG([-Wmissing-prototypes], [CFLAGS])
AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"]) AX_APPEND_FLAG([-Wno-unknown-pragmas], [CFLAGS])
AX_CHECK_COMPILE_FLAG([-Walloca], [CFLAGS="$CFLAGS -Walloca"]) AX_APPEND_FLAG([-Wpointer-arith], [CFLAGS])
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [CFLAGS="$CFLAGS -Wtrampolines"]) AX_APPEND_FLAG([-Wshadow], [CFLAGS])
dnl AX_APPEND_FLAG([-Wsign-compare], [CFLAGS])
dnl The fallthrough attribute is supported by gcc 7.0 and clang 10. AX_APPEND_FLAG([-Wwrite-strings], [CFLAGS])
dnl This test relies on AC_LANG_WERROR. AX_CHECK_COMPILE_FLAG([-Wvla], [AX_APPEND_FLAG([-Wvla], [CFLAGS])])
dnl AX_CHECK_COMPILE_FLAG([-Walloca], [AX_APPEND_FLAG([-Walloca], [CFLAGS])])
AC_CACHE_CHECK([whether $CC supports the fallthrough attribute], AX_CHECK_COMPILE_FLAG([-Wtrampolines], [AX_APPEND_FLAG([-Wtrampolines], [CFLAGS])])
[sudo_cv_var_fallthrough_attribute],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char *argv[])
{
int num = argc + 1;
switch (num) {
case 1:
num = 0;
__attribute__((__fallthrough__));
case 0:
num++;
}
return num;
}
]])],
[
sudo_cv_var_fallthrough_attribute=yes
],
[
sudo_cv_var_fallthrough_attribute=no]
)]
)
if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
AC_DEFINE(HAVE_FALLTHROUGH_ATTRIBUTE) AX_APPEND_FLAG([-Wimplicit-fallthrough], [CFLAGS])
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi fi
fi fi
if test X"$enable_werror" = X"yes"; then if test X"$enable_werror" = X"yes"; then
CFLAGS="${CFLAGS} -Werror" AX_APPEND_FLAG([-Werror], [CFLAGS])
fi fi
case "$host_os" in case "$host_os" in
# Avoid unwanted warnings on macOS # Avoid unwanted warnings on macOS
darwin*) CFLAGS="${CFLAGS} -Wno-deprecated-declarations";; darwin*) AX_APPEND_FLAG([-Wno-deprecated-declarations], [CFLAGS]);;
esac esac
fi fi