Commit 535231e8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] add -Wdeclaration-after-statement

From: John Levon <levon@movementarian.org>

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)
parent 6921bb18
...@@ -231,7 +231,9 @@ ifneq ($(findstring s,$(MAKEFLAGS)),) ...@@ -231,7 +231,9 @@ ifneq ($(findstring s,$(MAKEFLAGS)),)
quiet=silent_ quiet=silent_
endif 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 # Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree) MAKEFLAGS += --include-dir=$(srctree)
...@@ -430,6 +432,9 @@ ifdef CONFIG_DEBUG_INFO ...@@ -430,6 +432,9 @@ ifdef CONFIG_DEBUG_INFO
CFLAGS += -g CFLAGS += -g
endif 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 # INSTALL_PATH specifies where to place the updated kernel and system map
# images. Uncomment if you want to place them anywhere other than root. # images. Uncomment if you want to place them anywhere other than root.
......
...@@ -27,7 +27,6 @@ LD += -EB ...@@ -27,7 +27,6 @@ LD += -EB
AFLAGS += -mbig-endian AFLAGS += -mbig-endian
endif 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 = , comma = ,
# This selects which instruction set is used. # This selects which instruction set is used.
......
...@@ -21,8 +21,6 @@ LDFLAGS_vmlinux := ...@@ -21,8 +21,6 @@ LDFLAGS_vmlinux :=
CFLAGS += -pipe 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 # prevent gcc from keeping the stack 16 byte aligned
CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
......
...@@ -58,7 +58,6 @@ MODFLAGS += -mlong-calls ...@@ -58,7 +58,6 @@ MODFLAGS += -mlong-calls
cflags-$(CONFIG_KGDB) += -g cflags-$(CONFIG_KGDB) += -g
cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer 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) check_warning = $(shell if $(CC) $(1) -c -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
# #
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
# Copyright (C) 1994 by Linus Torvalds # 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 ifdef CONFIG_ARCH_S390_31
LDFLAGS := -m elf_s390 LDFLAGS := -m elf_s390
CFLAGS += -m31 CFLAGS += -m31
......
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