The NetBSD Project

CVS log for src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c

[BACK] Up to [cvs.NetBSD.org] / src / tests / usr.bin / xlint / lint1

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.13: download - view: text, markup, annotated - select for diffs
Sat Sep 28 15:51:40 2024 UTC (2 months, 1 week ago) by rillig
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +3 -22 lines
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.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Sep 28 11:20:29 2024 UTC (2 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +18 -1 lines
lint: reduce shift/reduce conflicts in grammar

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

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Jul 15 21:47:35 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +1 -3 lines
lint: each member declarator may have attributes, not only the last one

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Jul 15 21:40:03 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +14 -1 lines
tests/lint: test GCC attributes in member declarations

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Jul 7 06:03:31 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +2 -1 lines
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.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Tue Mar 28 14:44:34 2023 UTC (20 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +3 -1 lines
lint: warn about extern declarations outside headers

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

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sun Feb 5 10:57:48 2023 UTC (22 months ago) by rillig
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +1 -5 lines
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.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Aug 25 19:03:48 2022 UTC (2 years, 3 months ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -2 lines
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@.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Aug 11 05:19:33 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +1 -3 lines
lint: allow GCC __attribute__ after array brackets

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

Revision 1.4: download - view: text, markup, annotated - select for diffs
Wed Aug 11 05:08:35 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +10 -1 lines
tests/lint: demonstrate wrong 'syntax error' for unused argument

Seen in pam_chroot.c:60.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun Jul 11 15:07:39 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +2 -3 lines
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.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Jul 11 13:32:06 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +42 -1 lines
tests/lint: analyze yesterday's bug for parsing declarations

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Jul 6 17:33:07 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
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.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>