Skip to content

Commit eddecbb

Browse files
committed
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: kbuild: Make DEBUG_SECTION_MISMATCH selectable, but not on by default genksyms: Regenerate lexer and parser genksyms: Track changes to enum constants genksyms: simplify usage of find_symbol() genksyms: Add helpers for building string lists genksyms: Simplify printing of symbol types genksyms: Simplify lexer genksyms: Do not paste the bison header file to lex.c modpost: fix trailing comma KBuild: silence "'scripts/unifdef' is up to date." kbuild: Add extra gcc checks kbuild: reenable section mismatch analysis unifdef: update to upstream version 2.5
2 parents 0bf8c86 + f2c23f6 commit eddecbb

15 files changed

+1237
-941
lines changed

Documentation/kbuild/kbuild.txt

+5
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,8 @@ to be included in the databases, separated by blank space. E.g.:
196196
To get all available archs you can also specify all. E.g.:
197197

198198
$ make ALLSOURCE_ARCHS=all tags
199+
200+
KBUILD_ENABLE_EXTRA_GCC_CHECKS
201+
--------------------------------------------------
202+
If enabled over the make command line with "W=1", it turns on additional
203+
gcc -W... options for more extensive build-time checking.

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ ifeq ("$(origin O)", "command line")
102102
KBUILD_OUTPUT := $(O)
103103
endif
104104

105+
ifeq ("$(origin W)", "command line")
106+
export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
107+
endif
108+
105109
# That's our default target when none is given on the command line
106110
PHONY := _all
107111
_all:
@@ -1018,7 +1022,7 @@ hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
10181022

10191023
PHONY += __headers
10201024
__headers: include/linux/version.h scripts_basic FORCE
1021-
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
1025+
$(Q)$(MAKE) $(build)=scripts build_unifdef
10221026

10231027
PHONY += headers_install_all
10241028
headers_install_all:
@@ -1263,6 +1267,7 @@ help:
12631267
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
12641268
@echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
12651269
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1270+
@echo ' make W=1 [targets] Enable extra gcc checks'
12661271
@echo ''
12671272
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
12681273
@echo 'For further info see the ./README file'

lib/Kconfig.debug

-5
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ config HEADERS_CHECK
102102

103103
config DEBUG_SECTION_MISMATCH
104104
bool "Enable full Section mismatch analysis"
105-
depends on UNDEFINED || (BLACKFIN)
106-
default y
107-
# This option is on purpose disabled for now.
108-
# It will be enabled when we are down to a reasonable number
109-
# of section mismatch warnings (< 10 for an allyesconfig build)
110105
help
111106
The section mismatch analysis checks if there are illegal
112107
references from one section to another section.

scripts/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ always := $(hostprogs-y) $(hostprogs-m)
1818
# The following hostprogs-y programs are only build on demand
1919
hostprogs-y += unifdef
2020

21+
# This target is used internally to avoid "is up to date" messages
22+
PHONY += build_unifdef
23+
build_unifdef: scripts/unifdef FORCE
24+
@:
25+
2126
subdir-$(CONFIG_MODVERSIONS) += genksyms
2227
subdir-y += mod
2328
subdir-$(CONFIG_SECURITY_SELINUX) += selinux

scripts/Makefile.build

+34-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,40 @@ ifeq ($(KBUILD_NOPEDANTIC),)
4949
$(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
5050
endif
5151
endif
52+
53+
#
54+
# make W=1 settings
55+
#
56+
# $(call cc-option... ) handles gcc -W.. options which
57+
# are not supported by all versions of the compiler
58+
ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
59+
KBUILD_EXTRA_WARNINGS := -Wextra
60+
KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
61+
KBUILD_EXTRA_WARNINGS += -Waggregate-return
62+
KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
63+
KBUILD_EXTRA_WARNINGS += -Wcast-qual
64+
KBUILD_EXTRA_WARNINGS += -Wcast-align
65+
KBUILD_EXTRA_WARNINGS += -Wconversion
66+
KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
67+
KBUILD_EXTRA_WARNINGS += -Wlogical-op
68+
KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
69+
KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
70+
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
71+
KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
72+
KBUILD_EXTRA_WARNINGS += -Wnested-externs
73+
KBUILD_EXTRA_WARNINGS += -Wold-style-definition
74+
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
75+
KBUILD_EXTRA_WARNINGS += -Wpacked
76+
KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
77+
KBUILD_EXTRA_WARNINGS += -Wpadded
78+
KBUILD_EXTRA_WARNINGS += -Wpointer-arith
79+
KBUILD_EXTRA_WARNINGS += -Wredundant-decls
80+
KBUILD_EXTRA_WARNINGS += -Wshadow
81+
KBUILD_EXTRA_WARNINGS += -Wswitch-default
82+
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
83+
KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
84+
endif
85+
5286
include scripts/Makefile.lib
5387

5488
ifdef host-progs
@@ -403,7 +437,6 @@ ifneq ($(cmd_files),)
403437
include $(cmd_files)
404438
endif
405439

406-
407440
# Declare the contents of the .PHONY variable as phony. We keep that
408441
# information in a variable se we can use it in if_changed and friends.
409442

scripts/genksyms/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ $(obj)/keywords.c: $(obj)/keywords.gperf FORCE
2828
# flex
2929

3030
quiet_cmd_lex.c = FLEX $@
31-
cmd_lex.c = flex -o$@ -d $< $(obj)/parse.h
31+
cmd_lex.c = flex -o$@ -d $<
3232

33-
$(obj)/lex.c: $(obj)/lex.l $(obj)/parse.h $(obj)/keywords.c FORCE
33+
$(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE
3434
$(call if_changed,lex.c)
3535
cp $@ $@_shipped
3636

0 commit comments

Comments
 (0)