Skip to contentSkip to conversation

add -Wdeclaration-after-statement

PATCH New John Levon 1 participant 1 message Sep 22, 2003

Subsystems (4)
lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 1/1 add -Wdeclaration-after-statement

Not that many people are going to be using GCC 3.4 currently, but it might help a bit to prevent compilation bugs like that just witnessed in procfs.

regards,
john

arch/arm/Makefile +0 -1
diff -Naurp -X dontdiff linux-cvs/arch/arm/Makefile linux-fixes/arch/arm/Makefile
@@ -27,7 +27,6 @@ LD		+= -EB
 AFLAGS		+= -mbig-endian
 endif
 
-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
 comma = ,
 
 # This selects which instruction set is used.
arch/i386/Makefile +0 -2
diff -Naurp -X dontdiff linux-cvs/arch/i386/Makefile linux-fixes/arch/i386/Makefile
@@ -21,8 +21,6 @@ LDFLAGS_vmlinux :=
 
 CFLAGS += -pipe
 
-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
-
 # prevent gcc from keeping the stack 16 byte aligned
 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
 
arch/mips/Makefile +0 -1
diff -Naurp -X dontdiff linux-cvs/arch/mips/Makefile linux-fixes/arch/mips/Makefile
@@ -58,7 +58,6 @@ MODFLAGS			+= -mlong-calls
 cflags-$(CONFIG_KGDB)		+= -g
 cflags-$(CONFIG_SB1XXX_CORELIS)	+= -mno-sched-prolog -fno-omit-frame-pointer
 
-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
 check_warning = $(shell if $(CC) $(1) -c -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
 
 #
arch/s390/Makefile +0 -2
diff -Naurp -X dontdiff linux-cvs/arch/s390/Makefile linux-fixes/arch/s390/Makefile
@@ -13,8 +13,6 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
-check_gcc = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
-
 ifdef CONFIG_ARCH_S390_31
 LDFLAGS		:= -m elf_s390
 CFLAGS		+= -m31
Makefile +6 -1
diff -Naurp -X dontdiff linux-cvs/Makefile linux-fixes/Makefile
@@ -183,7 +183,9 @@ ifneq ($(findstring s,$(MAKEFLAGS)),)
   quiet=silent_
 endif
 
-export quiet Q KBUILD_VERBOSE
+check_gcc = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
+export quiet Q KBUILD_VERBOSE check_gcc
 
 # Paths to obj / src tree
 
@@ -378,6 +380,9 @@ ifdef CONFIG_DEBUG_INFO
 CFLAGS		+= -g
 endif
 
+# warn about C99 declaration after statement
+CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,)
+
 #
 # INSTALL_PATH specifies where to place the updated kernel and system map
 # images.  Uncomment if you want to place them anywhere other than root.