Commit 693e2ae3 authored by Eddie Kohler's avatar Eddie Kohler

Avoid warnings when compiling C code in the kernel.

Changes to CFLAGS in 02bc417e induced the
warnings.
Signed-off-by: default avatarEddie Kohler <ekohler@gmail.com>
parent 0d04d543
......@@ -92,11 +92,11 @@ OBJS = $(GENERIC_OBJS) $(ELEMENT_OBJS) $(BSDMODULE_OBJS) elements.o
CPPFLAGS = @CPPFLAGS@ -DCLICK_BSDMODULE
ifeq ($(target_cpu),x86_64)
CFLAGS = @CFLAGS_NDEBUG@ -g -fPIC -fno-builtin
CXXFLAGS = @CXXFLAGS_NDEBUG@ -g -fPIC -fno-builtin
CFLAGS = @KERNEL_CFLAGS@ -g -fPIC -fno-builtin
CXXFLAGS = @KERNEL_CXXFLAGS@ -g -fPIC -fno-builtin
else
CFLAGS = @CFLAGS_NDEBUG@ -g -fno-builtin
CXXFLAGS = @CXXFLAGS_NDEBUG@ -g -fno-builtin
CFLAGS = @KERNEL_CFLAGS@ -g -fno-builtin
CXXFLAGS = @KERNEL_CXXFLAGS@ -g -fno-builtin
endif
DEFS = @DEFS@ -D_KERNEL
......
......@@ -199,8 +199,8 @@ case $driver in
idefs="@DEFS@ -DCLICK_LINUXMODULE"
iincludes="${include_source} -I${includedir}"
icppflags="@CPPFLAGS@"
icxxflags="@CXXFLAGS_NDEBUG@ @DEPCFLAGS@"
icflags="@CFLAGS_NDEBUG@ @DEPCFLAGS@"
icxxflags="@KERNEL_CXXFLAGS@ @DEPCFLAGS@"
icflags="@KERNEL_CFLAGS@ @DEPCFLAGS@"
command="${CXX-@KERNEL_CXX@} ${DEFS-$idefs} ${INCLUDES-$iincludes} ${CPPFLAGS-$icppflags} ${CXXFLAGS-$icxxflags} $cflags $compileflag"
c_command="${CC-@CC@} ${DEFS-$idefs} ${INCLUDES-$iincludes} ${CPPFLAGS-$icppflags} ${CFLAGS-$icflags} $cflags $compileflag"
driver=linuxmodule;;
......@@ -208,8 +208,8 @@ case $driver in
idefs="@DEFS@ -DCLICK_BSDMODULE"
iincludes="-nostdinc ${include_source} -I${includedir}"
icppflags="@CPPFLAGS@"
icxxflags="-fPIC @CXXFLAGS_NDEBUG@ @DEPCFLAGS@"
icflags="-fPIC @CFLAGS_NDEBUG@ @DEPCFLAGS@"
icxxflags="-fPIC @KERNEL_CXXFLAGS@ @DEPCFLAGS@"
icflags="-fPIC @KERNEL_CFLAGS@ @DEPCFLAGS@"
command="${CXX-@KERNEL_CXX@} ${DEFS-$idefs} ${INCLUDES-$iincludes} ${CPPFLAGS-$icppflags} ${CXXFLAGS-$icxxflags} $cflags $compileflag"
c_command="${CC-@CC@} ${DEFS-$idefs} ${INCLUDES-$iincludes} ${CPPFLAGS-$icppflags} ${CFLAGS-$icflags} $cflags $compileflag"
driver=bsdmodule;;
......
......@@ -28,8 +28,8 @@ RANLIB ?= $(CLICKRANLIB) # ?
STRIP ?= $(CLICKSTRIP)
CPPFLAGS ?= $(CLICKCPPFLAGS) -DCLICK_BSDMODULE
CFLAGS ?= $(CLICKCFLAGS_NDEBUG)
CXXFLAGS ?= $(CLICKCXXFLAGS_NDEBUG)
CFLAGS ?= $(CLICKKERNEL_CFLAGS)
CXXFLAGS ?= $(CLICKKERNEL_CXXFLAGS)
DEPCFLAGS ?= $(CLICKDEPCFLAGS)
DEFS ?= $(CLICKDEFS)
......
......@@ -32,9 +32,9 @@ CLICKLINUX_FIXINCLUDES_PROGRAM = @CLICKLINUX_FIXINCLUDES_PROGRAM@
CLICKCPPFLAGS = @CPPFLAGS@
CLICKCFLAGS = @CFLAGS@
CLICKCFLAGS_NDEBUG = @CFLAGS_NDEBUG@
CLICKKERNEL_CFLAGS = @KERNEL_CFLAGS@
CLICKCXXFLAGS = @CXXFLAGS@
CLICKCXXFLAGS_NDEBUG = @CXXFLAGS_NDEBUG@
CLICKKERNEL_CXXFLAGS = @KERNEL_CXXFLAGS@
CLICKDEPCFLAGS = @DEPCFLAGS@
CLICKDEFS = @DEFS@
......
......@@ -29,17 +29,17 @@ LINUXCFLAGS = $(shell echo "$(CPPFLAGS) $(CFLAGS) $(LINUXINCLUDE)" \
-e "s,-Iinclude2 ,-I$(CLICKLINUX_BUILDDIR)/include2 ",g \
-e s,-Iinclude/,-I$(CLICKLINUX_SRCDIR)include/,g $(CLICKLINUX_FIXINCLUDES_PROGRAM))
CXXFLAGS ?= $(CLICKCXXFLAGS_NDEBUG)
CXXFLAGS ?= $(CLICKKERNEL_CXXFLAGS)
DEPCFLAGS ?= -Wp,-MD,$(depfile)
DEFS ?= $(CLICKDEFS)
INCLUDES ?= $(CLICKINCLUDES)
CXXCOMPILE = $(CLICKKERNEL_CXX) $(LINUXCFLAGS) $(CLICKCPPFLAGS) \
$(CLICKCFLAGS_NDEBUG) $(CXXFLAGS) $(PACKAGE_CXXFLAGS) \
$(CLICKKERNEL_CFLAGS) $(CXXFLAGS) $(PACKAGE_CXXFLAGS) \
$(DEFS) $(INCLUDES)
COMPILE = $(CLICKKERNEL_CC) $(LINUXCFLAGS) $(CLICKCPPFLAGS) \
$(CLICKCFLAGS_NDEBUG) $(PACKAGE_CFLAGS) \
$(CLICKKERNEL_CFLAGS) $(PACKAGE_CFLAGS) \
$(DEFS) $(INCLUDES)
packagesrcdir ?= $(srcdir)
......@@ -71,7 +71,7 @@ cmd_ccompile = $(COMPILE) $(DEPCFLAGS) $(compile_option) -o $@ $<
quiet_cmd_ccompile_nodep = CC $(quiet_modtag) $(subst $(obj)/,,$@)
cmd_ccompile_nodep = $(COMPILE) $(compile_option) -o $@ $<
EXTRA_CFLAGS += $(CLICKCPPFLAGS) $(CLICKCFLAGS_NDEBUG) $(CLICKDEFS) $(CLICKINCLUDES)
EXTRA_CFLAGS += $(CLICKCPPFLAGS) $(CLICKKERNEL_CFLAGS) $(CLICKDEFS) $(CLICKINCLUDES)
ifneq ($(KBUILD_EXTMOD),)
ifeq ($(srcdir),.)
......
......@@ -25,8 +25,8 @@ RANLIB ?= $(CLICKRANLIB)
STRIP ?= $(CLICKSTRIP)
CPPFLAGS ?= $(CLICKCPPFLAGS) -DCLICK_LINUXMODULE
CFLAGS ?= $(CLICKCFLAGS_NDEBUG)
CXXFLAGS ?= $(CLICKCXXFLAGS_NDEBUG)
CFLAGS ?= $(CLICKKERNEL_CFLAGS)
CXXFLAGS ?= $(CLICKKERNEL_CXXFLAGS)
DEPCFLAGS ?= $(CLICKDEPCFLAGS)
DEFS ?= $(CLICKDEFS)
......
......@@ -101,8 +101,8 @@ LINUXCFLAGS = $(shell echo "$(CPPFLAGS) $(CFLAGS) $(LINUXINCLUDE)" \
-e "s,-Iinclude2 ,-I$(linux_builddir)/include2 ",g \
-e s,-Iinclude/,-I$(linux_srcdir)include/,g @LINUX_FIXINCLUDES_PROGRAM@)
CLICKCPPFLAGS = @CPPFLAGS@ -DCLICK_LINUXMODULE
CLICKCFLAGS = @CFLAGS_NDEBUG@
CLICKCXXFLAGS = @CXXFLAGS_NDEBUG@
CLICKCFLAGS = @KERNEL_CFLAGS@
CLICKCXXFLAGS = @KERNEL_CXXFLAGS@
CLICKDEPCFLAGS = -Wp,-MD,$(depfile)
CLICKDEFS = @DEFS@
......@@ -276,8 +276,8 @@ OBJS = $(LIB_CXX_OBJS) $(LIB_C_OBJS) $(STD_ELEMENT_OBJS) $(ELEMENT_OBJS) \
$(LINUXMODULE_CXX_OBJS) $(LINUXMODULE_C_OBJS) $(ELEMENTSCONF).o
CPPFLAGS = @CPPFLAGS@ -DCLICK_LINUXMODULE
CFLAGS = @CFLAGS_NDEBUG@
CXXFLAGS = @CXXFLAGS_NDEBUG@
CFLAGS = @KERNEL_CFLAGS@
CXXFLAGS = @KERNEL_CXXFLAGS@
DEPCFLAGS = @DEPCFLAGS@
DEFS = @DEFS@
......
......@@ -43,15 +43,20 @@ AC_DEFUN([CLICK_PROG_CC], [
AC_REQUIRE([AC_PROG_CC])
ac_base_cc="$CC"
test -z "$ac_user_cflags" -a -n "$GCC" -a -n "$ac_compile_with_warnings" && \
CFLAGS="$CFLAGS -W -Wall"
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)
CFLAGS_NDEBUG=`echo "$CFLAGS" | sed 's/-g//'`
AC_SUBST(CFLAGS_NDEBUG)
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" && \
WARNING_CFLAGS=" -W -Wall"
CFLAGS="$CFLAGS$WARNING_CFLAGS"
AC_CHECK_HEADERS(sys/types.h unistd.h)
])
......@@ -135,16 +140,12 @@ and Linux header files are GCC-specific.)
dnl define correct warning options
CXX_WARNINGS=
test -z "$ac_user_cxxflags" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
CXX_WARNINGS="-W -Wall"
ac_base_cxx="$CXX"
test -z "$ac_user_cxxflags" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
CXX="$CXX $CXX_WARNINGS"
CXX="$CXX$CFLAGS_WARNINGS"
CXXFLAGS_NDEBUG=`echo "$CXXFLAGS" | sed 's/-g//'`
AC_SUBST(CXXFLAGS_NDEBUG)
KERNEL_CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//'`
AC_SUBST(KERNEL_CXXFLAGS)
])
......@@ -157,7 +158,7 @@ AC_DEFUN([CLICK_PROG_BUILD_CXX], [
dnl This doesn't really work, but it's close.
ac_base_build_cxx="$CXX"
test -z "$ac_user_build_cxx" -a -n "$ac_compile_with_warnings" && \
BUILD_CXX="$BUILD_CXX $CXX_WARNINGS"
BUILD_CXX="$BUILD_CXX$WARNING_CFLAGS"
])
......@@ -171,7 +172,7 @@ AC_DEFUN([CLICK_PROG_KERNEL_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 $CXX_WARNINGS"
KERNEL_CC="$ac_base_cc -w $WARNING_CFLAGS"
AC_SUBST(KERNEL_CC)
])
......@@ -186,7 +187,7 @@ AC_DEFUN([CLICK_PROG_KERNEL_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 $CXX_WARNINGS -fno-exceptions -fno-rtti -fpermissive"
KERNEL_CXX="$ac_base_cxx -w $WARNING_CFLAGS -fno-exceptions -fno-rtti -fpermissive"
AC_SUBST(KERNEL_CXX)
])
......
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