summaryrefslogtreecommitdiff
path: root/scripts/genksyms/lex.l
AgeCommit message (Collapse)Author
2021-02-16genksyms: remove useless case DOTSMasahiro Yamada
This switch statement does not list out all the cases. Since the 'default' covers all the rest, the 'DOTS' case is unneeded. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-02-16genksyms: remove dead code for ST_TABLE_*Masahiro Yamada
No one sets lexstate to ST_TABLE_*. It is is very old code, and I do not know what was the plan at that time. Let's remove the dead code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-02-16genksyms: make source_file a local variable in lexerMasahiro Yamada
This is only used in yylex() in lex.l Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-21genksyms: Ignore module scoped _Static_assert()Marco Elver
The C11 _Static_assert() keyword may be used at module scope, and we need to teach genksyms about it to not abort with an error. We currently have a growing number of static_assert() (but also direct usage of _Static_assert()) users at module scope: git grep -E '^_Static_assert\(|^static_assert\(' | grep -v '^tools' | wc -l 135 More recently, when enabling CONFIG_MODVERSIONS with CONFIG_KCSAN, we observe a number of warnings: WARNING: modpost: EXPORT symbol "<..all kcsan symbols..>" [vmlinux] [...] When running a preprocessed source through 'genksyms -w' a number of syntax errors point at usage of static_assert()s. In the case of kernel/kcsan/encoding.h, new static_assert()s had been introduced which used expressions that appear to cause genksyms to not even be able to recover from the syntax error gracefully (as it appears was the case previously). Therefore, make genksyms ignore all _Static_assert() and the contained expression. With the fix, usage of _Static_assert() no longer cause "syntax error" all over the kernel, and the above modpost warnings for KCSAN are gone, too. Signed-off-by: Marco Elver <elver@google.com> Acked-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2019-09-14genksyms: convert to SPDX License Identifier for lex.l and parse.yMasahiro Yamada
I used the C comment style (/* ... */) for the flex and bison files as in Kconfig (scripts/kconfig/{lexer.l,parser.y}) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-09-08genksyms: fix gperf removal conversionLinus Torvalds
I had stupidly missed one special use of 'is_reserved_word()' when I converted the code to avoid gperf. I had changed that function to return the token ID directly rather than a pointer to the token descriptor structure, but that meant that the test for "is this a reserved word" changed from checking the return value against NULL, to checking that it wasn't negative. And while I had converted the main token parser over, I missed the special case of the typeof phrase handling. And since our dependency chain for genksyms does not include the genksyms program itself changing, my kernel rebuild didn't show the problem. Fixes: bb3290d91695 ("Remove gperf usage from toolchain") Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-08-19Remove gperf usage from toolchainLinus Torvalds
It turns out that gperf-3.1 changed types in the generated code in ways that aren't even trivially detectable without having to generate a test-file. It's just not worth using tools and libraries from clowns that don't understand or care about compatibility. So get rid of gperf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-25kbuild: genksyms fix for typeof handlingNicholas Piggin
The tokenizer misses counting an open-parenthesis when parsing a non-trivial typeof beginning with an open-parenthesis. This function in include/linux/ceph/libceph.h static type *lookup_##name(struct rb_root *root, typeof(((type *)0)->keyfld) key) When instantiated in net/ceph/mon_client.c, causes subsequent symbols including an EXPORT_SYMBOL in that file to be lost. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2014-04-03genksyms: fix typeof() handlingJan Beulich
Recent increased use of typeof() throughout the tree resulted in a number of symbols (25 in a typical distro config of ours) not getting a proper CRC calculated for them anymore, due to the parser in genksyms not coping with several of these uses (interestingly in the majority of [if not all] cases the problem is due to the use of typeof() in code preceding a certain export, not in the declaration/definition of the exported function/object itself; I wasn't able to find a way to address this more general parser shortcoming). The use of parameter_declaration is a little more relaxed than would be ideal (permitting not just a bare type specification, but also one with identifier), but since the same code is being passed through an actual compiler, there's no apparent risk of allowing through any broken code. Otoh using parameter_declaration instead of the ad hoc "decl_specifier_seq '*'" / "decl_specifier_seq" pair allows all types to be handled rather than just plain ones and pointers to plain ones. Signed-off-by: Jan Beulich <jbeulich@suse.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-11genksyms: Do not expand internal typesMichal Marek
Consider structures, unions and enums defined in the source file as internal and do not expand them. This way, changes to e.g. struct serial_private in drivers/tty/serial/8250_pci.c will not affect the checksum of the pciserial_* exports.
2011-06-09genksyms: migrate parser to implicit rulesArnaud Lacombe
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-03-17genksyms: Track changes to enum constantsMichal Marek
Enum constants can be used as array sizes; if the enum itself does not appear in the symbol expansion, a change in the enum constant will go unnoticed. Example patch that changes the ABI but does not change the checksum with current genksyms: | enum e { | E1, | E2, |+ E3, | E_MAX | }; | | struct s { | int a[E_MAX]; | } | | int f(struct s *s) { ... } | EXPORT_SYMBOL(f) Therefore, remember the value of each enum constant and expand each occurence to <constant> <value>. The value is not actually computed, but instead an expression in the form (last explicitly assigned value) + N is used. This avoids having to parse and semantically understand whole of C. Note: The changes won't take effect until the lexer and parser are rebuilt by the next patch. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: simplify usage of find_symbol()Michal Marek
Allow searching for symbols of an exact type. The lexer does this and a subsequent patch will add one more usage. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Simplify lexerMichal Marek
The V2_TOKENS state is active all the time. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-30kbuild: scripts/genksyms/lex.l: add %option noinputAdrian Bunk
gcc 4.3 correctly determines that input() is unused and gives the following warning: <-- snip --> ... HOSTCC scripts/genksyms/lex.o scripts/genksyms/lex.c:1487: warning: ‘input’ defined but not used ... <-- snip --> Fix it by adding %option noinput to scripts/genksyms/lex.l and regeneration of scripts/genksyms/lex.c_shipped. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-24kbuild: replace abort() with exit(1)Sam Ravnborg
We have had no use of the coredump file for a long time. So just exit(1) and avoid coredumping. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!