diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2025-01-13 18:00:45 +0300 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2025-01-18 03:11:46 +0300 |
commit | c2f1846ba87ead7ac544be624c13249d6b90eca0 (patch) | |
tree | c36134b82b39c5312101a7cf665aaa4f6088e4e5 /scripts/gdb/linux/utils.py | |
parent | a95298656c434357b38bec242412c65dcf6114d1 (diff) | |
download | linux-c2f1846ba87ead7ac544be624c13249d6b90eca0.tar.xz |
genksyms: restrict direct-abstract-declarator to take one parameter-type-list
While there is no more grammatical ambiguity in genksyms, the parser
logic is still inaccurate.
For example, genksyms accepts the following invalid C code:
void my_func(int ()(int));
This should result in a syntax error because () cannot be reduced to
<direct-abstract-declarator>.
( <abstract-declarator> ) can be reduced, but <abstract-declarator>
must not be empty in the following grammar from K&R [1]:
<direct-abstract-declarator> ::= ( <abstract-declarator> )
| {<direct-abstract-declarator>}? [ {<constant-expression>}? ]
| {<direct-abstract-declarator>}? ( {<parameter-type-list>}? )
Furthermore, genksyms accepts the following weird code:
void my_func(int (*callback)(int)(int)(int));
The parser allows <direct-abstract-declarator> to recursively absorb
multiple ( {<parameter-type-list>}? ), but this behavior is incorrect.
In the example above, (*callback) should be followed by at most one
(int).
[1]: https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20syntax%20of%20C%20in%20Backus-Naur%20form.htm
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Schier <n.schier@avm.de>
Diffstat (limited to 'scripts/gdb/linux/utils.py')
0 files changed, 0 insertions, 0 deletions