diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-12-30 08:33:39 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-12-30 08:33:39 -0800 |
commit | 6727cde034cecfbcb1521b1e568a19b3fb621bc6 (patch) | |
tree | 210459d99cdeefe3d13a8fa038eaf49fe573bb74 | |
parent | 5f67b95d218e1ef3473c39bca2f6491503aeeabe (diff) | |
download | txr-6727cde034cecfbcb1521b1e568a19b3fb621bc6.tar.gz txr-6727cde034cecfbcb1521b1e568a19b3fb621bc6.tar.bz2 txr-6727cde034cecfbcb1521b1e568a19b3fb621bc6.zip |
configure: detect warning opts missing in older compilers.
* configure (diag_flags): Remove -Wvla and
-Werror=declaration-after-statement.
(diag_flags_given): New variable.
New test: if diag_flags_given indicates that diag_flags were
not specified by the user, then we try to add additional
flags, subject to them being available, which we test by
compiling the hello-world program with those flags. We rely on
the hello-world program being left over by the previous
compiler sanity check.
-rwxr-xr-x | configure | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -167,8 +167,9 @@ nm='$(cross)$(tool_prefix)nm' opt_flags='-O2 -fno-stack-protector' lang_flags='-D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE' diag_flags="-Wall -Wextra -Werror=implicit-function-declaration \ - -Werror=missing-prototypes -Werror=strict-prototypes -Werror=vla \ - -Werror=old-style-definition -Werror=declaration-after-statement" + -Werror=missing-prototypes -Werror=strict-prototypes \ + -Werror=old-style-definition" +diag_flags_given= debug_flags=-g debug_only_flags=-DTXR_DEBUG debug_also= @@ -1055,6 +1056,19 @@ else printf "okay\n" fi +if ! [ $diag_flags_given ] ; then + for opt in -Werror=vla -Werror=declaration-after-statement ; do + printf "Checking for %s ... " $opt + + if conftest EXTRA_FLAGS="-Werror $opt" ; then + printf "yes\n" + diag_flags="$diag_flags $opt" + else + printf "no\n" + fi + done +fi + printf "Checking compiler version for various workarounds ... " output=$($make conftest.ccver) |