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.147 / (download) - annotate - [select for diffs], Sun Jan 29 13:57:35 2023 UTC (38 hours, 16 minutes ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.146: +4 -5 lines
Diff to previous 1.146 (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 (8 days, 11 hours ago) by rillig
Branch: MAIN
Changes since 1.145: +64 -107 lines
Diff to previous 1.145 (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 (8 days, 12 hours ago) by rillig
Branch: MAIN
Changes since 1.144: +10 -8 lines
Diff to previous 1.144 (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 (9 days, 6 hours ago) by rillig
Branch: MAIN
Changes since 1.143: +10 -11 lines
Diff to previous 1.143 (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 (9 days, 10 hours ago) by rillig
Branch: MAIN
Changes since 1.142: +39 -59 lines
Diff to previous 1.142 (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 (9 days, 14 hours ago) by rillig
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (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 (9 days, 15 hours ago) by rillig
Branch: MAIN
Changes since 1.140: +4 -2 lines
Diff to previous 1.140 (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 (9 days, 17 hours ago) by rillig
Branch: MAIN
Changes since 1.139: +12 -12 lines
Diff to previous 1.139 (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 (9 days, 18 hours ago) by rillig
Branch: MAIN
Changes since 1.138: +19 -20 lines
Diff to previous 1.138 (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 (9 days, 18 hours ago) by rillig
Branch: MAIN
Changes since 1.137: +48 -49 lines
Diff to previous 1.137 (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 (9 days, 18 hours ago) by rillig
Branch: MAIN
Changes since 1.136: +68 -59 lines
Diff to previous 1.136 (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 (9 days, 19 hours ago) by rillig
Branch: MAIN
Changes since 1.135: +60 -47 lines
Diff to previous 1.135 (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 (3 weeks, 1 day ago) by rillig
Branch: MAIN
Changes since 1.134: +20 -18 lines
Diff to previous 1.134 (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 (4 months ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10
Changes since 1.133: +9 -11 lines
Diff to previous 1.133 (colored)

lint: miscellaneous cleanup

No functional change.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Aug 25 19:03:47 2022 UTC (5 months ago) by rillig
Branch: MAIN
Changes since 1.132: +18 -78 lines
Diff to previous 1.132 (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 (7 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.131: +17 -17 lines
Diff to previous 1.131 (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 (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.130: +3 -3 lines
Diff to previous 1.130 (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 (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (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 (8 months, 3 weeks ago) by christos
Branch: MAIN
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored)

gcc also allows __alignof

Revision 1.128 / (download) - annotate - [select for diffs], Sat Apr 30 22:31:23 2022 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.127: +10 -6 lines
Diff to previous 1.127 (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 (9 months ago) by rillig
Branch: MAIN
Changes since 1.126: +13 -13 lines
Diff to previous 1.126 (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 (9 months ago) by rillig
Branch: MAIN
Changes since 1.125: +27 -9 lines
Diff to previous 1.125 (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 (9 months ago) by rillig
Branch: MAIN
Changes since 1.124: +12 -5 lines
Diff to previous 1.124 (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 (9 months ago) by rillig
Branch: MAIN
Changes since 1.123: +53 -53 lines
Diff to previous 1.123 (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 (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.122: +5 -5 lines
Diff to previous 1.122 (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 (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.121: +58 -55 lines
Diff to previous 1.121 (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 (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.120: +7 -6 lines
Diff to previous 1.120 (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 (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.119: +47 -47 lines
Diff to previous 1.119 (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 (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.118: +3 -3 lines
Diff to previous 1.118 (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 (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.117: +3 -3 lines
Diff to previous 1.117 (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 (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.116: +8 -8 lines
Diff to previous 1.116 (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 (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.115: +6 -6 lines
Diff to previous 1.115 (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 (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.114: +5 -4 lines
Diff to previous 1.114 (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 (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (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 (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.112: +24 -21 lines
Diff to previous 1.112 (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 (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.111: +6 -6 lines
Diff to previous 1.111 (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 (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.110: +14 -11 lines
Diff to previous 1.110 (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 (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (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 (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.108: +3 -3 lines
Diff to previous 1.108 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.107: +2 -4 lines
Diff to previous 1.107 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.106: +67 -16 lines
Diff to previous 1.106 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.105: +4 -4 lines
Diff to previous 1.105 (colored)

lint: constify lexer keywords

No functional change.

Revision 1.105 / (download) - annotate - [select for diffs], Sun Feb 27 22:46:04 2022 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.104: +41 -42 lines
Diff to previous 1.104 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.103: +55 -55 lines
Diff to previous 1.103 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.102: +7 -12 lines
Diff to previous 1.102 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.101: +17 -17 lines
Diff to previous 1.101 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.100: +12 -12 lines
Diff to previous 1.100 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.99: +7 -45 lines
Diff to previous 1.99 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (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 (11 months ago) by rillig
Branch: MAIN
Changes since 1.97: +25 -12 lines
Diff to previous 1.97 (colored)

lint: improve debug logging for symbol kinds

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

Add clang's optnone attribute.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Dec 25 13:51:42 2021 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.95: +3 -3 lines
Diff to previous 1.95 (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 (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.94: +4 -14 lines
Diff to previous 1.94 (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 (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.93: +38 -41 lines
Diff to previous 1.93 (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 (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.92: +9 -9 lines
Diff to previous 1.92 (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 (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.91: +14 -14 lines
Diff to previous 1.91 (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 (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.90: +4 -4 lines
Diff to previous 1.90 (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 (13 months, 2 weeks ago) by christos
Branch: MAIN
Changes since 1.89: +6 -2 lines
Diff to previous 1.89 (colored)

Add more attributes

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

Improve restrict handling.

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

Add target attribute

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 16 18:33:14 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.86: +7 -6 lines
Diff to previous 1.86 (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 (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.85: +5 -6 lines
Diff to previous 1.85 (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 (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.84: +6 -4 lines
Diff to previous 1.84 (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 (16 months, 1 week ago) by jmcneill
Branch: MAIN
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (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 (16 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (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 (16 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.81: +3 -2 lines
Diff to previous 1.81 (colored)

remove the lint kludges

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

lint: fix lint warnings

Revision 1.80 / (download) - annotate - [select for diffs], Sun Aug 29 09:29:32 2021 UTC (17 months ago) by rillig
Branch: MAIN
Changes since 1.79: +6 -3 lines
Diff to previous 1.79 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.78: +7 -3 lines
Diff to previous 1.78 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.77: +5 -5 lines
Diff to previous 1.77 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.76: +6 -34 lines
Diff to previous 1.76 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.75: +4 -4 lines
Diff to previous 1.75 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.74: +6 -3 lines
Diff to previous 1.74 (colored)

lint: replace obsolete strtouq with equivalent strtoull

Revision 1.74 / (download) - annotate - [select for diffs], Sat Aug 28 15:01:43 2021 UTC (17 months ago) by rillig
Branch: MAIN
Changes since 1.73: +4 -10 lines
Diff to previous 1.73 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.71: +7 -7 lines
Diff to previous 1.71 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.70: +9 -9 lines
Diff to previous 1.70 (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 (17 months ago) by rillig
Branch: MAIN
Changes since 1.69: +3 -2 lines
Diff to previous 1.69 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.68: +2 -9 lines
Diff to previous 1.68 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.67: +5 -7 lines
Diff to previous 1.67 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.66: +6 -6 lines
Diff to previous 1.66 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.65: +19 -26 lines
Diff to previous 1.65 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.64: +7 -7 lines
Diff to previous 1.64 (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 (17 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.63: +3 -26 lines
Diff to previous 1.63 (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 (17 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.62: +3 -2 lines
Diff to previous 1.62 (colored)

Add returns_nonnull attribute

Revision 1.62 / (download) - annotate - [select for diffs], Sun Aug 1 08:03:43 2021 UTC (18 months ago) by rillig
Branch: MAIN
Changes since 1.61: +9 -15 lines
Diff to previous 1.61 (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 (18 months ago) by rillig
Branch: MAIN
Changes since 1.60: +19 -17 lines
Diff to previous 1.60 (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 (18 months ago) by rillig
Branch: MAIN
Changes since 1.59: +30 -33 lines
Diff to previous 1.59 (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 (18 months ago) by rillig
Branch: MAIN
Changes since 1.58: +11 -2 lines
Diff to previous 1.58 (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 (18 months ago) by rillig
Branch: MAIN
Changes since 1.57: +3 -5 lines
Diff to previous 1.57 (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 (18 months ago) by rillig
Branch: MAIN
Changes since 1.56: +14 -11 lines
Diff to previous 1.56 (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 (18 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.55: +23 -21 lines
Diff to previous 1.55 (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 (18 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (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 (18 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (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 (18 months, 3 weeks 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 - [select for diffs], Thu Jul 8 02:59:22 2021 UTC (18 months, 3 weeks 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 (18 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.50: +4 -4 lines
Diff to previous 1.50 (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 (19 months ago) by rillig
Branch: MAIN
Changes since 1.49: +6 -18 lines
Diff to previous 1.49 (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 (19 months ago) by rillig
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (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 (19 months ago) by rillig
Branch: MAIN
Changes since 1.47: +8 -5 lines
Diff to previous 1.47 (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 (19 months ago) by rillig
Branch: MAIN
Changes since 1.46: +3 -6 lines
Diff to previous 1.46 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.43: +13 -13 lines
Diff to previous 1.43 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.42: +21 -24 lines
Diff to previous 1.42 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.40: +8 -3 lines
Diff to previous 1.40 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.39: +6 -2 lines
Diff to previous 1.39 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (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 (19 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (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 (19 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.36: +8 -30 lines
Diff to previous 1.36 (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 (20 months, 4 weeks 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)

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 (20 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.34: +20 -18 lines
Diff to previous 1.34 (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 (20 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.33: +50 -48 lines
Diff to previous 1.33 (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 (20 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

lint: allow variables to be named 'pcs'

Revision 1.32 / (download) - annotate - [select for diffs], Mon May 3 03:46:55 2021 UTC (20 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (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 (21 months ago) by christos
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (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 (21 months ago) by christos
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (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 (21 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

Add common attribute

Revision 1.28 / (download) - annotate - [select for diffs], Sun Apr 18 08:00:13 2021 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.27: +8 -3 lines
Diff to previous 1.27 (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 (21 months, 2 weeks ago) by christos
Branch: MAIN
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored)

Add attribute fallthrough

Revision 1.26 / (download) - annotate - [select for diffs], Fri Apr 9 15:58:43 2021 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (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 (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.24: +23 -9 lines
Diff to previous 1.24 (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 (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (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 (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.22: +4 -4 lines
Diff to previous 1.22 (colored)

lint: reduce memory usage

No functional change.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Apr 2 12:16:50 2021 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.21: +26 -26 lines
Diff to previous 1.21 (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 (22 months ago) by rillig
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (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 (22 months ago) by rillig
Branch: MAIN
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (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 (22 months ago) by rillig
Branch: MAIN
Changes since 1.18: +4 -4 lines
Diff to previous 1.18 (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 (22 months ago) by rillig
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (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 (22 months ago) by rillig
Branch: MAIN
Changes since 1.16: +29 -26 lines
Diff to previous 1.16 (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 (22 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.15: +3 -2 lines
Diff to previous 1.15 (colored)

Add _Alignas()

Revision 1.15 / (download) - annotate - [select for diffs], Sun Mar 21 14:49:21 2021 UTC (22 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (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 (22 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (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 (22 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.12: +120 -101 lines
Diff to previous 1.12 (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 (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.11: +16 -16 lines
Diff to previous 1.11 (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 (23 months ago) by rillig
Branch: MAIN
Changes since 1.10: +12 -9 lines
Diff to previous 1.10 (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 (23 months ago) by rillig
Branch: MAIN
Changes since 1.9: +4 -4 lines
Diff to previous 1.9 (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 (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (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 (23 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.7: +11 -8 lines
Diff to previous 1.7 (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 (2 years ago) by rillig
Branch: MAIN
Changes since 1.6: +9 -7 lines
Diff to previous 1.6 (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 (2 years ago) by rillig
Branch: MAIN
Changes since 1.5: +18 -18 lines
Diff to previous 1.5 (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 (2 years ago) by rillig
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (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 (2 years ago) by christos
Branch: MAIN
Changes since 1.3: +6 -2 lines
Diff to previous 1.3 (colored)

fix the build

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jan 23 23:11:40 2021 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.2: +27 -27 lines
Diff to previous 1.2 (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 (2 years ago) by rillig
Branch: MAIN
Changes since 1.1: +14 -23 lines
Diff to previous 1.1 (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 (2 years ago) by rillig
Branch: MAIN

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>