Skip to content

Commit a8b7d06

Browse files
committed
genksyms: fix syntax error for attribute before nested_declarator
A longstanding issue with genksyms is that it has hidden syntax errors. When a syntax error occurs, yyerror() is called. However, error_with_pos() is a no-op unless the -w option is provided. You can observe syntax errors by manually passing the -w option. For example, with CONFIG_MODVERSIONS=y on v6.13-rc1: $ make -s KCFLAGS=-D__GENKSYMS__ drivers/acpi/prmt.i $ cat drivers/acpi/prmt.i | scripts/genksyms/genksyms -w [ snip ] drivers/acpi/prmt.c:56: syntax error The syntax error occurs in the following code in drivers/acpi/prmt.c: struct prm_handler_info { [ snip ] efi_status_t (__efiapi *handler_addr)(u64, void *); [ snip ] }; The issue arises from __efiapi, which is defined as either __attribute__((ms_abi)) or __attribute__((regparm(0))). This commit allows nested_declarator to be prefixed with attributes. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Nicolas Schier <[email protected]>
1 parent 2966b66 commit a8b7d06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/genksyms/parse.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ direct_nested_declarator1:
345345
{ $$ = $4; }
346346
| direct_nested_declarator1 BRACKET_PHRASE
347347
{ $$ = $2; }
348-
| '(' nested_declarator ')'
349-
{ $$ = $3; }
348+
| '(' attribute_opt nested_declarator ')'
349+
{ $$ = $4; }
350350
| '(' error ')'
351351
{ $$ = $3; }
352352
;

0 commit comments

Comments
 (0)