History log of /netbsd-src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c (Results 1 – 13 of 13)
Revision Date Author Comments
# 5a40444e 28-Sep-2024 rillig <rillig@NetBSD.org>

lint: handle __attribute__((__unused__)) for functions and variables

Previously, lint ignored the '__unused' marker, requiring its own /*
ARGSUSED */ marker instead.

Previously, attributes were int

lint: handle __attribute__((__unused__)) for functions and variables

Previously, lint ignored the '__unused' marker, requiring its own /*
ARGSUSED */ marker instead.

Previously, attributes were interpreted as soon as the closing
parenthesis was parsed. For a function definition such as '__unused
static void f(void) {}', this was too early, as the attribute was not
connected to the function, as the function was not parsed yet.

Now, the 'unused' attribute is passed around by the parser, until it is
merged into the declarator where it belongs. Due to an inaccuracy in
the grammar, the 'used' attribute has to be passed through a
parameter_list, even though a parameter list is not related to
attributes. Still, it's better than before.

show more ...


# 1d4abfd0 28-Sep-2024 rillig <rillig@NetBSD.org>

lint: reduce shift/reduce conflicts in grammar

In an anonymous member declaration, the type attributes are already
parsed by the type specifier.


# 1e05010e 15-Jul-2023 rillig <rillig@NetBSD.org>

lint: each member declarator may have attributes, not only the last one


# c147c2e8 15-Jul-2023 rillig <rillig@NetBSD.org>

tests/lint: test GCC attributes in member declarations


# 06b80932 07-Jul-2023 rillig <rillig@NetBSD.org>

lint: only skip 'unused' warnings after errors, not other warnings

Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that. This can be se

lint: only skip 'unused' warnings after errors, not other warnings

Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that. This can be seen in
the test gcc_attribute_var.c, where only the last unused variable from a
function was marked as unused, the others slipped through.

Fixed by counting the errors and the warnings separately and only
combining them if actually desired.

show more ...


# b2baa501 28-Mar-2023 rillig <rillig@NetBSD.org>

lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html


# 9de30858 05-Feb-2023 rillig <rillig@NetBSD.org>

tests/lint: clean up

The .exp files are no longer kept under version control, so there's no
reason anymore to forcefully trigger a warning or an error.


# a649f3d0 25-Aug-2022 rillig <rillig@NetBSD.org>

lint: remove explicit list of known GCC attributes

Most GCC attributes consist of a single identifier. Up to now, it was
necessary to list each of these identifiers in the grammar, even those
that

lint: remove explicit list of known GCC attributes

Most GCC attributes consist of a single identifier. Up to now, it was
necessary to list each of these identifiers in the grammar, even those
that only apply to a single target architecture.

Instead, parse the general form of attributes, matching the few
attributes that lint handles by name instead. While here, rename the
grammar rules to use the GCC terms.

To avoid conflicts between the global function 'printf' and the GCC
attribute of the same name, do not add GCC attributes to the symbol
table, and don't make these symbols 'extern' either.

ok christos@.

show more ...


# b28f9610 11-Aug-2021 rillig <rillig@NetBSD.org>

lint: allow GCC __attribute__ after array brackets

GCC accepts this, so should lint. Seen in pam_lastlog.c:115.


# a8ba6cc9 11-Aug-2021 rillig <rillig@NetBSD.org>

tests/lint: demonstrate wrong 'syntax error' for unused argument

Seen in pam_chroot.c:60.


# 745a1e30 11-Jul-2021 rillig <rillig@NetBSD.org>

lint: fix bug when parsing unused variable (since 2021-07-10)

Partially revert to cgram.y 1.248 from 2021-06-29.

This fixes the parse error for variables whose declaration starts with
__attribute__

lint: fix bug when parsing unused variable (since 2021-07-10)

Partially revert to cgram.y 1.248 from 2021-06-29.

This fixes the parse error for variables whose declaration starts with
__attribute__((unused)). In the many refactorings of the last days this
bug has slipped in, and since there were several refactorings in that
area, there may be have been further bugs that are not caught by the
current test suite. Revert for now and maybe apply them later again
when there are more tests.

Things kept from the current version are:

The names of most of the rules, as they correspond more closely to C99
and do not affect the behavior in any way.

In type_direct_decl, the replacement of type_attribute_list with
type_attribute since that nonterminal is already part of a repetition
(saves 4 conflicts).

In block_item, the order of the rules corresponds to C99. This has no
influence on the generated parser, except for the rule numbers, which
are informative.

The merge of the duplicate code for struct_tag, enum_tag and
enum_constant, as they all contained exactly the same code.

show more ...


# 1deb95fa 11-Jul-2021 rillig <rillig@NetBSD.org>

tests/lint: analyze yesterday's bug for parsing declarations


# b4c7d7a7 06-Jul-2021 rillig <rillig@NetBSD.org>

tests/lint: add tests for GCC __attribute__

Before fixing the wrong handling of __attribute__ that is demonstrated
at the end of gcc_attribute.c, ensure that the attribute handling works
in the most

tests/lint: add tests for GCC __attribute__

Before fixing the wrong handling of __attribute__ that is demonstrated
at the end of gcc_attribute.c, ensure that the attribute handling works
in the most basic cases.

Lint currently accepts __attribute__ in more places than it should.
This leads to some ambiguities in the grammar.

show more ...