aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-21 18:55:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-21 18:55:26 -0400
commiteddecbb601c9ea3fab7e67d7892010fc9426d1e6 (patch)
tree4bfa4740ae554e5c5a8468e74b39531a6153ce9f /scripts
parent0bf8c869701039b12c3520cb1bb1689595ab108b (diff)
parentf2c23f65f63fe0dd83fc94efdfae0364c74458b8 (diff)
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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile5
-rw-r--r--scripts/Makefile.build35
-rw-r--r--scripts/genksyms/Makefile4
-rw-r--r--scripts/genksyms/genksyms.c192
-rw-r--r--scripts/genksyms/genksyms.h7
-rw-r--r--scripts/genksyms/lex.c_shipped427
-rw-r--r--scripts/genksyms/lex.l44
-rw-r--r--scripts/genksyms/parse.c_shipped1071
-rw-r--r--scripts/genksyms/parse.h_shipped72
-rw-r--r--scripts/genksyms/parse.y34
-rw-r--r--scripts/mod/modpost.c23
-rw-r--r--scripts/unifdef.c247
12 files changed, 1226 insertions, 935 deletions
diff --git a/scripts/Makefile b/scripts/Makefile
index 2e088109fbd..fcea26168bc 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -18,6 +18,11 @@ always := $(hostprogs-y) $(hostprogs-m)
18# The following hostprogs-y programs are only build on demand 18# The following hostprogs-y programs are only build on demand
19hostprogs-y += unifdef 19hostprogs-y += unifdef
20 20
21# This target is used internally to avoid "is up to date" messages
22PHONY += build_unifdef
23build_unifdef: scripts/unifdef FORCE
24 @:
25
21subdir-$(CONFIG_MODVERSIONS) += genksyms 26subdir-$(CONFIG_MODVERSIONS) += genksyms
22subdir-y += mod 27subdir-y += mod
23subdir-$(CONFIG_SECURITY_SELINUX) += selinux 28subdir-$(CONFIG_SECURITY_SELINUX) += selinux
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 4eb99ab3405..d5f925abe4d 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -49,6 +49,40 @@ ifeq ($(KBUILD_NOPEDANTIC),)
49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) 49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
50 endif 50 endif
51endif 51endif
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
58ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
59KBUILD_EXTRA_WARNINGS := -Wextra
60KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
61KBUILD_EXTRA_WARNINGS += -Waggregate-return
62KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
63KBUILD_EXTRA_WARNINGS += -Wcast-qual
64KBUILD_EXTRA_WARNINGS += -Wcast-align
65KBUILD_EXTRA_WARNINGS += -Wconversion
66KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
67KBUILD_EXTRA_WARNINGS += -Wlogical-op
68KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
69KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
70KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
71KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
72KBUILD_EXTRA_WARNINGS += -Wnested-externs
73KBUILD_EXTRA_WARNINGS += -Wold-style-definition
74KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
75KBUILD_EXTRA_WARNINGS += -Wpacked
76KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
77KBUILD_EXTRA_WARNINGS += -Wpadded
78KBUILD_EXTRA_WARNINGS += -Wpointer-arith
79KBUILD_EXTRA_WARNINGS += -Wredundant-decls
80KBUILD_EXTRA_WARNINGS += -Wshadow
81KBUILD_EXTRA_WARNINGS += -Wswitch-default
82KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
83KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
84endif
85
52include scripts/Makefile.lib 86include scripts/Makefile.lib
53 87
54ifdef host-progs 88ifdef host-progs
@@ -403,7 +437,6 @@ ifneq ($(cmd_files),)
403 include $(cmd_files) 437 include $(cmd_files)
404endif 438endif
405 439
406
407# Declare the contents of the .PHONY variable as phony. We keep that 440# Declare the contents of the .PHONY variable as phony. We keep that
408# information in a variable se we can use it in if_changed and friends. 441# information in a variable se we can use it in if_changed and friends.
409 442
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index e420fe44001..13d03cf05d9 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -28,9 +28,9 @@ $(obj)/keywords.c: $(obj)/keywords.gperf FORCE
28# flex 28# flex
29 29
30quiet_cmd_lex.c = FLEX $@ 30quiet_cmd_lex.c = FLEX $@
31 cmd_lex.c = flex -o$@ -d $< $(obj)/parse.h 31 cmd_lex.c = flex -o$@ -d $<
32 32
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
34 $(call if_changed,lex.c) 34 $(call if_changed,lex.c)
35 cp $@ $@_shipped 35 cp $@ $@_shipped
36 36
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index f99115ebe92..f9e75531ea0 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -53,12 +53,22 @@ static int nsyms;
53static struct symbol *expansion_trail; 53static struct symbol *expansion_trail;
54static struct symbol *visited_symbols; 54static struct symbol *visited_symbols;
55 55
56static const char *const symbol_type_name[] = { 56static const struct {
57 "normal", "typedef", "enum", "struct", "union" 57 int n;
58 const char *name;
59} symbol_types[] = {
60 [SYM_NORMAL] = { 0, NULL},
61 [SYM_TYPEDEF] = {'t', "typedef"},
62 [SYM_ENUM] = {'e', "enum"},
63 [SYM_STRUCT] = {'s', "struct"},
64 [SYM_UNION] = {'u', "union"},
65 [SYM_ENUM_CONST] = {'E', "enum constant"},
58}; 66};
59 67
60static int equal_list(struct string_list *a, struct string_list *b); 68static int equal_list(struct string_list *a, struct string_list *b);
61static void print_list(FILE * f, struct string_list *list); 69static void print_list(FILE * f, struct string_list *list);
70static struct string_list *concat_list(struct string_list *start, ...);
71static struct string_list *mk_node(const char *string);
62static void print_location(void); 72static void print_location(void);
63static void print_type_name(enum symbol_type type, const char *name); 73static void print_type_name(enum symbol_type type, const char *name);
64 74
@@ -140,14 +150,20 @@ static unsigned long crc32(const char *s)
140 150
141static enum symbol_type map_to_ns(enum symbol_type t) 151static enum symbol_type map_to_ns(enum symbol_type t)
142{ 152{
143 if (t == SYM_TYPEDEF) 153 switch (t) {
144 t = SYM_NORMAL; 154 case SYM_ENUM_CONST:
145 else if (t == SYM_UNION) 155 case SYM_NORMAL:
146 t = SYM_STRUCT; 156 case SYM_TYPEDEF:
157 return SYM_NORMAL;
158 case SYM_ENUM:
159 case SYM_STRUCT:
160 case SYM_UNION:
161 return SYM_STRUCT;
162 }
147 return t; 163 return t;
148} 164}
149 165
150struct symbol *find_symbol(const char *name, enum symbol_type ns) 166struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact)
151{ 167{
152 unsigned long h = crc32(name) % HASH_BUCKETS; 168 unsigned long h = crc32(name) % HASH_BUCKETS;
153 struct symbol *sym; 169 struct symbol *sym;
@@ -158,6 +174,8 @@ struct symbol *find_symbol(const char *name, enum symbol_type ns)
158 sym->is_declared) 174 sym->is_declared)
159 break; 175 break;
160 176
177 if (exact && sym && sym->type != ns)
178 return NULL;
161 return sym; 179 return sym;
162} 180}
163 181
@@ -180,10 +198,47 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
180 struct string_list *defn, int is_extern, 198 struct string_list *defn, int is_extern,
181 int is_reference) 199 int is_reference)
182{ 200{
183 unsigned long h = crc32(name) % HASH_BUCKETS; 201 unsigned long h;
184 struct symbol *sym; 202 struct symbol *sym;
185 enum symbol_status status = STATUS_UNCHANGED; 203 enum symbol_status status = STATUS_UNCHANGED;
204 /* The parser adds symbols in the order their declaration completes,
205 * so it is safe to store the value of the previous enum constant in
206 * a static variable.
207 */
208 static int enum_counter;
209 static struct string_list *last_enum_expr;
210
211 if (type == SYM_ENUM_CONST) {
212 if (defn) {
213 free_list(last_enum_expr, NULL);
214 last_enum_expr = copy_list_range(defn, NULL);
215 enum_counter = 1;
216 } else {
217 struct string_list *expr;
218 char buf[20];
219
220 snprintf(buf, sizeof(buf), "%d", enum_counter++);
221 if (last_enum_expr) {
222 expr = copy_list_range(last_enum_expr, NULL);
223 defn = concat_list(mk_node("("),
224 expr,
225 mk_node(")"),
226 mk_node("+"),
<