From 535231e8252eea14abf4f14d28f6c1c03f5e0f02 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 23 Sep 2003 09:43:09 -0700 Subject: [PATCH] [PATCH] add -Wdeclaration-after-statement From: John Levon 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. (And it consolidates the check_gcc implementation nicely) --- Makefile | 7 ++++++- arch/arm/Makefile | 1 - arch/i386/Makefile | 2 -- arch/mips/Makefile | 1 - arch/s390/Makefile | 2 -- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b44445c1bd9b0..a32ebe122aefa 100644 --- a/Makefile +++ b/Makefile @@ -231,7 +231,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 # Look for make include files relative to root of kernel src MAKEFLAGS += --include-dir=$(srctree) @@ -430,6 +432,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. diff --git a/arch/arm/Makefile b/arch/arm/Makefile index d28aa17756a67..7398eec4aa869 100644 --- a/arch/arm/Makefile +++ b/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. diff --git a/arch/i386/Makefile b/arch/i386/Makefile index c49b4749cf950..966a565cdba37 100644 --- a/arch/i386/Makefile +++ b/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,) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 54211fbc5b96b..c98bac9000159 100644 --- a/arch/mips/Makefile +++ b/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) # diff --git a/arch/s390/Makefile b/arch/s390/Makefile index 2fa3cdd82bc45..64e6253e9cdf3 100644 --- a/arch/s390/Makefile +++ b/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 -- 2.53.0