Commit fdc22a60 authored by Eddie Kohler's avatar Eddie Kohler

Linux compilation: Enable some warnings.

We had turned off all warnings in Linux kernel compilation because
otherwise one drowned in errors from the Linux header files, such as
"automatic conversion from void * to char *" and such.  But there is
a way to get user warnings without drowning in kernel warnings: mark
the kernel header files as "system" header files, with -isystem.
So do that; and update configury to control warning options more
carefully.
Signed-off-by: default avatarEddie Kohler <ekohler@gmail.com>
parent 61c1fe97
......@@ -681,16 +681,16 @@ OBJCOPY
NM
LD
AR
KERNEL_CXXFLAGS
KERNEL_CXX
KERNEL_CFLAGS
KERNEL_CC
CXXCPP
KERNEL_CXXFLAGS
ac_ct_CXX
CXXFLAGS
EGREP
GREP
CPP
KERNEL_CFLAGS
DEPCFLAGS
OBJEXT
EXEEXT
......@@ -3139,10 +3139,12 @@ _ACEOF
ac_user_cc=${CC+y}
ac_user_cflags=${CFLAGS+y}
ac_user_kernel_cc=${KERNEL_CC+y}
ac_user_kernel_cflags=${KERNEL_CFLAGS+y}
ac_user_cxx=${CXX+y}
ac_user_cxxflags=${CXXFLAGS+y}
ac_user_kernel_cxx=${KERNEL_CXX+y}
ac_user_kernel_cxxflags=${KERNEL_CXXFLAGS+y}
ac_user_build_cxx=${BUILD_CXX+y}
ac_user_kernel_cxx=${KENREL_CXX+y}
ac_user_depcflags=${DEPCFLAGS+y}
ac_compile_with_warnings=y
......@@ -4670,18 +4672,18 @@ done
ac_base_cc="$CC"
ac_base_cflags="$CFLAGS"
test -z "$ac_user_cflags" -a -n "$GCC" -a -n "$ac_compile_with_warnings" -a -z "$ac_user_depcflags" && \
DEPCFLAGS="-MD -MP"
KERNEL_CFLAGS=`echo "$CFLAGS" | sed 's/-g//'`
WARNING_CFLAGS=
test -z "$ac_user_cflags" -a -n "$GCC" -a -n "$ac_compile_with_warnings" && \
test -n "$GCC" -a -n "$ac_compile_with_warnings" && \
WARNING_CFLAGS=" -W -Wall"
CFLAGS="$CFLAGS$WARNING_CFLAGS"
test -z "$ac_user_cflags" && \
CFLAGS="$CFLAGS$WARNING_CFLAGS"
for ac_header in sys/types.h unistd.h
do :
......@@ -5351,11 +5353,10 @@ $as_echo "#define HAVE_CXX_PRAGMA_INTERFACE 1" >>confdefs.h
ac_base_cxx="$CXX"
test -z "$ac_user_cxxflags" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
CXX="$CXX$CFLAGS_WARNINGS"
KERNEL_CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//'`
ac_base_cxxflags="$CXXFLAGS"
test -z "$ac_user_cxxflags" -a -n "$GXX" && \
CXXFLAGS="$CXXFLAGS$WARNING_CFLAGS"
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
......@@ -5495,16 +5496,20 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
test -z "$ac_user_kernel_cc" && \
KERNEL_CC="$ac_base_cc"
test -z "$ac_user_kernel_cc" -a -n "$GCC" -a -n "$ac_compile_with_warnings" && \
KERNEL_CC="$ac_base_cc -w $WARNING_CFLAGS"
test -z "$ac_kernel_cflags" && \
KERNEL_CFLAGS=`echo "$ac_base_cflags -Wno-undef" | sed 's/-g//'`
test -z "$ac_user_kernel_cxx" && \
KERNEL_CXX="$ac_base_cxx"
test -z "$ac_user_kernel_cxx" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
KERNEL_CXX="$ac_base_cxx -w $WARNING_CFLAGS -fno-exceptions -fno-rtti -fpermissive"
test -z "$ac_user_kernel_cxxflags" && \
KERNEL_CXXFLAGS=`echo "$ac_base_cxxflags -fno-exceptions -fno-rtti -fpermissive -Wno-undef -Wno-pointer-arith" | sed 's/-g//'`
......@@ -7352,7 +7357,7 @@ else
ac_cv_endian=0
cat > conftest.$ac_ext <<EOF
#line 7355 "configure"
#line 7360 "configure"
#include "confdefs.h"
#include <$endian_hdr>
#ifdef __BYTE_ORDER
......@@ -10356,9 +10361,11 @@ if test $ac_have_linux_kernel = y; then
save_cxx="$CXX"
save_cppflags="$CPPFLAGS"
save_cflags="$CFLAGS"
save_cxxflags="$CXXFLAGS"
unset -v CFLAGS CPPFLAGS
CC="$KERNEL_CC"
CXX="$KERNEL_CXX"
CXXFLAGS="$KERNEL_CXXFLAGS"
linux_makeargs=
if test -n "$ARCH"; then
......@@ -11493,6 +11500,7 @@ $as_echo "$ac_cv_linux_getboottime" >&6; }
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
CFLAGS="$save_cflags"
CXXFLAGS="$save_cxxflags"
export CFLAGS CPPFLAGS
if test $ac_cv_cxx_aware_system = yes; then
......
......@@ -1134,9 +1134,11 @@ if test $ac_have_linux_kernel = y; then
save_cxx="$CXX"
save_cppflags="$CPPFLAGS"
save_cflags="$CFLAGS"
save_cxxflags="$CXXFLAGS"
unset -v CFLAGS CPPFLAGS
CC="$KERNEL_CC"
CXX="$KERNEL_CXX"
CXXFLAGS="$KERNEL_CXXFLAGS"
dnl check for arguments to pass to Linux make
linux_makeargs=
......@@ -1451,6 +1453,7 @@ void f1(int64_t) { // will fail if long long and int64_t are the same type
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
CFLAGS="$save_cflags"
CXXFLAGS="$save_cxxflags"
export CFLAGS CPPFLAGS
if test $ac_cv_cxx_aware_system = yes; then
......
......@@ -99,7 +99,8 @@ LINUXCFLAGS = $(shell echo "$(CPPFLAGS) $(CFLAGS) $(LINUXINCLUDE)" \
-e s,-Werror-implicit-function-declaration,, \
-e "s,-Iinclude ,-I$(linux_builddir)/include ",g \
-e "s,-Iinclude2 ,-I$(linux_builddir)/include2 ",g \
-e s,-Iinclude/,-I$(linux_srcdir)include/,g @LINUX_FIXINCLUDES_PROGRAM@)
-e s,-Iinclude/,-I$(linux_srcdir)include/,g \
@LINUX_FIXINCLUDES_PROGRAM@)
CLICKCPPFLAGS = @CPPFLAGS@ -DCLICK_LINUXMODULE
CLICKCFLAGS = @KERNEL_CFLAGS@
CLICKCXXFLAGS = @KERNEL_CXXFLAGS@
......
......@@ -315,4 +315,5 @@ while (($k, $v) = each %done) {
push @sed, "-e s,$k,$v,";
}
@sed = sort { length($a) <=> length($b) } @sed;
push @sed, "-e s,\\ -I,\\ -isystem\\ ,g";
print join(" ", @sed), "\n";
......@@ -16,10 +16,12 @@ AC_DEFUN([CLICK_INIT], [
ac_user_cc=${CC+y}
ac_user_cflags=${CFLAGS+y}
ac_user_kernel_cc=${KERNEL_CC+y}
ac_user_kernel_cflags=${KERNEL_CFLAGS+y}
ac_user_cxx=${CXX+y}
ac_user_cxxflags=${CXXFLAGS+y}
ac_user_kernel_cxx=${KERNEL_CXX+y}
ac_user_kernel_cxxflags=${KERNEL_CXXFLAGS+y}
ac_user_build_cxx=${BUILD_CXX+y}
ac_user_kernel_cxx=${KENREL_CXX+y}
ac_user_depcflags=${DEPCFLAGS+y}
ac_compile_with_warnings=y
......@@ -43,19 +45,18 @@ AC_DEFUN([CLICK_PROG_CC], [
AC_REQUIRE([AC_PROG_CC])
ac_base_cc="$CC"
ac_base_cflags="$CFLAGS"
test -z "$ac_user_cflags" -a -n "$GCC" -a -n "$ac_compile_with_warnings" -a -z "$ac_user_depcflags" && \
DEPCFLAGS="-MD -MP"
AC_SUBST(DEPCFLAGS)
dnl do not add WARNING_CFLAGS to KERNEL_CFLAGS
KERNEL_CFLAGS=`echo "$CFLAGS" | sed 's/-g//'`
AC_SUBST(KERNEL_CFLAGS)
WARNING_CFLAGS=
test -z "$ac_user_cflags" -a -n "$GCC" -a -n "$ac_compile_with_warnings" && \
test -n "$GCC" -a -n "$ac_compile_with_warnings" && \
WARNING_CFLAGS=" -W -Wall"
CFLAGS="$CFLAGS$WARNING_CFLAGS"
test -z "$ac_user_cflags" && \
CFLAGS="$CFLAGS$WARNING_CFLAGS"
AC_CHECK_HEADERS(sys/types.h unistd.h)
])
......@@ -141,11 +142,10 @@ and Linux header files are GCC-specific.)
dnl define correct warning options
ac_base_cxx="$CXX"
test -z "$ac_user_cxxflags" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
CXX="$CXX$CFLAGS_WARNINGS"
ac_base_cxxflags="$CXXFLAGS"
KERNEL_CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//'`
AC_SUBST(KERNEL_CXXFLAGS)
test -z "$ac_user_cxxflags" -a -n "$GXX" && \
CXXFLAGS="$CXXFLAGS$WARNING_CFLAGS"
])
......@@ -171,9 +171,11 @@ AC_DEFUN([CLICK_PROG_KERNEL_CC], [
AC_REQUIRE([CLICK_PROG_CC])
test -z "$ac_user_kernel_cc" && \
KERNEL_CC="$ac_base_cc"
test -z "$ac_user_kernel_cc" -a -n "$GCC" -a -n "$ac_compile_with_warnings" && \
KERNEL_CC="$ac_base_cc -w $WARNING_CFLAGS"
AC_SUBST(KERNEL_CC)
test -z "$ac_kernel_cflags" && \
KERNEL_CFLAGS=`echo "$ac_base_cflags -Wno-undef" | sed 's/-g//'`
AC_SUBST(KERNEL_CFLAGS)
])
......@@ -186,9 +188,11 @@ AC_DEFUN([CLICK_PROG_KERNEL_CXX], [
AC_REQUIRE([CLICK_PROG_CXX])
test -z "$ac_user_kernel_cxx" && \
KERNEL_CXX="$ac_base_cxx"
test -z "$ac_user_kernel_cxx" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
KERNEL_CXX="$ac_base_cxx -w $WARNING_CFLAGS -fno-exceptions -fno-rtti -fpermissive"
AC_SUBST(KERNEL_CXX)
test -z "$ac_user_kernel_cxxflags" && \
KERNEL_CXXFLAGS=`echo "$ac_base_cxxflags -fno-exceptions -fno-rtti -fpermissive -Wno-undef -Wno-pointer-arith" | sed 's/-g//'`
AC_SUBST(KERNEL_CXXFLAGS)
])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment