Skip to content
Snippets Groups Projects
Commit 0418645b authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Handle g++ as a compiler when -Wstrict-prototypes is an invalid option, this...

Handle g++ as a compiler when -Wstrict-prototypes is an invalid option, this emits a warning which can become an error.

To add to the fun the standard test program uses 'int main()', so we need our own program to check things, also PACKAGE_URL is a macro re-define, also an error...
parent ff7c133a
No related branches found
No related tags found
1 merge request!536Add the strict-prototype flag and correct all the offending prototypes
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
AC_INIT([SWIFT],[0.7.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim]) AC_INIT([SWIFT],[0.7.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim])
swift_config_flags="$*" swift_config_flags="$*"
# Need to define this, instead of using fifth argument of AC_INIT, until 2.64.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
AC_COPYRIGHT AC_COPYRIGHT
AC_CONFIG_SRCDIR([src/space.c]) AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])
...@@ -687,7 +684,7 @@ if test "x$with_profiler" != "xno"; then ...@@ -687,7 +684,7 @@ if test "x$with_profiler" != "xno"; then
proflibs="-lprofiler" proflibs="-lprofiler"
fi fi
AC_CHECK_LIB([profiler],[ProfilerFlush], AC_CHECK_LIB([profiler],[ProfilerFlush],
[have_profiler="yes" [have_profiler="yes"
AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])], AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])],
[have_profiler="no"], $proflibs) [have_profiler="no"], $proflibs)
...@@ -830,16 +827,17 @@ if test "$enable_warn" != "no"; then ...@@ -830,16 +827,17 @@ if test "$enable_warn" != "no"; then
# We will do this by hand instead and only default to the macro for unknown compilers # We will do this by hand instead and only default to the macro for unknown compilers
case "$ax_cv_c_compiler_vendor" in case "$ax_cv_c_compiler_vendor" in
gnu | clang) gnu | clang)
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow"
;; ;;
intel) intel)
CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow"
;; ;;
*) *)
AX_CFLAGS_WARN_ALL AX_CFLAGS_WARN_ALL
;; ;;
esac esac
# Add a "choke on warning" flag if it exists # Add a "choke on warning" flag if it exists
if test "$enable_warn" = "error"; then if test "$enable_warn" = "error"; then
case "$ax_cv_c_compiler_vendor" in case "$ax_cv_c_compiler_vendor" in
...@@ -848,6 +846,11 @@ if test "$enable_warn" != "no"; then ...@@ -848,6 +846,11 @@ if test "$enable_warn" != "no"; then
;; ;;
esac esac
fi fi
# We want strict-prototypes, but this must still work even if warnings
# are an error.
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[CFLAGS="$CFLAGS -Wstrict-prototypes"],
[CFLAGS="$CFLAGS"],[$CFLAGS],[AC_LANG_SOURCE([int main(void){return 0;}])])
fi fi
# Various package configuration options. # Various package configuration options.
...@@ -1211,6 +1214,11 @@ AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to ...@@ -1211,6 +1214,11 @@ AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to
# Make sure the latest git revision string gets included # Make sure the latest git revision string gets included
touch src/version.c touch src/version.c
# Need to define this, instead of using fifth argument of AC_INIT, until
# 2.64. Defer until now as this redefines PACKAGE_URL, which can emit a
# compilation error when testing with -Werror.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
# Generate output. # Generate output.
AC_OUTPUT AC_OUTPUT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment