"Fossies" - the Fresh Open Source Software Archive

Member "tcpflow-1.6.1/m4/slg_gcc_all_warnings.m4" (19 Feb 2021, 3203 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ################################################################
    2 #
    3 # Enable all the compiler debugging we can find
    4 # Simson L. Garfinkel
    5 #
    6 # This is originally from PhotoRec, but modified substantially by Simson
    7 # Figure out which flags we can use with the compiler. 
    8 #
    9 # These I don't like:
   10 # -Wdeclaration-after-statement -Wconversion
   11 # doesn't work: -Wunreachable-code 
   12 # causes configure to crash on gcc-4.2.1: -Wsign-compare-Winline 
   13 # causes warnings with unistd.h:  -Wnested-externs 
   14 # Just causes too much annoyance: -Wmissing-format-attribute 
   15 
   16 # First, see if we are using CLANG
   17 using_clang=no
   18 if (g++ --version 2>&1 | grep clang > /dev/null) ; 
   19 then 
   20    AC_MSG_NOTICE([g++ is really clang++])
   21    using_clang=yes
   22 fi
   23 if test x$CXX == "xclang++" ; then
   24    using_clang=yes
   25 fi
   26 
   27 
   28 
   29 # Check GCC
   30 C_WARNINGS_TO_TEST="-MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes \
   31     -Wshadow -Wwrite-strings -Wcast-align -Waggregate-return \
   32     -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wdisabled-optimization \
   33     -Wfloat-equal -Wmultichar -Wc++-compat -Wmissing-noreturn "
   34 
   35 if test x"${mingw}" != "xyes" ; then
   36   # add the warnings we do not want to do on mingw
   37   C_WARNINGS_TO_TEST="$C_WARNINGS_TO_TEST -Wall -Wstrict-prototypes"
   38 fi
   39 
   40 if test $using_clang == "no" ; then
   41   # -Wstrict-null-sentinel is not supported under clang
   42   CXX_WARNINGS_TO_TEST="$CXX_WARNINGS_TO_TEST -Wstrict-null-sentinel"
   43 fi
   44 
   45 
   46 
   47 echo "C Warnings to test: $C_WARNINGS_TO_TEST"
   48 
   49 for option in $C_WARNINGS_TO_TEST
   50 do
   51   SAVE_CFLAGS="$CFLAGS"
   52   CFLAGS="$CFLAGS $option"
   53   AC_MSG_CHECKING([whether gcc understands $option])
   54   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
   55       [has_option=yes],
   56       [has_option=no; CFLAGS="$SAVE_CFLAGS"])
   57   AC_MSG_RESULT($has_option)
   58   unset has_option
   59   unset SAVE_CFLAGS
   60   if test $option = "-Wmissing-format-attribute" ; then
   61     AC_DEFINE(HAVE_MISSING_FORMAT_ATTRIBUTE_WARNING,1,
   62 		[Indicates that we have the -Wmissing-format-attribute G++ warning])
   63   fi
   64 done
   65 unset option
   66 
   67 
   68 # Check G++
   69 # We don't use these warnings:
   70 # -Waggregate-return -- aggregate returns are GOOD; they simplify code design
   71 # We can use these warnings after ZLIB gets upgraded:
   72 # -Wundef  --- causes problems with zlib
   73 # -Wcast-qual 
   74 # -Wmissing-format-attribute  --- Just too annoying
   75 AC_LANG_PUSH(C++)
   76 AC_CHECK_HEADERS([string])
   77 CXX_WARNINGS_TO_TEST="-Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith \
   78     -Wshadow -Wwrite-strings -Wcast-align  \
   79     -Wredundant-decls -Wdisabled-optimization \
   80     -Wfloat-equal -Wmultichar -Wmissing-noreturn \
   81     -Woverloaded-virtual -Wsign-promo \
   82     -funit-at-a-time"
   83 
   84 if test x"${mingw}" != "xyes" ; then
   85   # add the warnings we don't want to do on mingw
   86   CXX_WARNINGS_TO_TEST="$CXX_WARNINGS_TO_TEST  -Weffc++"
   87 fi
   88 
   89 echo "C++ Warnings to test: $CXX_WARNINGS_TO_TEST"
   90 
   91 for option in $CXX_WARNINGS_TO_TEST
   92 do
   93   SAVE_CXXFLAGS="$CXXFLAGS"
   94   CXXFLAGS="$CXXFLAGS $option"
   95   AC_MSG_CHECKING([whether g++ understands $option])
   96   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
   97       [has_option=yes],
   98       [has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
   99   AC_MSG_RESULT($has_option)
  100   unset has_option
  101   unset SAVE_CXXFLAGS
  102 done
  103 unset option
  104 AC_LANG_POP()    
  105 
  106