Only pass -P to cpp when generating ld scripts
When building sandbox with ccache, one would hit warnings such as: warning: 'struct mmsghdr' declared inside parameter list on random files; a way to reproduce this issue is to build a simple file doing just: #include <sys/socket.h> int main(void) { return 0; } gcc -Wall -P -c -o foo foo.c But actually the -P flag is only useful when generating non-C files, such as linker scripts in the case of barebox. Removing the -P flag from all the gcc invocations, except when generating .lds files makes the warning go away. It turns out that this is what linux/scripts/Makefile.build also does nowadays. Signed-off-by: Loïc Minier <loic.minier@linaro.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2b5d8792ac
commit
4e26fba680
2
Makefile
2
Makefile
|
@ -825,7 +825,7 @@ prepare prepare-all: prepare0
|
|||
# Leave this as default for preprocessing barebox.lds.S, which is now
|
||||
# done in arch/$(ARCH)/kernel/Makefile
|
||||
|
||||
export CPPFLAGS_barebox.lds += -P -C -U$(ARCH)
|
||||
export CPPFLAGS_barebox.lds += -C -U$(ARCH)
|
||||
|
||||
# FIXME: The asm symlink changes when $(ARCH) changes. That's
|
||||
# hard to detect, but I suppose "make mrproper" is a good idea
|
||||
|
|
|
@ -121,7 +121,7 @@ endif
|
|||
|
||||
TEXT_BASE = $(CONFIG_TEXT_BASE)
|
||||
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
|
||||
|
||||
ifndef CONFIG_MODULES
|
||||
# Add cleanup flags
|
||||
|
|
|
@ -7,7 +7,7 @@ cpu-$(CONFIG_BF561) := bf561
|
|||
|
||||
TEXT_BASE = $(CONFIG_TEXT_BASE)
|
||||
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
|
||||
CFLAGS += -D__blackfin__
|
||||
# -Ttext $(TEXT_BASE)
|
||||
KALLSYMS += --symbol-prefix=_
|
||||
|
|
|
@ -14,7 +14,7 @@ cpu-$(CONFIG_ARCH_MPC5200) := mpc5xxx
|
|||
|
||||
TEXT_BASE = $(CONFIG_TEXT_BASE)
|
||||
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
|
||||
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
|
||||
|
||||
# Add cleanup flags
|
||||
ifndef CONFIG_MODULES
|
||||
|
|
|
@ -10,7 +10,6 @@ lds-y := $(BOARD)/barebox.lds
|
|||
|
||||
TEXT_BASE = $(CONFIG_TEXT_BASE)
|
||||
|
||||
CPPFLAGS += -P
|
||||
CFLAGS += -Dmalloc=barebox_malloc \
|
||||
-Dfree=barebox_free -Drealloc=barebox_realloc \
|
||||
-Dread=barebox_read -Dwrite=barebox_write \
|
||||
|
|
|
@ -8,7 +8,6 @@ else
|
|||
CPPFLAGS = $(patsubst %,-I$(srctree)/%include,$(machdirs))
|
||||
endif
|
||||
|
||||
CPPFLAGS += -P
|
||||
CFLAGS := -Wall
|
||||
NOSTDINC_FLAGS :=
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ machine-y := i386
|
|||
|
||||
TEXT_BASE = $(CONFIG_TEXT_BASE)
|
||||
|
||||
CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE) -P
|
||||
CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE)
|
||||
LDFLAGS += -m elf_i386
|
||||
|
||||
ifndef CONFIG_MODULES
|
||||
|
|
|
@ -244,7 +244,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
|
|||
# Linker scripts preprocessor (.lds.S -> .lds)
|
||||
# ---------------------------------------------------------------------------
|
||||
quiet_cmd_cpp_lds_S = LDS $@
|
||||
cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
|
||||
cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -D__ASSEMBLY__ -o $@ $<
|
||||
|
||||
%.lds: %.lds.S FORCE
|
||||
$(call if_changed_dep,cpp_lds_S)
|
||||
|
|
Loading…
Reference in New Issue