From c30888e04e03507343b50a1d67ec0795dda3fae1 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 22 Jul 2009 00:32:57 +0000 Subject: [PATCH] Make -fno-strict-aliasing unconditional when using GCC. It was intended to be enabled when the GCC major version was greater than or equal to 4, but the test was backwards to it was in effect for for versions less than or equal to 4. So it was in effect already unconditional. -fstrict-aliasing is supported all the way back in 2.95.2, and I suppose -fno-strict-aliasing is too. --- CHANGELOG | 5 +++++ configure | 36 ++++-------------------------------- configure.ac | 32 ++++---------------------------- 3 files changed, 13 insertions(+), 60 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 90830d204..94ce2aa61 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # Nmap Changelog ($Id$); -*-text-*- +o The -fno-strict-aliasing option is now used unconditionally when + using GCC. It was already this way, in effect, because a test + against the GCC version number was reversed: <= 4 rather than >= 4. + Solar Designer reported the problem. + o Nmap now prints a warning instead of a fatal error when the hardware address of an interface can't be found. This is the case for FireWire interfaces, which have a hardware address format not diff --git a/configure b/configure index a9aba8495..b50b54182 100755 --- a/configure +++ b/configure @@ -4194,38 +4194,10 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - if test -n "$GXX"; then - CXXFLAGS="$CXXFLAGS -Wall " - fi - -{ $as_echo "$as_me:$LINENO: checking whether the compiler is gcc 4 or greater" >&5 -$as_echo_n "checking whether the compiler is gcc 4 or greater... " >&6; } -if test x"$GXX" = xno; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -else - # On some distros, there are snapshots available as gcc4 - if test -z "$ac_cv_prog_CC" || test x"$CC" = xgcc4; then - our_gcc="$CC" - else - our_gcc="$ac_cv_prog_CC" - fi - - nmap_gcc_major_version=0 - case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in - *4.) - nmap_gcc_major_version=4 - ;; - esac - - if test 4 -ge $nmap_gcc_major_version; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" - else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - fi +if test -n "$GXX"; then + # -fno-strict-aliasing disables strict-aliasing optimizations that assume + # that pointers of different types never point to the same object. + CXXFLAGS="$CXXFLAGS -Wall -fno-strict-aliasing" fi # Remember that all following tests will run with this CXXFLAGS by default diff --git a/configure.ac b/configure.ac index 4f5de3669..d7ea3243d 100644 --- a/configure.ac +++ b/configure.ac @@ -45,34 +45,10 @@ AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL - if test -n "$GXX"; then - CXXFLAGS="$CXXFLAGS -Wall " - fi - -AC_MSG_CHECKING([whether the compiler is gcc 4 or greater]) -if test x"$GXX" = xno; then - AC_MSG_RESULT([no]) -else - # On some distros, there are snapshots available as gcc4 - if test -z "$ac_cv_prog_CC" || test x"$CC" = xgcc4; then - our_gcc="$CC" - else - our_gcc="$ac_cv_prog_CC" - fi - - nmap_gcc_major_version=0 - case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in - *4.) - nmap_gcc_major_version=4 - ;; - esac - - if test 4 -ge $nmap_gcc_major_version; then - AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" - else - AC_MSG_RESULT([no]) - fi +if test -n "$GXX"; then + # -fno-strict-aliasing disables strict-aliasing optimizations that assume + # that pointers of different types never point to the same object. + CXXFLAGS="$CXXFLAGS -Wall -fno-strict-aliasing" fi # Remember that all following tests will run with this CXXFLAGS by default