<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/scripts/genksyms/parse.y, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>genksyms: Handle typeof_unqual keyword and __seg_{fs,gs} qualifiers</title>
<updated>2025-04-14T07:19:04+00:00</updated>
<author>
<name>Uros Bizjak</name>
<email>ubizjak@gmail.com</email>
</author>
<published>2025-04-13T22:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=1013f5636fd808569c1f4c40a58a4efc70713a28'/>
<id>1013f5636fd808569c1f4c40a58a4efc70713a28</id>
<content type='text'>
Handle typeof_unqual, __typeof_unqual and __typeof_unqual__ keywords
using TYPEOF_KEYW token in the same way as typeof keyword.

Also ignore x86 __seg_fs and __seg_gs named address space qualifiers
using X86_SEG_KEYW token in the same way as const, volatile or
restrict qualifiers.

Fixes: ac053946f5c4 ("compiler.h: introduce TYPEOF_UNQUAL() macro")
Closes: https://lore.kernel.org/lkml/81a25a60-de78-43fb-b56a-131151e1c035@molgen.mpg.de/
Reported-by: Paul Menzel &lt;pmenzel@molgen.mpg.de&gt;
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Link: https://lore.kernel.org/r/20250413220749.270704-1-ubizjak@gmail.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Handle typeof_unqual, __typeof_unqual and __typeof_unqual__ keywords
using TYPEOF_KEYW token in the same way as typeof keyword.

Also ignore x86 __seg_fs and __seg_gs named address space qualifiers
using X86_SEG_KEYW token in the same way as const, volatile or
restrict qualifiers.

Fixes: ac053946f5c4 ("compiler.h: introduce TYPEOF_UNQUAL() macro")
Closes: https://lore.kernel.org/lkml/81a25a60-de78-43fb-b56a-131151e1c035@molgen.mpg.de/
Reported-by: Paul Menzel &lt;pmenzel@molgen.mpg.de&gt;
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Link: https://lore.kernel.org/r/20250413220749.270704-1-ubizjak@gmail.com
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute before init-declarator</title>
<updated>2025-01-26T22:44:16+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a23d4c2f5b80a8dc5f1e40658abbe5983af1a0e9'/>
<id>a23d4c2f5b80a8dc5f1e40658abbe5983af1a0e9</id>
<content type='text'>
A longstanding issue with genksyms is that it has hidden syntax errors.

For example, genksyms fails to parse the following valid code:

    int x, __attribute__((__section__(".init.data")))y;

Here, only 'y' is annotated by the attribute, although I am not aware
of actual uses of this pattern in the kernel tree.

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.

    $ echo 'int x, __attribute__((__section__(".init.data")))y;' | scripts/genksyms/genksyms -w
    &lt;stdin&gt;:1: syntax error

This commit allows attributes to be placed between a comma and
init_declarator.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A longstanding issue with genksyms is that it has hidden syntax errors.

For example, genksyms fails to parse the following valid code:

    int x, __attribute__((__section__(".init.data")))y;

Here, only 'y' is annotated by the attribute, although I am not aware
of actual uses of this pattern in the kernel tree.

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.

    $ echo 'int x, __attribute__((__section__(".init.data")))y;' | scripts/genksyms/genksyms -w
    &lt;stdin&gt;:1: syntax error

This commit allows attributes to be placed between a comma and
init_declarator.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute after 'union'</title>
<updated>2025-01-26T22:43:21+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=6494bd2d05f927fc0395c2ea11461517a9e0bb80'/>
<id>6494bd2d05f927fc0395c2ea11461517a9e0bb80</id>
<content type='text'>
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__ fs/lockd/svc.i
    $ cat fs/lockd/svc.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./include/net/addrconf.h:35: syntax error

The syntax error occurs in the following code in include/net/addrconf.h:

    union __packed {
            [ snip ]
    };

The issue arises from __packed, which is defined as
__attribute__((__packed__)), immediately after the 'union' keyword.

This commit allows the 'union' keyword to be followed by attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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__ fs/lockd/svc.i
    $ cat fs/lockd/svc.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./include/net/addrconf.h:35: syntax error

The syntax error occurs in the following code in include/net/addrconf.h:

    union __packed {
            [ snip ]
    };

The issue arises from __packed, which is defined as
__attribute__((__packed__)), immediately after the 'union' keyword.

This commit allows the 'union' keyword to be followed by attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute after 'struct'</title>
<updated>2025-01-18T00:11:47+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=82db1c29103ebf581484c0b30805e68726121dcb'/>
<id>82db1c29103ebf581484c0b30805e68726121dcb</id>
<content type='text'>
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__ arch/x86/kernel/cpu/mshyperv.i
    $ cat arch/x86/kernel/cpu/mshyperv.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./arch/x86/include/asm/svm.h:122: syntax error

The syntax error occurs in the following code in arch/x86/include/asm/svm.h:

    struct __attribute__ ((__packed__)) vmcb_control_area {
            [ snip ]
    };

The issue arises from __attribute__ immediately after the 'struct'
keyword.

This commit allows the 'struct' keyword to be followed by attributes.

The lexer must be adjusted because dont_want_brace_phase should not be
decremented while processing attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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__ arch/x86/kernel/cpu/mshyperv.i
    $ cat arch/x86/kernel/cpu/mshyperv.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./arch/x86/include/asm/svm.h:122: syntax error

The syntax error occurs in the following code in arch/x86/include/asm/svm.h:

    struct __attribute__ ((__packed__)) vmcb_control_area {
            [ snip ]
    };

The issue arises from __attribute__ immediately after the 'struct'
keyword.

This commit allows the 'struct' keyword to be followed by attributes.

The lexer must be adjusted because dont_want_brace_phase should not be
decremented while processing attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute after abstact_declarator</title>
<updated>2025-01-18T00:11:47+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=2ac068cb0b366c61e7aebaccf0240eae8b2c1b43'/>
<id>2ac068cb0b366c61e7aebaccf0240eae8b2c1b43</id>
<content type='text'>
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__ kernel/module/main.i
    $ cat kernel/module/main.i | scripts/genksyms/genksyms -w
        [ snip ]
    kernel/module/main.c:97: syntax error

The syntax error occurs in the following code in kernel/module/main.c:

    static void __mod_update_bounds(enum mod_mem_type type __maybe_unused, void *base,
                                    unsigned int size, struct mod_tree_root *tree)
    {
            [ snip ]
    }

The issue arises from __maybe_unused, which is defined as
__attribute__((__unused__)).

This commit allows direct_abstract_declarator to be followed with
attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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__ kernel/module/main.i
    $ cat kernel/module/main.i | scripts/genksyms/genksyms -w
        [ snip ]
    kernel/module/main.c:97: syntax error

The syntax error occurs in the following code in kernel/module/main.c:

    static void __mod_update_bounds(enum mod_mem_type type __maybe_unused, void *base,
                                    unsigned int size, struct mod_tree_root *tree)
    {
            [ snip ]
    }

The issue arises from __maybe_unused, which is defined as
__attribute__((__unused__)).

This commit allows direct_abstract_declarator to be followed with
attributes.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute before nested_declarator</title>
<updated>2025-01-18T00:11:46+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a8b7d066f8626ec847d3e66aef1320968d1fe298'/>
<id>a8b7d066f8626ec847d3e66aef1320968d1fe298</id>
<content type='text'>
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 &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: fix syntax error for attribute before abstract_declarator</title>
<updated>2025-01-18T00:11:46+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=2966b66c94a2b0d897f8626b8f2c50a0fd4878a9'/>
<id>2966b66c94a2b0d897f8626b8f2c50a0fd4878a9</id>
<content type='text'>
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__ init/main.i
    $ cat init/main.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./include/linux/efi.h:1225: syntax error

The syntax error occurs in the following code in include/linux/efi.h:

    efi_status_t
    efi_call_acpi_prm_handler(efi_status_t (__efiapi *handler_addr)(u64, void *),
                              u64 param_buffer_addr, void *context);

The issue arises from __efiapi, which is defined as either
__attribute__((ms_abi)) or __attribute__((regparm(0))).

This commit allows abstract_declarator to be prefixed with attributes.

To avoid conflicts, I tweaked the rule for decl_specifier_seq. Due to
this change, a standalone attribute cannot become decl_specifier_seq.
Otherwise, I do not know how to resolve the conflicts.

The following code, which was previously accepted by genksyms, will now
result in a syntax error:

    void my_func(__attribute__((unused))x);

I do not think it is a big deal because GCC also fails to parse it.

    $ echo 'void my_func(__attribute__((unused))x);' | gcc -c -x c -
    &lt;stdin&gt;:1:37: error: unknown type name 'x'

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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__ init/main.i
    $ cat init/main.i | scripts/genksyms/genksyms -w
        [ snip ]
    ./include/linux/efi.h:1225: syntax error

The syntax error occurs in the following code in include/linux/efi.h:

    efi_status_t
    efi_call_acpi_prm_handler(efi_status_t (__efiapi *handler_addr)(u64, void *),
                              u64 param_buffer_addr, void *context);

The issue arises from __efiapi, which is defined as either
__attribute__((ms_abi)) or __attribute__((regparm(0))).

This commit allows abstract_declarator to be prefixed with attributes.

To avoid conflicts, I tweaked the rule for decl_specifier_seq. Due to
this change, a standalone attribute cannot become decl_specifier_seq.
Otherwise, I do not know how to resolve the conflicts.

The following code, which was previously accepted by genksyms, will now
result in a syntax error:

    void my_func(__attribute__((unused))x);

I do not think it is a big deal because GCC also fails to parse it.

    $ echo 'void my_func(__attribute__((unused))x);' | gcc -c -x c -
    &lt;stdin&gt;:1:37: error: unknown type name 'x'

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: decouple ATTRIBUTE_PHRASE from type-qualifier</title>
<updated>2025-01-18T00:11:46+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=ec28bfff83c49b65527f0055e313d9d7c8c04a31'/>
<id>ec28bfff83c49b65527f0055e313d9d7c8c04a31</id>
<content type='text'>
The __attribute__ keyword can appear in more contexts than 'const' or
'volatile'.

To avoid grammatical conflicts with future changes, ATTRIBUTE_PHRASE
should not be reduced into type_qualifier.

No functional changes are intended.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The __attribute__ keyword can appear in more contexts than 'const' or
'volatile'.

To avoid grammatical conflicts with future changes, ATTRIBUTE_PHRASE
should not be reduced into type_qualifier.

No functional changes are intended.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: record attributes consistently for init-declarator</title>
<updated>2025-01-18T00:11:46+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=ccc11a195c69b0c01ee140aecadfbdcdcdd03605'/>
<id>ccc11a195c69b0c01ee140aecadfbdcdcdd03605</id>
<content type='text'>
I believe the missing action here is a bug.

For rules with no explicit action, the following default is used:

    { $$ = $1; }

However, in this case, $1 is the value of attribute_opt itself. As a
result, the value of attribute_opt is always NULL.

The following test code demonstrates inconsistent behavior.

    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;

The attribute is recorded only when followed by an initializer.

This commit adds the correct action to propagate the value of the
ATTRIBUTE_PHRASE token.

With this change, the attribute in the example above is consistently
recorded for both 'x' and 'y'.

[Before]

    $ cat &lt;&lt;EOF | scripts/genksyms/genksyms -d
    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;
    EOF
    Defn for type0 x == &lt;int x &gt;
    Defn for type0 y == &lt;int y __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Hash table occupancy 2/4096 = 0.000488281

[After]

    $ cat &lt;&lt;EOF | scripts/genksyms/genksyms -d
    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;
    EOF
    Defn for type0 x == &lt;int x __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Defn for type0 y == &lt;int y __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Hash table occupancy 2/4096 = 0.000488281

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I believe the missing action here is a bug.

For rules with no explicit action, the following default is used:

    { $$ = $1; }

However, in this case, $1 is the value of attribute_opt itself. As a
result, the value of attribute_opt is always NULL.

The following test code demonstrates inconsistent behavior.

    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;

The attribute is recorded only when followed by an initializer.

This commit adds the correct action to propagate the value of the
ATTRIBUTE_PHRASE token.

With this change, the attribute in the example above is consistently
recorded for both 'x' and 'y'.

[Before]

    $ cat &lt;&lt;EOF | scripts/genksyms/genksyms -d
    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;
    EOF
    Defn for type0 x == &lt;int x &gt;
    Defn for type0 y == &lt;int y __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Hash table occupancy 2/4096 = 0.000488281

[After]

    $ cat &lt;&lt;EOF | scripts/genksyms/genksyms -d
    int x __attribute__((__aligned__(4)));
    int y __attribute__((__aligned__(4))) = 0;
    EOF
    Defn for type0 x == &lt;int x __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Defn for type0 y == &lt;int y __attribute__ ( ( __aligned__ ( 4 ) ) ) &gt;
    Hash table occupancy 2/4096 = 0.000488281

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>genksyms: restrict direct-declarator to take one parameter-type-list</title>
<updated>2025-01-18T00:11:46+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-13T15:00:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=aa710cee0d677043f49a447c4665df51a553a2ba'/>
<id>aa710cee0d677043f49a447c4665df51a553a2ba</id>
<content type='text'>
Similar to the previous commit, this change makes the parser logic a
little more accurate.

Currently, genksyms accepts the following invalid code:

    struct foo {
            int (*callback)(int)(int)(int);
    };

A direct-declarator should not recursively absorb multiple
( parameter-type-list ) constructs.

In the example above, (*callback) should be followed by at most one
(int).

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Similar to the previous commit, this change makes the parser logic a
little more accurate.

Currently, genksyms accepts the following invalid code:

    struct foo {
            int (*callback)(int)(int)(int);
    };

A direct-declarator should not recursively absorb multiple
( parameter-type-list ) constructs.

In the example above, (*callback) should be followed by at most one
(int).

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</pre>
</div>
</content>
</entry>
</feed>
