The NetBSD Project

CVS log for src/usr.bin/xlint/lint1/lex.c

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.222 / (download) - annotate - [select for diffs], Sun Mar 3 16:09:01 2024 UTC (3 weeks, 3 days ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.221: +34 -31 lines
Diff to previous 1.221 (colored) to selected 1.52 (colored)

lint: clean up string parsing and snprintb check

Revision 1.221 / (download) - annotate - [select for diffs], Sat Mar 2 09:32:18 2024 UTC (3 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.220: +9 -8 lines
Diff to previous 1.220 (colored) to selected 1.52 (colored)

lint: remove custom wrappers around <ctype.h> functions

Revision 1.220 / (download) - annotate - [select for diffs], Fri Mar 1 21:52:48 2024 UTC (3 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.219: +6 -6 lines
Diff to previous 1.219 (colored) to selected 1.52 (colored)

lint: fix misleading initializer for string iterator

The field 'start' marks the start of the previous matching character,
not the current iterator position.

No binary change.

Revision 1.219 / (download) - annotate - [select for diffs], Fri Mar 1 17:14:34 2024 UTC (3 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.218: +3 -3 lines
Diff to previous 1.218 (colored) to selected 1.52 (colored)

lint: fix type error in strict bool mode (since yesterday)

Revision 1.218 / (download) - annotate - [select for diffs], Thu Feb 29 21:37:10 2024 UTC (3 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.217: +55 -65 lines
Diff to previous 1.217 (colored) to selected 1.52 (colored)

lint1: remove redundant type table for integer constant suffixes

Revision 1.217 / (download) - annotate - [select for diffs], Thu Feb 8 20:59:19 2024 UTC (6 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.216: +4 -4 lines
Diff to previous 1.216 (colored) to selected 1.52 (colored)

lint: clean up variable names, parameter order, comments

No functional change.

Revision 1.216 / (download) - annotate - [select for diffs], Thu Feb 8 20:45:20 2024 UTC (6 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.215: +11 -15 lines
Diff to previous 1.215 (colored) to selected 1.52 (colored)

lint: clean up redundant braces

No functional change.

Revision 1.215 / (download) - annotate - [select for diffs], Wed Feb 7 08:00:36 2024 UTC (7 weeks, 1 day ago) by rillig
Branch: MAIN
Changes since 1.214: +15 -19 lines
Diff to previous 1.214 (colored) to selected 1.52 (colored)

lint: use consistent variable names, reduce code for reading a byte

No functional change.

Revision 1.214 / (download) - annotate - [select for diffs], Wed Feb 7 07:42:50 2024 UTC (7 weeks, 1 day ago) by rillig
Branch: MAIN
Changes since 1.213: +12 -54 lines
Diff to previous 1.213 (colored) to selected 1.52 (colored)

lint: unify rules for determining the type of an integer constant

Previously, in traditional C mode, large decimal numbers were treated as
unsigned, which disagreed with the book from 1978.

Revision 1.213 / (download) - annotate - [select for diffs], Sat Feb 3 20:10:10 2024 UTC (7 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.212: +9 -4 lines
Diff to previous 1.212 (colored) to selected 1.52 (colored)

lint: warn about short octal escape followed by '8' or '9'

These mistakes is typically found in snprintb format directives but is
probably a typo everywhere else as well.

Revision 1.212 / (download) - annotate - [select for diffs], Sat Feb 3 19:25:16 2024 UTC (7 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.211: +250 -191 lines
Diff to previous 1.211 (colored) to selected 1.52 (colored)

lint: keep strings in their source representation

This allows further analysis depending on whether individual characters are
escaped as octal, hexadecimal or not at all.

Revision 1.211 / (download) - annotate - [select for diffs], Sat Feb 3 18:58:05 2024 UTC (7 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.210: +19 -25 lines
Diff to previous 1.210 (colored) to selected 1.52 (colored)

lint: allow hexadecimal character escapes up to UINT_MAX

Previously, any value larger than INT_MAX was regarded as negative and
thus terminated the loop around get_escaped_char.

Revision 1.210 / (download) - annotate - [select for diffs], Sat Feb 3 12:57:12 2024 UTC (7 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.209: +10 -15 lines
Diff to previous 1.209 (colored) to selected 1.52 (colored)

lint: clean up comments, reduce scope of variables

Revision 1.209 / (download) - annotate - [select for diffs], Sat Feb 3 10:56:18 2024 UTC (7 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.208: +23 -30 lines
Diff to previous 1.208 (colored) to selected 1.52 (colored)

lint: remove unused code for converting multibyte character sequences

Revision 1.208 / (download) - annotate - [select for diffs], Sat Feb 3 10:01:58 2024 UTC (7 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.207: +20 -19 lines
Diff to previous 1.207 (colored) to selected 1.52 (colored)

lint: allow larger numbers in escapes for wide characters and strings

Revision 1.207 / (download) - annotate - [select for diffs], Fri Feb 2 16:05:37 2024 UTC (7 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.206: +5 -8 lines
Diff to previous 1.206 (colored) to selected 1.52 (colored)

lint: make newline in a string literal an error in C90 and later

Revision 1.206 / (download) - annotate - [select for diffs], Thu Feb 1 21:19:13 2024 UTC (7 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.205: +16 -30 lines
Diff to previous 1.205 (colored) to selected 1.52 (colored)

lint: reuse buffer editing code across lint1

Fix cat_strings to update the capacity of the buffer, to prevent
quadratic runtime when concatenating string literals.

Revision 1.205 / (download) - annotate - [select for diffs], Thu Feb 1 18:37:06 2024 UTC (7 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.204: +12 -14 lines
Diff to previous 1.204 (colored) to selected 1.52 (colored)

lint: use standard buffer for storing string values

No functional change.

Revision 1.204 / (download) - annotate - [select for diffs], Mon Jan 29 21:30:25 2024 UTC (8 weeks, 2 days ago) by rillig
Branch: MAIN
Changes since 1.203: +15 -18 lines
Diff to previous 1.203 (colored) to selected 1.52 (colored)

lint: do not remember content of wide string literals

The plain char literals are needed for checking printf/scanf format
strings; lint has no similar check for wide strings. These format
strings are checked by modern compilers, making this check less
relevant.

Revision 1.203 / (download) - annotate - [select for diffs], Sat Jan 27 20:03:14 2024 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.202: +77 -39 lines
Diff to previous 1.202 (colored) to selected 1.52 (colored)

lint: fix type of large integer constants

Revision 1.202 / (download) - annotate - [select for diffs], Sat Jan 27 15:53:27 2024 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.201: +68 -61 lines
Diff to previous 1.201 (colored) to selected 1.52 (colored)

lint: split determining the type of an integer constant

No functional change.

Revision 1.201 / (download) - annotate - [select for diffs], Sat Jan 27 12:14:58 2024 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.200: +20 -20 lines
Diff to previous 1.200 (colored) to selected 1.52 (colored)

lint: extract signedness detection from lexing an integer constant

An integer constant that is signed in traditional C but unsigned since
C90 is an edge case that should not clutter the main code of determining
the resulting type of the constant.

The code for lexing an integer constant doesn't implement the C99 rules
yet, which convert a constant to the 'long long' types if the 'long'
types don't suffice.

Revision 1.200 / (download) - annotate - [select for diffs], Tue Jan 23 19:44:28 2024 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.199: +24 -23 lines
Diff to previous 1.199 (colored) to selected 1.52 (colored)

lint: rename symt_t to symbol_kind

It was confusing to have two kinds of "symbol type" (s_type and s_symt),
so rename all related identifiers to be more distinctive.

No functional change.

Revision 1.199 / (download) - annotate - [select for diffs], Fri Jan 19 19:23:34 2024 UTC (2 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.198: +15 -11 lines
Diff to previous 1.198 (colored) to selected 1.52 (colored)

lint: allow '\e' only in GCC mode

Revision 1.198 / (download) - annotate - [select for diffs], Fri Jan 19 18:23:13 2024 UTC (2 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.197: +4 -2 lines
Diff to previous 1.197 (colored) to selected 1.52 (colored)

add \e

Revision 1.197 / (download) - annotate - [select for diffs], Sun Jan 7 18:42:37 2024 UTC (2 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.196: +9 -2 lines
Diff to previous 1.196 (colored) to selected 1.52 (colored)

lint: allow querying for invisible characters in literals and constants

Revision 1.196 / (download) - annotate - [select for diffs], Sun Dec 3 18:17:41 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.195: +4 -4 lines
Diff to previous 1.195 (colored) to selected 1.52 (colored)

lint: in declarations, replace tab with space

Previously, in some cases, the keywords 'const' or 'struct' were
followed by a tab, which doesn't make sense.

No functional change.

Revision 1.195 / (download) - annotate - [select for diffs], Sun Dec 3 13:12:40 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.194: +13 -13 lines
Diff to previous 1.194 (colored) to selected 1.52 (colored)

lint: re-wrap comments

No functional change.

Revision 1.194 / (download) - annotate - [select for diffs], Sun Dec 3 12:03:38 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.193: +3 -3 lines
Diff to previous 1.193 (colored) to selected 1.52 (colored)

lint: indent statement continuations consistently

No binary change.

Revision 1.193 / (download) - annotate - [select for diffs], Sat Dec 2 21:47:05 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored) to selected 1.52 (colored)

lint: rename NOSCL to NO_SCL

For symmetry with NO_TSPEC.  No functional change.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Aug 26 10:43:53 2023 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.191: +3 -3 lines
Diff to previous 1.191 (colored) to selected 1.52 (colored)

lint: make diagnostics about ANSI C more international

Revision 1.191 / (download) - annotate - [select for diffs], Sat Aug 12 06:43:16 2023 UTC (7 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.190: +54 -48 lines
Diff to previous 1.190 (colored) to selected 1.52 (colored)

lint: clean up lexing of preprocessing lines

The relation between 'c' and 'cp' was tricky to follow.

No functional change.

Revision 1.190 / (download) - annotate - [select for diffs], Tue Aug 1 16:08:58 2023 UTC (7 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.189: +4 -2 lines
Diff to previous 1.189 (colored) to selected 1.52 (colored)

lint: improve debug logging for declarators

Revision 1.189 / (download) - annotate - [select for diffs], Sun Jul 30 22:27:21 2023 UTC (7 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.188: +3 -2 lines
Diff to previous 1.188 (colored) to selected 1.52 (colored)

lint: in debug mode, default to indenting the debug log

Only the 'parsing' lines are not indented, as line breaks are
independent from the structure of the code.

Revision 1.188 / (download) - annotate - [select for diffs], Sat Jul 15 13:35:24 2023 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.187: +10 -10 lines
Diff to previous 1.187 (colored) to selected 1.52 (colored)

lint: add detailed logging for finding memory allocation bugs

Revision 1.187 / (download) - annotate - [select for diffs], Sat Jul 15 09:40:36 2023 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.186: +16 -9 lines
Diff to previous 1.186 (colored) to selected 1.52 (colored)

lint: add debug logging for memory management and the symbol table

Revision 1.186 / (download) - annotate - [select for diffs], Fri Jul 14 09:32:42 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.185: +9 -2 lines
Diff to previous 1.185 (colored) to selected 1.52 (colored)

lint: document which keywords are available in which language levels

Revision 1.185 / (download) - annotate - [select for diffs], Thu Jul 13 23:11:11 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.184: +10 -9 lines
Diff to previous 1.184 (colored) to selected 1.52 (colored)

lint: use separate types for parsing pointer types and type qualifiers

The documentation of the previous 'qual_ptr_t' was misleading, as that
type was used for other type qualifier lists as well, even if these were
not related to pointer types.

Revision 1.184 / (download) - annotate - [select for diffs], Thu Jul 13 20:30:21 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.183: +21 -13 lines
Diff to previous 1.183 (colored) to selected 1.52 (colored)

lint: in C23 mode, recognize the keyword 'thread_local'

Revision 1.183 / (download) - annotate - [select for diffs], Thu Jul 13 19:59:08 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.182: +4 -5 lines
Diff to previous 1.182 (colored) to selected 1.52 (colored)

lint: _Thread_local is a storage class, not a type qualifier

Revision 1.182 / (download) - annotate - [select for diffs], Thu Jul 13 08:40:38 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.181: +4 -4 lines
Diff to previous 1.181 (colored) to selected 1.52 (colored)

lint: indent copyright lines consistently

Revision 1.181 / (download) - annotate - [select for diffs], Thu Jul 13 08:18:17 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.180: +6 -10 lines
Diff to previous 1.180 (colored) to selected 1.52 (colored)

lint: clean up reading lint comments

Revision 1.180 / (download) - annotate - [select for diffs], Thu Jul 13 07:19:24 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.179: +26 -32 lines
Diff to previous 1.179 (colored) to selected 1.52 (colored)

lint: reduce code size for handling lint comments

Revision 1.179 / (download) - annotate - [select for diffs], Thu Jul 13 06:41:27 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.178: +4 -4 lines
Diff to previous 1.178 (colored) to selected 1.52 (colored)

lint: clean up code related to lint comments

Remove type information from variable names, as the word 'flag' did not
indicate that the variables were negated.

Remove contradicting comments. Suppressing a warning for 'this line',
'this and the following line' and 'this statement or declaration' cannot
all be accurate at the same time.

Revision 1.178 / (download) - annotate - [select for diffs], Wed Jul 12 20:13:28 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.177: +3 -3 lines
Diff to previous 1.177 (colored) to selected 1.52 (colored)

lint: reduce runtime relocations

Revision 1.177 / (download) - annotate - [select for diffs], Wed Jul 12 18:26:04 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.176: +3 -3 lines
Diff to previous 1.176 (colored) to selected 1.52 (colored)

lint: reject _Noreturn if it occurs in invalid places

C11 introduced _Noreturn as a function-specifier, not as a type
attribute.  The latter may occur in more places.

Revision 1.176 / (download) - annotate - [select for diffs], Wed Jul 12 16:07:35 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.175: +15 -8 lines
Diff to previous 1.175 (colored) to selected 1.52 (colored)

lint: don't treat 'inline' as a storage class

The additional conflict in the grammar is in the same place as the other
conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.

No functional change.

Revision 1.175 / (download) - annotate - [select for diffs], Wed Jul 12 10:08:11 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.174: +22 -19 lines
Diff to previous 1.174 (colored) to selected 1.52 (colored)

lint: condense keyword table

This prepares for modelling 'inline' not as a storage class, but more
correctly as a function specifier.

Revision 1.174 / (download) - annotate - [select for diffs], Mon Jul 10 19:00:33 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.173: +4 -4 lines
Diff to previous 1.173 (colored) to selected 1.52 (colored)

lint: add debug logging for symbol kinds in the parser

An identifier can refer to a variable, type, member, tag or label.
Switching between these namespaces is tightly coupled with the
evaluation order of the grammar rules.

Revision 1.173 / (download) - annotate - [select for diffs], Mon Jul 10 09:51:30 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.172: +6 -6 lines
Diff to previous 1.172 (colored) to selected 1.52 (colored)

lint: clean up wchar_t and hash tables

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jul 9 12:15:07 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.171: +6 -5 lines
Diff to previous 1.171 (colored) to selected 1.52 (colored)

lint: miscellaneous cleanup

Revision 1.171 / (download) - annotate - [select for diffs], Sun Jul 9 11:18:55 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.170: +4 -4 lines
Diff to previous 1.170 (colored) to selected 1.52 (colored)

lint: clean up wording in diagnostics

Use the term 'parameter' as defined in C99 3.15.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Jul 9 11:01:27 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.169: +5 -5 lines
Diff to previous 1.169 (colored) to selected 1.52 (colored)

lint: clean up the wording of a few diagnostics

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jul 8 10:59:38 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.168: +4 -3 lines
Diff to previous 1.168 (colored) to selected 1.52 (colored)

lint: fix handling of 'long double' in cross-compiled mode

When lint is compiled on x86-64 (where 'long double' has a 64-bit
mantissa) and targets arm (where 'long double' has a 53-bit mantissa),
warn if a constant cannot fit in the 'long double' of the target
platform, not of the host platform.

Revision 1.168 / (download) - annotate - [select for diffs], Mon Jul 3 07:19:57 2023 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.167: +3 -3 lines
Diff to previous 1.167 (colored) to selected 1.52 (colored)

lint: clean up redundant casts

Revision 1.167 / (download) - annotate - [select for diffs], Mon Jul 3 07:03:19 2023 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.166: +9 -9 lines
Diff to previous 1.166 (colored) to selected 1.52 (colored)

lint: rename uppercase QUAD to LLONG

No binary change.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Jul 2 18:14:44 2023 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.165: +26 -26 lines
Diff to previous 1.165 (colored) to selected 1.52 (colored)

lint: rename 'quad' to 'signed int' or 'unsigned int'

No functional change.

Revision 1.165 / (download) - annotate - [select for diffs], Sun Jul 2 10:20:45 2023 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.164: +5 -6 lines
Diff to previous 1.164 (colored) to selected 1.52 (colored)

lint: extend debug logging for declaration levels

Indent the debug logging according to the declaration level.

Since there are a few cases where the enclosing declaration levels are
modified, log the whole declaration level stack whenever a level begins
or ends.

Revision 1.164 / (download) - annotate - [select for diffs], Fri Jun 30 21:39:54 2023 UTC (8 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.163: +11 -11 lines
Diff to previous 1.163 (colored) to selected 1.52 (colored)

lint: clean up names related to declaration levels

The previous prefix 'DK_' (declaration level kind) had a conflict with
the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'.
The new name for dinfo_t is decl_level, which is more expressive.

No functional change.

Revision 1.163 / (download) - annotate - [select for diffs], Fri Jun 30 19:43:00 2023 UTC (8 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.162: +4 -4 lines
Diff to previous 1.162 (colored) to selected 1.52 (colored)

lint: replace macro for unique identifiers with function

No functional change.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Jun 29 22:52:44 2023 UTC (8 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.161: +8 -8 lines
Diff to previous 1.161 (colored) to selected 1.52 (colored)

lint: clean up member names of declaration levels

No functional change outside debug mode.

Revision 1.161 / (download) - annotate - [select for diffs], Sat Jun 24 08:11:12 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.160: +4 -2 lines
Diff to previous 1.160 (colored) to selected 1.52 (colored)

lint: add query for comparing 'char' with plain integers

Revision 1.160 / (download) - annotate - [select for diffs], Fri Jun 9 15:36:31 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.159: +3 -3 lines
Diff to previous 1.159 (colored) to selected 1.52 (colored)

lint: miscellaneous clean-ups

No binary change, except for line numbers in assertions.

Revision 1.159 / (download) - annotate - [select for diffs], Fri Jun 9 13:03:49 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.158: +24 -24 lines
Diff to previous 1.158 (colored) to selected 1.52 (colored)

lint: indent local variables consistently

No binary change.

Revision 1.158 / (download) - annotate - [select for diffs], Tue Apr 11 00:03:42 2023 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.157: +8 -7 lines
Diff to previous 1.157 (colored) to selected 1.52 (colored)

lint: don't wrongly warn about overflow in complex constants

Seen in lib/libm.

Revision 1.157 / (download) - annotate - [select for diffs], Fri Apr 7 11:08:31 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.156: +7 -9 lines
Diff to previous 1.156 (colored) to selected 1.52 (colored)

lint: reduce clutter in parsing preprocessor lines

No functional change.

Revision 1.156 / (download) - annotate - [select for diffs], Wed Apr 5 20:17:30 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.155: +4 -5 lines
Diff to previous 1.155 (colored) to selected 1.52 (colored)

lint: fix duplicate warning when parsing big float constants

Revision 1.155 / (download) - annotate - [select for diffs], Fri Mar 31 13:03:05 2023 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.154: +7 -2 lines
Diff to previous 1.154 (colored) to selected 1.52 (colored)

lint: allow querying for octal integer constants

Revision 1.154 / (download) - annotate - [select for diffs], Sun Feb 19 12:00:15 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.153: +4 -9 lines
Diff to previous 1.153 (colored) to selected 1.52 (colored)

lint: do not warn about traditional C migration in C99 mode

For large integer constants, the resulting type could differ between
traditional C and C90. In C99 mode, this difference is no longer
relevant since it is too far away from traditional C.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Feb 19 11:50:29 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.152: +2 -4 lines
Diff to previous 1.152 (colored) to selected 1.52 (colored)

tests/lint: fix and extend tests for C90 migration warning

Revision 1.152 / (download) - annotate - [select for diffs], Sat Feb 18 15:09:10 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.151: +3 -6 lines
Diff to previous 1.151 (colored) to selected 1.52 (colored)

lint: remove dead code from lex_floating_constant

Neither traditional C nor C11 allows a trailing 'd' or 'D' on floating
point constants. Java does, but lint does not cover Java programs.

Revision 1.151 / (download) - annotate - [select for diffs], Sat Feb 18 15:05:38 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.150: +20 -28 lines
Diff to previous 1.150 (colored) to selected 1.52 (colored)

lint: reduce scope of local variables

No functional change.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Feb 18 14:44:51 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.149: +14 -9 lines
Diff to previous 1.149 (colored) to selected 1.52 (colored)

lint: use strtold for parsing floating constants

Supported since C99.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Feb 18 14:32:32 2023 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.148: +3 -21 lines
Diff to previous 1.148 (colored) to selected 1.52 (colored)

lint: remove compat code for lexing hex floating point literals

Hex floating literals are required by C99.

Revision 1.148 / (download) - annotate - [select for diffs], Thu Feb 2 22:23:30 2023 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.147: +5 -8 lines
Diff to previous 1.147 (colored) to selected 1.52 (colored)

lint: clean up

In symtab_search, most of the conditions were redundant, so remove them.

In read_byte, using CHAR_MASK was conceptually wrong, as that constant
is from the target platform while the lexical analysis happens on the
host platform.  It was unnecessary as well, as a hypothetical host
platform with 36-bit chars might encode the characters from the basic
source character set as numbers higher than 0x0_0000_00ff.  Since lint
assumes that both the source character set as well as the execution
character set are the same and based on 8-bit bytes, nothing changes.

No functional change.

Revision 1.147 / (download) - annotate - [select for diffs], Sun Jan 29 13:57:35 2023 UTC (13 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.146: +4 -5 lines
Diff to previous 1.146 (colored) to selected 1.52 (colored)

lint: inline an expression, clean up comments

No functional change.

Revision 1.146 / (download) - annotate - [select for diffs], Sun Jan 22 17:04:30 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.145: +64 -107 lines
Diff to previous 1.145 (colored) to selected 1.52 (colored)

lint: clean up the lexer

No functional change.

Revision 1.145 / (download) - annotate - [select for diffs], Sun Jan 22 16:05:08 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.144: +10 -8 lines
Diff to previous 1.144 (colored) to selected 1.52 (colored)

lint: prevent undefined behavior for signed '<<'

Found by manual code inspection, verified by MKSANITIZER=yes
USE_SANITIZER=undefined.

Revision 1.144 / (download) - annotate - [select for diffs], Sat Jan 21 21:26:40 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.143: +10 -11 lines
Diff to previous 1.143 (colored) to selected 1.52 (colored)

lint: use more expressive variable names in lexer

The name 't' could easily be mistaken to mean a tspec_t.

No functional change.

Revision 1.143 / (download) - annotate - [select for diffs], Sat Jan 21 18:03:37 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.142: +39 -59 lines
Diff to previous 1.142 (colored) to selected 1.52 (colored)

lint: reduce clutter in lexer

No functional change.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Jan 21 13:48:40 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (colored) to selected 1.52 (colored)

lint: add support for C11 '_Atomic' as atomic-type-specifier

Following the C11 grammar, the keyword '_Atomic' needs to be a separate
syntactic category, to avoid further conflicts in the grammar.

The two newly added conflicts in the grammar would come into play when
mixing traditional C with C11, in a type name without an implicit 'int'.
If the type '_Atomic(int)*' were parsed as '_Atomic int(int)*', the
trailing '*' would be a syntax error.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Jan 21 13:07:22 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.140: +4 -2 lines
Diff to previous 1.140 (colored) to selected 1.52 (colored)

lint: add support for the C11 type qualifier '_Atomic'

That keyword can be used as a type specifier as well, support for that
will be added later.

Revision 1.140 / (download) - annotate - [select for diffs], Sat Jan 21 10:18:15 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.139: +12 -12 lines
Diff to previous 1.139 (colored) to selected 1.52 (colored)

lint: use simpler integers for parsing hex escapes

No functional change.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Jan 21 10:11:41 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.138: +19 -20 lines
Diff to previous 1.138 (colored) to selected 1.52 (colored)

lint: use longer variable names, don't count digits in hex escapes

No functional change.

Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 21 09:42:12 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.137: +48 -49 lines
Diff to previous 1.137 (colored) to selected 1.52 (colored)

lint: eliminate forward declaration for get_escaped_char

No functional change.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Jan 21 09:16:33 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.136: +68 -59 lines
Diff to previous 1.136 (colored) to selected 1.52 (colored)

lint: extract reading of escaped character constants

No functional change.

Revision 1.136 / (download) - annotate - [select for diffs], Sat Jan 21 09:04:58 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.135: +60 -47 lines
Diff to previous 1.135 (colored) to selected 1.52 (colored)

lint: extract parsing character escapes into separate functions

No functional change.

Revision 1.135 / (download) - annotate - [select for diffs], Sun Jan 8 22:46:00 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.134: +20 -18 lines
Diff to previous 1.134 (colored) to selected 1.52 (colored)

lint: document how reading tokens from the input works

Rename inpc to read_byte, to make the name more expressive.  Since C99,
lint is no longer required to use overly short identifiers.

No functional change.

Revision 1.134 / (download) - annotate - [select for diffs], Sat Oct 1 10:04:06 2022 UTC (17 months, 3 weeks ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, 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
Changes since 1.133: +9 -11 lines
Diff to previous 1.133 (colored) to selected 1.52 (colored)

lint: miscellaneous cleanup

No functional change.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Aug 25 19:03:47 2022 UTC (19 months ago) by rillig
Branch: MAIN
Changes since 1.132: +18 -78 lines
Diff to previous 1.132 (colored) to selected 1.52 (colored)

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.132 / (download) - annotate - [select for diffs], Sat Jun 11 13:19:28 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.131: +17 -17 lines
Diff to previous 1.131 (colored) to selected 1.52 (colored)

lint: make definition of type keywords simpler

The only type keyword that is available in more than one variant is
'signed', which can also be written '__signed'.  Neither of the type
keywords is declared as being specific to GCC, even though __int128_t
and __uint128_t actually are non-standard.

No binary change.

Revision 1.131 / (download) - annotate - [select for diffs], Fri May 20 21:18:55 2022 UTC (22 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.130: +3 -3 lines
Diff to previous 1.130 (colored) to selected 1.52 (colored)

lint: use __RCSID in lint mode as well

Since 1995-10-02, lint supports __asm statements and __asm modifiers.

No binary change.

Revision 1.130 / (download) - annotate - [select for diffs], Thu May 12 00:18:35 2022 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored) to selected 1.52 (colored)

lint: fix support for __alignof__, add support for __alignof

Broken since lex.c 1.129 from yesterday.

Revision 1.129 / (download) - annotate - [select for diffs], Wed May 11 15:46:25 2022 UTC (22 months, 2 weeks ago) by christos
Branch: MAIN
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored) to selected 1.52 (colored)

gcc also allows __alignof

Revision 1.128 / (download) - annotate - [select for diffs], Sat Apr 30 22:31:23 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.127: +10 -6 lines
Diff to previous 1.127 (colored) to selected 1.52 (colored)

lint: inline macro 'sflag'

Mark all places where lint's C90 mode is stricter than its C99 mode.

Most of the situations in which lint produces only warnings instead of
errors covered by the "Constraints" sections in the relevant standards.
This doesn't prevent a specific compiler from accepting it though.

No functional change.

Revision 1.127 / (download) - annotate - [select for diffs], Sat Apr 30 21:38:03 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.126: +13 -13 lines
Diff to previous 1.126 (colored) to selected 1.52 (colored)

lint: inline macro 'tflag'

The definition of the macro tested both allow_trad and allow_c90, but
there is only a single mode in which allow_c90 is false, therefore it
suffices to test only that.

While double-checking each occurrence of tflag individually, I learned
why lint performs lookups of struct members only by name, independently
of the struct in which they are declared.  See typeok_arrow for details.

No functional change.

Revision 1.126 / (download) - annotate - [select for diffs], Sat Apr 30 20:43:16 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.125: +27 -9 lines
Diff to previous 1.125 (colored) to selected 1.52 (colored)

lint: document why in GCC mode, C99 keywords are enabled

Revision 1.125 / (download) - annotate - [select for diffs], Sat Apr 30 20:24:57 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.124: +12 -5 lines
Diff to previous 1.124 (colored) to selected 1.52 (colored)

lint: document why C11 keywords are available in C99 mode as well

Revision 1.124 / (download) - annotate - [select for diffs], Sat Apr 30 19:53:37 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.123: +53 -53 lines
Diff to previous 1.123 (colored) to selected 1.52 (colored)

lint: move GCC attributes to the bottom of the list

These identifiers have a simpler definition than the other keywords
since they do not define when they were introduced.

No functional change.

Revision 1.123 / (download) - annotate - [select for diffs], Sat Apr 16 20:08:35 2022 UTC (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.122: +5 -5 lines
Diff to previous 1.122 (colored) to selected 1.52 (colored)

lint: remove null marker from keyword table

No functional change.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Apr 16 20:02:55 2022 UTC (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.121: +58 -55 lines
Diff to previous 1.121 (colored) to selected 1.52 (colored)

lint: prepare keyword table for C11

The C11 keywords had been listed as being C99 keywords.  Instead of
initializing the individual fields separately, merge them by specifying
the year of the standard in which they appeared.

No binary change, except for line numbers in assertions.

Revision 1.121 / (download) - annotate - [select for diffs], Sat Apr 16 19:18:17 2022 UTC (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.120: +7 -6 lines
Diff to previous 1.120 (colored) to selected 1.52 (colored)

lint: migrate gflag to allow_gcc

No functional change.

Revision 1.120 / (download) - annotate - [select for diffs], Sat Apr 16 18:13:54 2022 UTC (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.119: +47 -47 lines
Diff to previous 1.119 (colored) to selected 1.52 (colored)

lint: clean up keyword definitions for the lexer

There is only one specialized keyword that is also a GCC attribute, it's
"section".  All other keywords passed 0 in that macro argument.

No binary change.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Apr 13 22:20:42 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.118: +3 -3 lines
Diff to previous 1.118 (colored) to selected 1.52 (colored)

lint: fix lint warning on platforms where size_t == unsigned int

lex.c(1451): warning: argument #1 is converted from 'int' to
    'unsigned int' due to prototype [259]

A more thorough fix would be to change the type of block_level from int
to size_t, to match mem_block_level, but that change would generate
further signedness warnings because the type of sym_t.s_block_level
would have to be changed from int to size_t as well, but some symbols
have s_block_level == -1, so that's a larger and more error-prone
change.  Leave that for later.

Whether message 259 makes sense at all in C99 mode is an entirely
different question that needs to be answered separately.

No functional change.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Apr 9 23:41:22 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.117: +3 -3 lines
Diff to previous 1.117 (colored) to selected 1.52 (colored)

lint: distinguish between storage class and declaration kind

These types overlap but are not the same.

No functional change.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Apr 9 15:43:41 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.116: +8 -8 lines
Diff to previous 1.116 (colored) to selected 1.52 (colored)

lint: disambiguate sym_t.s_value

Having a single variable for 4 different purposes with different types
makes the code unnecessarily hard to follow.

No functional change.

Revision 1.116 / (download) - annotate - [select for diffs], Sat Apr 9 13:38:17 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.115: +6 -6 lines
Diff to previous 1.115 (colored) to selected 1.52 (colored)

lint: inline member access macros for sym_t

Having the 'u.' explicitly in the code serves as a reminder that these
members are only defined under certain conditions.

No functional change.

Revision 1.115 / (download) - annotate - [select for diffs], Sat Apr 2 14:28:30 2022 UTC (23 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.114: +5 -4 lines
Diff to previous 1.114 (colored) to selected 1.52 (colored)

lint: rename dinfo_t.d_next to d_enclosing

The name d_next gave the wrong impression that the declaration infos
would be independent of each other, but they are nested.

No functional change.

Revision 1.114 / (download) - annotate - [select for diffs], Sat Apr 2 12:24:55 2022 UTC (23 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored) to selected 1.52 (colored)

lint: add debug logging for the declaration stack

To track down the wrong edge cases in decl_direct_abstract.c.

Revision 1.113 / (download) - annotate - [select for diffs], Sun Mar 13 15:20:50 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.112: +24 -21 lines
Diff to previous 1.112 (colored) to selected 1.52 (colored)

lint: clean up comments, explain assertion in inssym

Revision 1.112 / (download) - annotate - [select for diffs], Sun Mar 13 15:17:08 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.111: +6 -6 lines
Diff to previous 1.111 (colored) to selected 1.52 (colored)

lint: use an unsigned counter for temporary variable names

No functional change.

Revision 1.111 / (download) - annotate - [select for diffs], Sun Mar 13 15:08:41 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.110: +14 -11 lines
Diff to previous 1.110 (colored) to selected 1.52 (colored)

lint: improve debug logging for the symbol table

Only print the heading for the symbol table level if there is actually a
symbol on that level.

Ensure that no symbol with block level -1 is ever in the symbol table
(see rmsym).

Revision 1.110 / (download) - annotate - [select for diffs], Sun Mar 13 14:49:18 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (colored) to selected 1.52 (colored)

lint: fix off-by-one error in symbol table

No functional change since the error was in the "safe" direction.

Revision 1.109 / (download) - annotate - [select for diffs], Sun Mar 13 14:40:36 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.108: +3 -3 lines
Diff to previous 1.108 (colored) to selected 1.52 (colored)

lint: rename function 'cleanup' to be more expressive

No functional change.

Revision 1.108 / (download) - annotate - [select for diffs], Tue Mar 1 20:00:47 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.107: +2 -4 lines
Diff to previous 1.107 (colored) to selected 1.52 (colored)

lint: remove redundant assignments to string buffer length

No functional change.

Revision 1.107 / (download) - annotate - [select for diffs], Tue Mar 1 00:17:12 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.106: +67 -16 lines
Diff to previous 1.106 (colored) to selected 1.52 (colored)

lint: add debug logging for symbols and the symbol table

This logging is not active by default, the functions debug_sym and
debug_symtab can be called as needed during a debug session.

Revision 1.106 / (download) - annotate - [select for diffs], Mon Feb 28 22:41:07 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.105: +4 -4 lines
Diff to previous 1.105 (colored) to selected 1.52 (colored)

lint: constify lexer keywords

No functional change.

Revision 1.105 / (download) - annotate - [select for diffs], Sun Feb 27 22:46:04 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.104: +41 -42 lines
Diff to previous 1.104 (colored) to selected 1.52 (colored)

lint: reorganize lexer functions

Move the keywords table to the top, reduce forward declarations.

No functional change.

Revision 1.104 / (download) - annotate - [select for diffs], Sun Feb 27 22:26:12 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.103: +55 -55 lines
Diff to previous 1.103 (colored) to selected 1.52 (colored)

lint: group symbol table functions

No functional change.

Revision 1.103 / (download) - annotate - [select for diffs], Sun Feb 27 18:29:14 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.102: +7 -12 lines
Diff to previous 1.102 (colored) to selected 1.52 (colored)

lint: merge duplicate code for handling plain and wide strings

No functional change.  As before, the string literals "1" "2" "3" are
not concatenated from left to right, instead concatenation starts with
"23" and then proceeds to "123".

Revision 1.102 / (download) - annotate - [select for diffs], Sun Feb 27 10:44:45 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.101: +17 -17 lines
Diff to previous 1.101 (colored) to selected 1.52 (colored)

lint: unabbreviate some fields in sym_t

No functional change.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Feb 27 08:31:26 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.100: +12 -12 lines
Diff to previous 1.100 (colored) to selected 1.52 (colored)

lint: encode lifetime of allocated memory in the function names

No functional change.

Revision 1.100 / (download) - annotate - [select for diffs], Sun Feb 27 07:50:09 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.99: +7 -45 lines
Diff to previous 1.99 (colored) to selected 1.52 (colored)

lint: clean up memory management for string buffers

There is no reason to duplicate all the work that is already done by the
memory allocator.

No functional change.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Feb 27 07:38:54 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (colored) to selected 1.52 (colored)

lint: clean up memory allocation

No functional change.

Revision 1.98 / (download) - annotate - [select for diffs], Sat Feb 26 23:07:28 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.97: +25 -12 lines
Diff to previous 1.97 (colored) to selected 1.52 (colored)

lint: improve debug logging for symbol kinds

Revision 1.97 / (download) - annotate - [select for diffs], Sun Dec 26 18:16:41 2021 UTC (2 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.96: +3 -2 lines
Diff to previous 1.96 (colored) to selected 1.52 (colored)

Add clang's optnone attribute.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Dec 25 13:51:42 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.95: +3 -3 lines
Diff to previous 1.95 (colored) to selected 1.52 (colored)

lint: don't try to trick mathematics by defining ZERO to a nonzero value

No binary change.

Revision 1.95 / (download) - annotate - [select for diffs], Wed Dec 22 15:47:42 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.94: +4 -14 lines
Diff to previous 1.94 (colored) to selected 1.52 (colored)

lint: remove redundant EOF tests in lexer

No functional change.

Revision 1.94 / (download) - annotate - [select for diffs], Wed Dec 22 15:20:08 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.93: +38 -41 lines
Diff to previous 1.93 (colored) to selected 1.52 (colored)

lint: clean up lex.c

Rename 'struct kwtab' to 'struct keyword' since a single keyword is not
a whole keyword table.

Sync comment for lex_name with reality: sbuf_t no longer contains the
hash value.

Remove redundant tests for EOF, as EOF is neither a space nor a digit
nor an xdigit.

No functional change.

Revision 1.93 / (download) - annotate - [select for diffs], Wed Dec 22 14:49:11 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.92: +9 -9 lines
Diff to previous 1.92 (colored) to selected 1.52 (colored)

lint: remove spaces around bit-field colon

As seen in /usr/share/misc/style.

No binary change.

Revision 1.92 / (download) - annotate - [select for diffs], Wed Dec 22 14:38:34 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.91: +14 -14 lines
Diff to previous 1.91 (colored) to selected 1.52 (colored)

lint: rename C89 to C90 in variable names

No binary change.

Revision 1.91 / (download) - annotate - [select for diffs], Wed Dec 22 14:25:35 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.90: +4 -4 lines
Diff to previous 1.90 (colored) to selected 1.52 (colored)

lint: use C90 instead of C89 when referring to the C standard

Revision 1.90 / (download) - annotate - [select for diffs], Wed Dec 15 15:20:51 2021 UTC (2 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.89: +6 -2 lines
Diff to previous 1.89 (colored) to selected 1.52 (colored)

Add more attributes

Revision 1.89 / (download) - annotate - [select for diffs], Tue Dec 14 20:13:13 2021 UTC (2 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored) to selected 1.52 (colored)

Improve restrict handling.

Revision 1.88 / (download) - annotate - [select for diffs], Sat Nov 27 20:13:48 2021 UTC (2 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.87: +3 -2 lines
Diff to previous 1.87 (colored) to selected 1.52 (colored)

Add target attribute

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 16 18:33:14 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.86: +7 -6 lines
Diff to previous 1.86 (colored) to selected 1.52 (colored)

lint: finish renaming of fcon to lex_floating_constant

Revision 1.86 / (download) - annotate - [select for diffs], Tue Nov 16 17:41:23 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.85: +5 -6 lines
Diff to previous 1.85 (colored) to selected 1.52 (colored)

lint: rename attron to in_gcc_attribute

No functional change.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Nov 1 19:10:07 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.84: +6 -4 lines
Diff to previous 1.84 (colored) to selected 1.52 (colored)

lint: move all declarations above statements

All code that is used by src/tools is supposed to be compatible with C90.

No functional change.

Revision 1.84 / (download) - annotate - [select for diffs], Sat Sep 18 10:46:17 2021 UTC (2 years, 6 months ago) by jmcneill
Branch: MAIN
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (colored) to selected 1.52 (colored)

use isfinite(3) instead of finite(3) for portability

Fixes tools build on macOS 11.6 arm64 hosts.

Revision 1.83 / (download) - annotate - [select for diffs], Fri Sep 17 21:06:04 2021 UTC (2 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored) to selected 1.52 (colored)

Extra commit to fix the actual wrong comment before:
Add _Static_assert grammar and keyword

Revision 1.82 / (download) - annotate - [select for diffs], Fri Sep 17 20:17:30 2021 UTC (2 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.81: +3 -2 lines
Diff to previous 1.81 (colored) to selected 1.52 (colored)

remove the lint kludges

Revision 1.81 / (download) - annotate - [select for diffs], Sun Sep 5 16:03:55 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.80: +7 -8 lines
Diff to previous 1.80 (colored) to selected 1.52 (colored)

lint: fix lint warnings

Revision 1.80 / (download) - annotate - [select for diffs], Sun Aug 29 09:29:32 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.79: +6 -3 lines
Diff to previous 1.79 (colored) to selected 1.52 (colored)

lint: allow 'fallthrough' as alternative spelling of FALLTHROUGH

Seen in unbound/lookup3.c.

No change to the documentation since the canonical spelling is still the
same.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Aug 29 09:05:35 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.78: +7 -3 lines
Diff to previous 1.78 (colored) to selected 1.52 (colored)

lint: accept keyword variant FALL THROUGH as alias to FALLTHROUGH

Seen in archive_string.c, macro WRITE_UC.

No documentation change since the canonical spelling of this keyword
stays the same.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Aug 28 21:52:14 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.77: +5 -5 lines
Diff to previous 1.77 (colored) to selected 1.52 (colored)

lint: clean up hash functions

No functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Sat Aug 28 21:14:32 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.76: +6 -34 lines
Diff to previous 1.76 (colored) to selected 1.52 (colored)

lint: remove unreachable code for parsing integer constants

The largest possible type of an integer constant is 'unsigned long
long'.  Any larger type can only be expressed using casts.

See also https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html.

Revision 1.76 / (download) - annotate - [select for diffs], Sat Aug 28 19:27:44 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.75: +4 -4 lines
Diff to previous 1.75 (colored) to selected 1.52 (colored)

lint: fold constants in hash functions

All platforms supported by lint have sizeof(unsigned int) == 4 and
CHAR_BIT == 8.  There is no need to encode these expressions in a hash
function, they only made the code harder to read.

No functional change.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Aug 28 18:58:24 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.74: +6 -3 lines
Diff to previous 1.74 (colored) to selected 1.52 (colored)

lint: replace obsolete strtouq with equivalent strtoull

Revision 1.74 / (download) - annotate - [select for diffs], Sat Aug 28 15:01:43 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.73: +4 -10 lines
Diff to previous 1.73 (colored) to selected 1.52 (colored)

lint: fix lexing of character constants

The final value of the character constant must be determined by the
target platform, not the host platform.

This allows to run the tests for a target platform with different
signedness of characters, by editing targparam.h and t_integration.

Lint is not completely cross-compileable though.  64-bit host platforms
can run lint for 32-bit platforms, but not vice versa, since 32-bit GCC
does not provide 128-bit integer types.

Revision 1.73 / (download) - annotate - [select for diffs], Sat Aug 28 13:29:26 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored) to selected 1.52 (colored)

lint: explicitly ignore return value of some function calls

This fixes the warning from lint2 that these functions return values
which are sometimes ignored.

The remaining calls to fprintf that ignore the return value come from
scan.c.  Lint does not currently detect the auto-generated portions of
that file and the interesting ones since it assumes that scan.c is the
main filename, see expr_zalloc_tnode.

No functional change.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Aug 28 13:11:10 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.71: +7 -7 lines
Diff to previous 1.71 (colored) to selected 1.52 (colored)

lint: use 'unsigned int' for bit-size of types in convert_integer

There was no need to have two separate magic values (0 and -1) to mean
the same.

No functional change.

Revision 1.71 / (download) - annotate - [select for diffs], Sat Aug 28 12:21:53 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.70: +9 -9 lines
Diff to previous 1.70 (colored) to selected 1.52 (colored)

lint: un-abbreviate unsigned integer types

No functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Wed Aug 25 22:48:40 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.69: +3 -2 lines
Diff to previous 1.69 (colored) to selected 1.52 (colored)

lint: add __attribute__ regparm

Seen in libexec/ld.elf_so/rtld.h.

Revision 1.69 / (download) - annotate - [select for diffs], Mon Aug 23 06:26:37 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.68: +2 -9 lines
Diff to previous 1.68 (colored) to selected 1.52 (colored)

lint: inline msb

This reduces the binary size on x86_64 by about 500 bytes.

No functional change.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Aug 23 06:21:59 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.67: +5 -7 lines
Diff to previous 1.67 (colored) to selected 1.52 (colored)

lint: remove unnecessary width parameter for msb

No functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Sun Aug 22 13:12:39 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.66: +6 -6 lines
Diff to previous 1.66 (colored) to selected 1.52 (colored)

lint: use unsigned integers for storing hash values

The computation of the hash values is unchanged, only the resulting
value (which is always less than 1009 anyway, see HSHSIZ2) is stored as
unsigned as well.

No functional change.

Revision 1.66 / (download) - annotate - [select for diffs], Sun Aug 22 13:01:47 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.65: +19 -26 lines
Diff to previous 1.65 (colored) to selected 1.52 (colored)

lint: save some memory

Before lint1.h 1.47 from 2021-01-02, adjacent bit-field struct members
shared storage.  Restore that using smaller types.

No functional change.

Revision 1.65 / (download) - annotate - [select for diffs], Thu Aug 19 21:13:58 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.64: +7 -7 lines
Diff to previous 1.64 (colored) to selected 1.52 (colored)

lint: change return type of 'msb' from int to bool

No functional change.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Aug 19 20:08:25 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.63: +3 -26 lines
Diff to previous 1.63 (colored) to selected 1.52 (colored)

lint: clean up lex_integer_constant

When lexing an integer constant, it does not make sense to check for
'struct', 'void' or other types.  Furthermore, the constants were listed
in some random-looking order, which made the code hard to read.

Revision 1.63 / (download) - annotate - [select for diffs], Thu Aug 19 08:59:22 2021 UTC (2 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.62: +3 -2 lines
Diff to previous 1.62 (colored) to selected 1.52 (colored)

Add returns_nonnull attribute

Revision 1.62 / (download) - annotate - [select for diffs], Sun Aug 1 08:03:43 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.61: +9 -15 lines
Diff to previous 1.61 (colored) to selected 1.52 (colored)

lint: remove hash value from symbol buffer

Conceptually, a symbol buffer does not need to remember its hash value
since that belongs to the symbol table.  This makes the code for the
symbol table simpler.  The number of hash calculations increases by
about 5%, which is negligible.

No functional change.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Aug 1 07:46:51 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.60: +19 -17 lines
Diff to previous 1.60 (colored) to selected 1.52 (colored)

lint: merge duplicate code for removing a symbol from the table

No functional change.

Revision 1.60 / (download) - annotate - [select for diffs], Sun Aug 1 06:58:58 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.59: +30 -33 lines
Diff to previous 1.59 (colored) to selected 1.52 (colored)

lint: extract duplicate code for modifying the symbol table

No functional change.

Revision 1.59 / (download) - annotate - [select for diffs], Sun Aug 1 06:40:37 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.58: +11 -2 lines
Diff to previous 1.58 (colored) to selected 1.52 (colored)

lint: add debug logging for symbol table, clean up debug logging

When I tried to fix msg_115, I quickly ran into a segmentation fault,
probably related to the symbol table.  To better understand this part,
log insertions and deletions.

The other debug log messages do not need to mention the current file
position anymore, this is what lex_next_line takes care of since scan.l
1.113 from 2021-01-05.

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jul 31 19:07:52 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.57: +3 -5 lines
Diff to previous 1.57 (colored) to selected 1.52 (colored)

lint: clean up debug logging

The calls to debug_step, unlike printf, don't need a trailing newline.

Remove the debug_step0 macro and its relatives since lint already uses
enough other features from C99 that it essentially requires this
standard, which supports varargs macro arguments.  Among these features
are __func__ and printf("%zu").

In non-debug mode, do not evaluate the arguments of debug_step.
Evaluating the arguments had caused an internal error when running the
test op_shl_lp64.  This is indeed a bug since initdecl should have
initialized the type table for __uint128_t.  This had been forgotten
when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.

No functional change.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Jul 31 13:47:19 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.56: +14 -11 lines
Diff to previous 1.56 (colored) to selected 1.52 (colored)

lint: reduce indentation in 'search'

No functional change.

Revision 1.56 / (download) - annotate - [select for diffs], Fri Jul 23 15:36:56 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.55: +23 -21 lines
Diff to previous 1.55 (colored) to selected 1.52 (colored)

lint: write canonical form of keywords

For keywords that have a single spelling variant (such as __packed),
write this form in the source, to make it searchable.  This also avoids
a few calls to malloc.

Previously, some keywords had leading underscores and some hadn't, this
was inconsistent.

No functional change.

Revision 1.55 / (download) - annotate - [select for diffs], Sun Jul 11 19:24:41 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (colored) to selected 1.52 (colored)

lint: support __attribute__((hot))

The corresponding attribute 'cold' was already added in cgram.y 1.84
from 2016-12-29.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Jul 10 17:46:55 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored) to selected 1.52 (colored)

lint: rename y_sb to y_name

That buffer is only used for names of identifiers, so be more specific.

No functional change.

Revision 1.53 / (download) - annotate - [select for diffs], Thu Jul 8 03:10:39 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.52: +8 -9 lines
Diff to previous 1.52 (colored)

lint: remove double negation in comment

No functional change.

Revision 1.52 / (download) - annotate - [selected], Thu Jul 8 02:59:22 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.51: +4 -4 lines
Diff to previous 1.51 (colored)

lint: constify keyword in lexer

No functional change.

Revision 1.51 / (download) - annotate - [select for diffs], Tue Jul 6 20:17:15 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.50: +4 -4 lines
Diff to previous 1.50 (colored) to selected 1.52 (colored)

lint: __real__ and __imag__ are GNU extensions

https://gcc.gnu.org/onlinedocs/gcc/Complex.html

Revision 1.50 / (download) - annotate - [select for diffs], Wed Jun 30 10:25:02 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.49: +6 -18 lines
Diff to previous 1.49 (colored) to selected 1.52 (colored)

lint: inline 'sign' into convert_integer

No functional change.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Jun 29 21:16:54 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (colored) to selected 1.52 (colored)

lint: rename xsign to convert_integer

The term sign-extend was too specific, the function actually does a
broader conversion.

No functional change.

Revision 1.48 / (download) - annotate - [select for diffs], Tue Jun 29 13:48:24 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.47: +8 -5 lines
Diff to previous 1.47 (colored) to selected 1.52 (colored)

lint: clean up lex_character_constant

No functional change.

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jun 29 07:23:21 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.46: +3 -6 lines
Diff to previous 1.46 (colored) to selected 1.52 (colored)

lint: fix lexical analysis of character constants in traditional C

The code now follows the wording of the C Reference Manual from 1978.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jun 20 20:32:42 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored) to selected 1.52 (colored)

lint: rename val_t.v_unsigned to avoid confusion

The name v_unsigned suggested that the value would be interpreted as
unsigned, which was wrong.  Whether a value is signed or unsigned is
decided by v_tspec instead.

Revert the previous commit for boolen constants since their value is
already interpreted as unsigned, and there is no need for any warning
about differences between traditional C and ANSI C since the _Bool type
has only been added ten years later in C99.

The code for printing a tree node was also confused by this struct
member, even with its old name v_ansiu.  That code will be fixed in a
follow-up commit.

No functional change.

Revision 1.45 / (download) - annotate - [select for diffs], Sun Jun 20 19:04:50 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored) to selected 1.52 (colored)

lint: rename val_t.v_ansiu to v_unsigned

When lint was written in 1995, traditional C was still nearby since C90
had been around for only 5 years.  26 years later, almost all code
adheres to C90 or even C99 or C11, therefore "C90 or later" can safely
be assumed as the default.

No functional change.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Jun 20 18:44:48 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.43: +13 -13 lines
Diff to previous 1.43 (colored) to selected 1.52 (colored)

lint: fix confusing variable name in lex_wide_character_constant

By convention, i is an index, not a count.

No functional change.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jun 20 18:41:27 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.42: +21 -24 lines
Diff to previous 1.42 (colored) to selected 1.52 (colored)

lint: reduce indentation in lexer for character constants

No functional change.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jun 20 18:38:12 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored) to selected 1.52 (colored)

lint: fix check for empty wide character constant

This bug got almost 26 years old, it was already there at the initial
commit in 1995.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jun 19 20:25:58 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.40: +8 -3 lines
Diff to previous 1.40 (colored) to selected 1.52 (colored)

lint: fix endless loop on unfinished comment at EOF

Found using afl.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Jun 19 08:57:24 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.39: +6 -2 lines
Diff to previous 1.39 (colored) to selected 1.52 (colored)

lint: fix endless loop when scanning string or character literals

If the code contains an unfinished string or character literal at the
EOF, the lexer got into an endless loop.  Curiously, inpc() returned 0
in such a case instead of the common EOF.

Found by making lint1 with CC=afl-gcc and then running:

afl-fuzz \
    -m 200 \
    -i in_dir \
    -o lint1 \
    $src/usr.bin/xlint/lint1/lint1 @@ /dev/null

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jun 19 08:37:18 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored) to selected 1.52 (colored)

lint: revert fix for endless loop in lexer for string literals

String literals may contain null bytes, and these must be passed further
on.

This reintroduces the endless loop in the lexer, but that must be fixed
in another way that doesn't destroy the error handling.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Jun 18 20:29:00 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored) to selected 1.52 (colored)

lint: fix hang on unfinished string literal at end-of-file

The input file that triggered this bug was:

	a"b"c"d

Found using afl.

Revision 1.37 / (download) - annotate - [select for diffs], Tue Jun 15 20:46:45 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.36: +8 -30 lines
Diff to previous 1.36 (colored) to selected 1.52 (colored)

lint: replace array access with function calls

First and foremost, the test d_c99_complex_split accessed the array
qlmasks out-of-bounds, with an index of 128 for the type 'double
_Complex'.  This invoked undefined behavior since the maximum allowed
index was 64.

Replacing the raw array accesses with function calls allows for bounds
checks to catch these errors early.

Determining the value bits for a 'double _Complex' does not make sense
at all since it is not an integer type.  This means that lint didn't
handle these types correctly for several years.  Support for int128_t
has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex
has been added in inittyp.c 1.9 from 2008-04-26.

Determining the value bits for an int128_t would make sense, but the
unit tests don't contain examples for this type since at the moment all
unit tests must produce the same results on 32-bit and 64-bit platforms,
and the 32-bit platforms don't support int128_t.

Revision 1.36 / (download) - annotate - [select for diffs], Mon May 3 08:03:45 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.35: +4 -2 lines
Diff to previous 1.35 (colored) to selected 1.52 (colored)

lint: undefine macros for defining keywords after use

No functional change.

Revision 1.35 / (download) - annotate - [select for diffs], Mon May 3 07:30:19 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.34: +20 -18 lines
Diff to previous 1.34 (colored) to selected 1.52 (colored)

lint: remove redundancy when defining classic keywords

No functional change.

Revision 1.34 / (download) - annotate - [select for diffs], Mon May 3 07:25:08 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.33: +50 -48 lines
Diff to previous 1.33 (colored) to selected 1.52 (colored)

lint: reduce redundancy when defining GCC attributes

This macro would have prevented the unintended inconsistency in the
attribute 'pcs' (for ARM).

No functional change.  The generated code is the same, except for the
line numbers in lint_assert.

Revision 1.33 / (download) - annotate - [select for diffs], Mon May 3 07:08:54 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored) to selected 1.52 (colored)

lint: allow variables to be named 'pcs'

Revision 1.32 / (download) - annotate - [select for diffs], Mon May 3 03:46:55 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored) to selected 1.52 (colored)

lint: fix compiler warning about signedness mismatch

No functional change.

Revision 1.31 / (download) - annotate - [select for diffs], Sat May 1 00:08:44 2021 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored) to selected 1.52 (colored)

put back nonnull. I meant to just sort it.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Apr 30 19:46:24 2021 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored) to selected 1.52 (colored)

- add nonstring attribute
- allow attributes after labels (for unused)
XXX: split the attributes into function, variable, etc attributes
so that we don't accept all attributes in all places (only where they make
sense)

Revision 1.29 / (download) - annotate - [select for diffs], Tue Apr 20 21:48:39 2021 UTC (2 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored) to selected 1.52 (colored)

Add common attribute

Revision 1.28 / (download) - annotate - [select for diffs], Sun Apr 18 08:00:13 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.27: +8 -3 lines
Diff to previous 1.27 (colored) to selected 1.52 (colored)

lint: fix storage class of compound literal in initializer

A compound literal that occurs at block_level 0 does not have storage
class AUTO.  Instead, its storage class is either EXTERN or STATIC.

While removing the temporary objects from the symbol table had prevented
the assertion, it did not properly fix the underlying problem, which was
that since C99 the initializers can contain references to unnamed
objects that are created on-the-fly.  For C90 it was correct to always
use AUTO as the storage class of a temporary symbol.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Apr 12 15:55:26 2021 UTC (2 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored) to selected 1.52 (colored)

Add attribute fallthrough

Revision 1.26 / (download) - annotate - [select for diffs], Fri Apr 9 15:58:43 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (colored) to selected 1.52 (colored)

lint: clean up handling of preprocessing output lines

No functional change.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Apr 8 22:18:27 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.24: +23 -9 lines
Diff to previous 1.24 (colored) to selected 1.52 (colored)

lint: in code from included files, print stack trace

Previously, the standard NetBSD build generated several lint warnings in
lhash.h from OpenSSL, without providing any hint as to which file
actually included that header.  In cases like these, lint now interprets
the line number information in the preprocessor output from GCC to
reconstruct the exact include path to the file in question.

The program check-expect.lua had to be rewritten almost completely since
it assumed that all diagnostics would come from the main file.  In all
existing tests, this was true, but these tests did not cover all cases
that occurred in practice.  Now it records the complete location of the
diagnostic instead of just the line number.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Apr 6 22:21:53 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored) to selected 1.52 (colored)

lint: sync comment with reality after renaming several functions

No functional change.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Apr 2 22:05:43 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.22: +4 -4 lines
Diff to previous 1.22 (colored) to selected 1.52 (colored)

lint: reduce memory usage

No functional change.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Apr 2 12:16:50 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.21: +26 -26 lines
Diff to previous 1.21 (colored) to selected 1.52 (colored)

lint: add parentheses after sizeof, as required by share/misc/style

No functional change.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Mar 28 13:09:43 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored) to selected 1.52 (colored)

lint: sprinkle const on function declarations

No functional change.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Mar 27 12:42:22 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (colored) to selected 1.52 (colored)

lint: rename LERROR to INTERNAL_ERROR

The '#ifndef' in tyname.c is meant to distinguish between lint1 and
lint2, it is not meant to be defined from anywhere outside the lint code
itself.

No functional change.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Mar 27 12:32:19 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.18: +4 -4 lines
Diff to previous 1.18 (colored) to selected 1.52 (colored)

lint: rename filename management functions

No functional change.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Mar 27 11:08:00 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored) to selected 1.52 (colored)

lint: remove space between 'sizeof ('

No functional change.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Mar 26 20:31:07 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.16: +29 -26 lines
Diff to previous 1.16 (colored) to selected 1.52 (colored)

lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'

No functional change.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Mar 23 20:57:40 2021 UTC (3 years ago) by christos
Branch: MAIN
Changes since 1.15: +3 -2 lines
Diff to previous 1.15 (colored) to selected 1.52 (colored)

Add _Alignas()

Revision 1.15 / (download) - annotate - [select for diffs], Sun Mar 21 14:49:21 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored) to selected 1.52 (colored)

lint: rename functions for handling control statements

No functional change.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Mar 20 19:33:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored) to selected 1.52 (colored)

lint: make lint's own code pass the strict bool mode

No functional change.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Mar 20 19:24:56 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.12: +120 -101 lines
Diff to previous 1.12 (colored) to selected 1.52 (colored)

lint: use macro for initializing keywords table

Since today, lint's strict bool mode requires initializers to have the
correct type.  The flags in kwtab are of type bool and were initialized
with an int, for brevity.  Keep the brevity and do the conversion from
int to bool in a macro.

By defining several macros for the different kinds of keywords, reduce
the clutter of having 2 additional zeroes per line.  The macros also
remove the redundancy and thereby the possible inconsistency of filling
the wrong fields since these depend on the token type.

No functional change.  The only change to the binary is due to the
changed line numbers in the calls to lint_assert.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Mar 17 01:15:31 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.11: +16 -16 lines
Diff to previous 1.11 (colored) to selected 1.52 (colored)

lint: rename 'blklev' to 'block_level'

No functional change.

Revision 1.11 / (download) - annotate - [select for diffs], Mon Mar 1 00:51:01 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.10: +12 -9 lines
Diff to previous 1.10 (colored) to selected 1.52 (colored)

lint: only warn once about integer constant overflow on 32-bit

Previously, the test msg_056.c warned twice about the integer literal,
but only on 32-bit platforms.  On 64-bit platforms, there was only a
single warning since the integer constant was converted to type
__uint128_t, and this prevented the second warning.  On 32-bit targets,
there is no __uint128_t though.

Fixes part of PR bin/55976.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Feb 28 18:51:51 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.9: +4 -4 lines
Diff to previous 1.9 (colored) to selected 1.52 (colored)

lint: rename members and access macros of the basic types

Having the measurement unit in the variable name prevents accidental
confusion between bits and bytes, especially since usually the word
'size' means the size in bytes, while 'width' means the size in bits, at
least for integer types.

No functional change.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Feb 22 15:09:50 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored) to selected 1.52 (colored)

lint: change spelling of initialisation to initialization

That's the wording from the ISO C99 standard.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Feb 20 11:06:56 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.7: +11 -8 lines
Diff to previous 1.7 (colored) to selected 1.52 (colored)

lint: make parsing of GCC line directives stricter

The previous code accepted '# 123 "file.c" 23' as specifying a system
header, just because that number ends with '3'.  The original intention
was to compare the complete word, not its suffix.  Fix that.

No practical change since the only flags that are used by GCC are all
single-digit.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jan 24 09:44:35 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.6: +9 -7 lines
Diff to previous 1.6 (colored) to selected 1.52 (colored)

lint: fix build on Cygwin

Cygwin does not conform to C99, which says that MB_CUR_MAX has type
size_t.

Instead, Cygwin defines it as type int.  This leads to compile errors
because comparing signed with unsigned expressions is surprising in C.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jan 24 09:25:16 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.5: +18 -18 lines
Diff to previous 1.5 (colored) to selected 1.52 (colored)

lint: expand abbreviations in lexer function names

No functional change.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jan 24 07:58:48 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored) to selected 1.52 (colored)

lint: explain why !finite(x) is not allowed in strict bool mode

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jan 24 00:02:38 2021 UTC (3 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.3: +6 -2 lines
Diff to previous 1.3 (colored) to selected 1.52 (colored)

fix the build

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jan 23 23:11:40 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.2: +27 -27 lines
Diff to previous 1.2 (colored) to selected 1.52 (colored)

lint: apply strict bool mode to lex.c

There are 2 remaining expressions:

In line 244, !(kw->kw_deco & deco) is a bitwise and.  This is already
allowed for enums, it needs to be allowed for arbitrary integer
expressions as well.  This covers the many places where plain integers
are used for bit fields, together with #define.  This pattern is not as
typesafe as using enums, still it is common practice.

In line 769, the expression !finite(f) is a legitimate use of a function
that has return type int for traditional reasons.  It's the same as for
ferror.

There are several other functions like unlink, open or strcmp that have
return type int as well, but with a different meaning.  It is not yet
clear what the best way is to handle these different meanings.  Having
to write finite(f) == 0 in strict bool mode doesn't look idiomatic, on
the other hand, !strcmp(s1, s2) is exactly the pattern that strict bool
mode wants to avoid.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jan 23 18:30:29 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.1: +14 -23 lines
Diff to previous 1.1 (colored) to selected 1.52 (colored)

lint: clean up comments and variable names in lex.c

Revision 1.1 / (download) - annotate - [select for diffs], Sat Jan 23 17:58:03 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Diff to selected 1.52 (colored)

lint: move lexer code from scan.l to lex.c

Previously, the generated scan.c was not included when running "make
lint".  Similarly, cgram.c is still not included.

This form allows you to request diff's 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.




CVSweb <webmaster@jp.NetBSD.org>