diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-21 18:55:26 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-21 18:55:26 -0400 |
| commit | eddecbb601c9ea3fab7e67d7892010fc9426d1e6 (patch) | |
| tree | 4bfa4740ae554e5c5a8468e74b39531a6153ce9f /scripts | |
| parent | 0bf8c869701039b12c3520cb1bb1689595ab108b (diff) | |
| parent | f2c23f65f63fe0dd83fc94efdfae0364c74458b8 (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/Makefile | 5 | ||||
| -rw-r--r-- | scripts/Makefile.build | 35 | ||||
| -rw-r--r-- | scripts/genksyms/Makefile | 4 | ||||
| -rw-r--r-- | scripts/genksyms/genksyms.c | 192 | ||||
| -rw-r--r-- | scripts/genksyms/genksyms.h | 7 | ||||
| -rw-r--r-- | scripts/genksyms/lex.c_shipped | 427 | ||||
| -rw-r--r-- | scripts/genksyms/lex.l | 44 | ||||
| -rw-r--r-- | scripts/genksyms/parse.c_shipped | 1071 | ||||
| -rw-r--r-- | scripts/genksyms/parse.h_shipped | 72 | ||||
| -rw-r--r-- | scripts/genksyms/parse.y | 34 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 23 | ||||
| -rw-r--r-- | scripts/unifdef.c | 247 |
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 |
| 19 | hostprogs-y += unifdef | 19 | hostprogs-y += unifdef |
| 20 | 20 | ||
| 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 | |||
| 21 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 26 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
| 22 | subdir-y += mod | 27 | subdir-y += mod |
| 23 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux | 28 | subdir-$(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 |
| 51 | endif | 51 | 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 | |||
| 52 | include scripts/Makefile.lib | 86 | include scripts/Makefile.lib |
| 53 | 87 | ||
| 54 | ifdef host-progs | 88 | ifdef host-progs |
| @@ -403,7 +437,6 @@ ifneq ($(cmd_files),) | |||
| 403 | include $(cmd_files) | 437 | include $(cmd_files) |
| 404 | endif | 438 | endif |
| 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 | ||
| 30 | quiet_cmd_lex.c = FLEX $@ | 30 | quiet_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; | |||
| 53 | static struct symbol *expansion_trail; | 53 | static struct symbol *expansion_trail; |
| 54 | static struct symbol *visited_symbols; | 54 | static struct symbol *visited_symbols; |
| 55 | 55 | ||
| 56 | static const char *const symbol_type_name[] = { | 56 | static 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 | ||
| 60 | static int equal_list(struct string_list *a, struct string_list *b); | 68 | static int equal_list(struct string_list *a, struct string_list *b); |
| 61 | static void print_list(FILE * f, struct string_list *list); | 69 | static void print_list(FILE * f, struct string_list *list); |
| 70 | static struct string_list *concat_list(struct string_list *start, ...); | ||
| 71 | static struct string_list *mk_node(const char *string); | ||
| 62 | static void print_location(void); | 72 | static void print_location(void); |
| 63 | static void print_type_name(enum symbol_type type, const char *name); | 73 | static 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 | ||
| 141 | static enum symbol_type map_to_ns(enum symbol_type t) | 151 | static 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 | ||
| 150 | struct symbol *find_symbol(const char *name, enum symbol_type ns) | 166 | struct 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("+"), | ||
| < | |||
