The NetBSD Project

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

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.635 / (download) - annotate - [select for diffs], Fri Apr 12 05:44:38 2024 UTC (6 days, 20 hours ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.634: +6 -3 lines
Diff to previous 1.634 (colored) to selected 1.470 (colored)

lint: clean up and speed up the check for snprintb

Revision 1.634 / (download) - annotate - [select for diffs], Sun Mar 31 20:28:45 2024 UTC (2 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.633: +11 -12 lines
Diff to previous 1.633 (colored) to selected 1.470 (colored)

lint: merge function call operators 'CALL' and 'ICALL'

Revision 1.633 / (download) - annotate - [select for diffs], Sat Mar 30 19:12:37 2024 UTC (2 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.632: +3 -3 lines
Diff to previous 1.632 (colored) to selected 1.470 (colored)

lint: in the query about implicit conversions, ignore casts

Revision 1.632 / (download) - annotate - [select for diffs], Sat Mar 30 17:23:13 2024 UTC (2 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.631: +7 -3 lines
Diff to previous 1.631 (colored) to selected 1.470 (colored)

lint: add query for implicit integer-to-floating conversion

Revision 1.631 / (download) - annotate - [select for diffs], Sat Mar 30 17:12:26 2024 UTC (2 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.630: +11 -8 lines
Diff to previous 1.630 (colored) to selected 1.470 (colored)

lint: do not convert array subscripts from size_t to ptrdiff_t

The C standards do not specify a fixed type for an array subscript, it
just has to be an integer type.  Previously, query 4 fired for the
ubiquitous expression 'ptr[sz]' when sz had type 'size_t'.

The test platform_ilp32_long is unaffected by this change, as the
integer constant 0x80000000 has type 'unsigned int', while size_t is
'unsigned long' on those platforms, and even though the types 'unsigned
int' and 'unsigned long' have the same value space, there's still a
conversion, at least for now.

Revision 1.630 / (download) - annotate - [select for diffs], Sat Mar 30 16:47:44 2024 UTC (2 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.629: +5 -5 lines
Diff to previous 1.629 (colored) to selected 1.470 (colored)

lint: reword messages about array subscripts to sound more natural

Revision 1.629 / (download) - annotate - [select for diffs], Fri Mar 29 08:35:32 2024 UTC (2 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.628: +4 -4 lines
Diff to previous 1.628 (colored) to selected 1.470 (colored)

lint: clean up

Revision 1.628 / (download) - annotate - [select for diffs], Wed Mar 27 20:09:43 2024 UTC (3 weeks, 1 day ago) by rillig
Branch: MAIN
Changes since 1.627: +7 -8 lines
Diff to previous 1.627 (colored) to selected 1.470 (colored)

lint: clean up; extend overflow test

Revision 1.627 / (download) - annotate - [select for diffs], Wed Mar 27 19:28:20 2024 UTC (3 weeks, 1 day ago) by rillig
Branch: MAIN
Changes since 1.626: +6 -6 lines
Diff to previous 1.626 (colored) to selected 1.470 (colored)

lint: don't use 'long' in diagnostics

The size of 'long' differs between 64-bit and 32-bit platforms.
Eliminate this possible platform-dependency.

Revision 1.626 / (download) - annotate - [select for diffs], Mon Mar 25 23:39:13 2024 UTC (3 weeks, 3 days ago) by rillig
Branch: MAIN
Changes since 1.625: +9 -2 lines
Diff to previous 1.625 (colored) to selected 1.470 (colored)

lint: fix warnings about loss of accuracy on bit-field operations

Revision 1.625 / (download) - annotate - [select for diffs], Tue Mar 19 23:19:04 2024 UTC (4 weeks, 2 days ago) by rillig
Branch: MAIN
Changes since 1.624: +25 -45 lines
Diff to previous 1.624 (colored) to selected 1.470 (colored)

lint: keep invalid arguments in function calls

Previously, arguments of incomplete type or 'void' cleared all arguments
of the function call expression, requiring extra checks in later checks.

Invalid function calls are now exported to the .ln files, but that's
irrelevant in practice as these invalid function calls make lint1 fail,
after which xlint removes the .ln file.

Revision 1.624 / (download) - annotate - [select for diffs], Tue Mar 12 07:56:08 2024 UTC (5 weeks, 2 days ago) by rillig
Branch: MAIN
Changes since 1.623: +15 -8 lines
Diff to previous 1.623 (colored) to selected 1.470 (colored)

lint: fix warning about loss of conversion for unsigned bit-fields

Since decl.c 1.180 from 2021-05-02.

Revision 1.623 / (download) - annotate - [select for diffs], Sun Mar 10 19:45:14 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.622: +31 -6 lines
Diff to previous 1.622 (colored) to selected 1.470 (colored)

lint: add details to the message about integer overflow

Having only the operator was too unspecific to be actionable, so add the
actual numbers and the data type.

Revision 1.622 / (download) - annotate - [select for diffs], Sun Mar 10 16:06:13 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.621: +3 -3 lines
Diff to previous 1.621 (colored) to selected 1.470 (colored)

lint: saturate signed integer overflow

In array address calculations, this prevents a 'array subscript cannot
be negative' for large array subscripts.

Revision 1.621 / (download) - annotate - [select for diffs], Sun Mar 10 15:49:12 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.620: +31 -37 lines
Diff to previous 1.620 (colored) to selected 1.470 (colored)

lint: fix integer overflow detection

Previously, an unsigned operation that had a negative result went
undetected in a few cases. Now, all results that are not representable
by their type are considered overflows.

The implementation of signed shift-right had been wrong for a few
commits.

Revision 1.620 / (download) - annotate - [select for diffs], Sun Mar 10 14:42:04 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.619: +17 -24 lines
Diff to previous 1.619 (colored) to selected 1.470 (colored)

lint: clean up check for overflow in integer constants

Revision 1.619 / (download) - annotate - [select for diffs], Sun Mar 10 14:32:30 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.618: +24 -27 lines
Diff to previous 1.618 (colored) to selected 1.470 (colored)

lint: detect more cases of integer overflow in constant expressions

For unsigned integers, detect when 'a + b' wraps around.

Revision 1.618 / (download) - annotate - [select for diffs], Sun Mar 10 12:50:45 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.617: +174 -115 lines
Diff to previous 1.617 (colored) to selected 1.470 (colored)

lint: split integer overflow check into separate functions

The checks for unsigned and signed integers differ for each operator, so
there's no point having both parts in the same function.

Revision 1.617 / (download) - annotate - [select for diffs], Sun Mar 10 10:31:29 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.616: +10 -8 lines
Diff to previous 1.616 (colored) to selected 1.470 (colored)

lint: remove wrong warning about overflow in unary '-' for unsigned

Revision 1.616 / (download) - annotate - [select for diffs], Sun Mar 10 10:15:51 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.615: +17 -5 lines
Diff to previous 1.615 (colored) to selected 1.470 (colored)

lint: fix integer overflow in integer overflow check

Revision 1.615 / (download) - annotate - [select for diffs], Sun Mar 10 09:24:54 2024 UTC (5 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.614: +8 -8 lines
Diff to previous 1.614 (colored) to selected 1.470 (colored)

lint: in check for integer overflow, sort operators

Revision 1.614 / (download) - annotate - [select for diffs], Sat Mar 9 23:55:11 2024 UTC (5 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.613: +7 -7 lines
Diff to previous 1.613 (colored) to selected 1.470 (colored)

lint: fix excessive overflow warning after division by zero

Revision 1.613 / (download) - annotate - [select for diffs], Sat Mar 9 14:54:14 2024 UTC (5 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.612: +25 -50 lines
Diff to previous 1.612 (colored) to selected 1.470 (colored)

lint: merge duplicate code for checking array index

Revision 1.612 / (download) - annotate - [select for diffs], Sat Mar 9 13:54:47 2024 UTC (5 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.611: +188 -186 lines
Diff to previous 1.611 (colored) to selected 1.470 (colored)

lint: inline accessor macros for tnode_t

Revision 1.611 / (download) - annotate - [select for diffs], Sat Mar 9 13:20:55 2024 UTC (5 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.610: +30 -30 lines
Diff to previous 1.610 (colored) to selected 1.470 (colored)

lint: inline accessor macros for type_t

Revision 1.610 / (download) - annotate - [select for diffs], Sat Mar 9 10:47:16 2024 UTC (5 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.609: +3 -3 lines
Diff to previous 1.609 (colored) to selected 1.470 (colored)

lint: remove unneeded checks for left and right operands

Revision 1.609 / (download) - annotate - [select for diffs], Sun Mar 3 16:09:01 2024 UTC (6 weeks, 4 days ago) by rillig
Branch: MAIN
Changes since 1.608: +3 -3 lines
Diff to previous 1.608 (colored) to selected 1.470 (colored)

lint: clean up string parsing and snprintb check

Revision 1.608 / (download) - annotate - [select for diffs], Sun Mar 3 00:50:41 2024 UTC (6 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.607: +8 -2 lines
Diff to previous 1.607 (colored) to selected 1.470 (colored)

lint: check for unreachable bits and fields in snprintb formats

While here, clean up a few existing checks.

Revision 1.607 / (download) - annotate - [select for diffs], Fri Mar 1 21:52:48 2024 UTC (6 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.606: +3 -3 lines
Diff to previous 1.606 (colored) to selected 1.470 (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.606 / (download) - annotate - [select for diffs], Fri Mar 1 19:39:28 2024 UTC (6 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.605: +3 -2 lines
Diff to previous 1.605 (colored) to selected 1.470 (colored)

lint: test format strings from snprintb calls

The functions snprintb and snprintb_m are specific to NetBSD, and their
format strings are tricky to get correct.  Provide some assistance in
catching the most common mistakes.

Revision 1.605 / (download) - annotate - [select for diffs], Thu Feb 8 20:59:19 2024 UTC (2 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.604: +20 -29 lines
Diff to previous 1.604 (colored) to selected 1.470 (colored)

lint: clean up variable names, parameter order, comments

No functional change.

Revision 1.604 / (download) - annotate - [select for diffs], Thu Feb 8 20:45:20 2024 UTC (2 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.603: +67 -96 lines
Diff to previous 1.603 (colored) to selected 1.470 (colored)

lint: clean up redundant braces

No functional change.

Revision 1.603 / (download) - annotate - [select for diffs], Mon Feb 5 23:11:22 2024 UTC (2 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.602: +83 -77 lines
Diff to previous 1.602 (colored) to selected 1.470 (colored)

lint: make function call arguments directly accessible

Previously, the arguments of a function call expression were arranged in
a linear tree structure, from right to left.  To allow easier access to
the arguments, store them in an array instead.

Revision 1.602 / (download) - annotate - [select for diffs], Sat Feb 3 19:25:16 2024 UTC (2 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.601: +17 -12 lines
Diff to previous 1.601 (colored) to selected 1.470 (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.601 / (download) - annotate - [select for diffs], Thu Feb 1 21:19:13 2024 UTC (2 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.600: +5 -3 lines
Diff to previous 1.600 (colored) to selected 1.470 (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.600 / (download) - annotate - [select for diffs], Thu Feb 1 18:37:06 2024 UTC (2 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.599: +18 -23 lines
Diff to previous 1.599 (colored) to selected 1.470 (colored)

lint: use standard buffer for storing string values

No functional change.

Revision 1.599 / (download) - annotate - [select for diffs], Mon Jan 29 21:30:25 2024 UTC (2 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.598: +13 -12 lines
Diff to previous 1.598 (colored) to selected 1.470 (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.598 / (download) - annotate - [select for diffs], Tue Jan 23 20:03:42 2024 UTC (2 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.597: +9 -9 lines
Diff to previous 1.597 (colored) to selected 1.470 (colored)

lint: unconst parameters

These were leftovers from earlier refactorings and are no longer needed.

No binary change.

Revision 1.597 / (download) - annotate - [select for diffs], Tue Jan 23 19:44:28 2024 UTC (2 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.596: +10 -10 lines
Diff to previous 1.596 (colored) to selected 1.470 (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.596 / (download) - annotate - [select for diffs], Sun Jan 21 14:21:34 2024 UTC (2 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.595: +9 -9 lines
Diff to previous 1.595 (colored) to selected 1.470 (colored)

lint: clean up redundant const from parameters and local variables

These were leftovers from splitting large functions into smaller
functions, to ensure that variables were not unintentionally reassigned.
Those refactorings are finished, and the extra help from the compiler is
no longer necessary.

No binary change.

Revision 1.595 / (download) - annotate - [select for diffs], Thu Jan 11 23:26:39 2024 UTC (3 months ago) by rillig
Branch: MAIN
Changes since 1.594: +3 -3 lines
Diff to previous 1.594 (colored) to selected 1.470 (colored)

lint: clean up enum constants for designators

In intializers and offsetof, both struct and union members are handled
in the same way, thus there is no need to distinguish them.

Revision 1.594 / (download) - annotate - [select for diffs], Thu Jan 11 23:06:19 2024 UTC (3 months ago) by rillig
Branch: MAIN
Changes since 1.593: +7 -10 lines
Diff to previous 1.593 (colored) to selected 1.470 (colored)

lint: correctly set system-header flag on cast-expression

When a cast-expression comes partly from a system header, determine at
the ')' whether the whole cast-expression comes from the system header.
Previously, it was based on the operand, which contradicted the
documentation of tn_sys.

Mainly affects strict bool mode (where expressions from system headers
are handled more leniently), as well as query 9 for parenthesized return
expressions.

Discovered upon manual inspection, as calling expr_alloc_tnode should
never be necessary when creating an expression node with operands;
there's build_op for that purpose.

Revision 1.593 / (download) - annotate - [select for diffs], Thu Jan 11 20:25:04 2024 UTC (3 months ago) by rillig
Branch: MAIN
Changes since 1.592: +10 -5 lines
Diff to previous 1.592 (colored) to selected 1.470 (colored)

lint: warn about integer overflow when folding constant INT_MIN / -1

Revision 1.592 / (download) - annotate - [select for diffs], Tue Jan 9 23:46:54 2024 UTC (3 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.591: +25 -9 lines
Diff to previous 1.591 (colored) to selected 1.470 (colored)

lint: allow complex offsetof(type, member-designator)

Both GCC 11 and Clang 8 accept member-designators that are not
identifiers but designator sequences, such as in 'offsetof(struct stat,
st_atim.tv_sec)', so make lint accept them as well.

Revision 1.591 / (download) - annotate - [select for diffs], Sun Jan 7 12:43:16 2024 UTC (3 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.590: +3 -3 lines
Diff to previous 1.590 (colored) to selected 1.470 (colored)

lint: fix crash for invalid __func__ (since 2023-01-29)

Revision 1.590 / (download) - annotate - [select for diffs], Sun Jan 7 12:20:42 2024 UTC (3 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.589: +7 -7 lines
Diff to previous 1.589 (colored) to selected 1.470 (colored)

lint: fix memory allocation names, eliminate double negation

Revision 1.589 / (download) - annotate - [select for diffs], Sat Jan 6 15:05:24 2024 UTC (3 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.588: +27 -46 lines
Diff to previous 1.588 (colored) to selected 1.470 (colored)

lint: remove redundant parentheses, braces and comments

Rename the functions for folding constant expressions, to make the
comments redundant.

Revision 1.588 / (download) - annotate - [select for diffs], Sat Jan 6 14:21:26 2024 UTC (3 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.587: +2 -120 lines
Diff to previous 1.587 (colored) to selected 1.470 (colored)

lint: remove redundant comments

Revision 1.587 / (download) - annotate - [select for diffs], Sun Dec 3 18:17:41 2023 UTC (4 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.586: +5 -5 lines
Diff to previous 1.586 (colored) to selected 1.470 (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.586 / (download) - annotate - [select for diffs], Sun Dec 3 13:12:40 2023 UTC (4 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.585: +77 -82 lines
Diff to previous 1.585 (colored) to selected 1.470 (colored)

lint: re-wrap comments

No functional change.

Revision 1.585 / (download) - annotate - [select for diffs], Sun Dec 3 12:24:49 2023 UTC (4 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.584: +4 -3 lines
Diff to previous 1.584 (colored) to selected 1.470 (colored)

lint: move function body brace to the left

No functional change.

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

lint: indent statement continuations consistently

No binary change.

Revision 1.583 / (download) - annotate - [select for diffs], Sat Dec 2 21:53:15 2023 UTC (4 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.582: +31 -20 lines
Diff to previous 1.582 (colored) to selected 1.470 (colored)

lint: extract nonportable char comparison to separate function

No functional change.

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

lint: rename NOSCL to NO_SCL

For symmetry with NO_TSPEC.  No functional change.

Revision 1.581 / (download) - annotate - [select for diffs], Wed Sep 13 20:31:58 2023 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.580: +23 -20 lines
Diff to previous 1.580 (colored) to selected 1.470 (colored)

lint: prevent invalid memory access when checking an expression

In check_expr_misc, the left and right operands of an expression were
accessed even in the case of CON (constant), STRING (string literal) and
NAME (identifier), which led to invalid values in pointer variables.
These invalid values were not used though, but technically they invoked
undefined behavior.

Precede each access to the operands with a check that the expression
indeed has operands, except in those cases where the operand is known to
have operands by only looking at the code of the current function.

Revision 1.580 / (download) - annotate - [select for diffs], Tue Sep 12 22:01:05 2023 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.579: +3 -3 lines
Diff to previous 1.579 (colored) to selected 1.470 (colored)

lint: mark unreachable function call arguments as used as well

Previously, in a '?:' expression with a constant condition, the branch
that is not taken was skipped but any identifiers in there were intended
to be marked as used.  In function call expressions, this only worked
for the last argument, as the PUSH operator is not a binary operator
(see ops.def).  Cover this case as well.

Revision 1.579 / (download) - annotate - [select for diffs], Tue Sep 12 07:23:27 2023 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.578: +23 -2 lines
Diff to previous 1.578 (colored) to selected 1.470 (colored)

lint: mark symbols that are only used in untaken '?:' branch as used

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

lint: make diagnostics about ANSI C more international

Revision 1.577 / (download) - annotate - [select for diffs], Tue Aug 8 20:15:10 2023 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.576: +24 -11 lines
Diff to previous 1.576 (colored) to selected 1.470 (colored)

lint: in -a mode, do not warn about integer conversions from 'int'

Since tree.c 1.552 from 2023-07-08, lint warned about integer
conversions from 'int' or 'unsigned int' to smaller integer types.  This
only affected 32-bit platforms where size_t is 'unsigned int' rather
than 'unsigned long', as on these platforms, the integer ranks of 'int'
and 'long' are the same, see INT_RANK in inittyp.c.

Discovered by lib/libkvm, which fails on i386 when lint generates any
warnings.

Revision 1.576 / (download) - annotate - [select for diffs], Sat Aug 5 10:13:39 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.575: +15 -6 lines
Diff to previous 1.575 (colored) to selected 1.470 (colored)

lint: implement __builtin_offsetof for the simplest cases

Cases not covered:
1. C99 allows designators in the offsetof macro.
2. For packed types, the offset is likely to be incorrect.

Revision 1.575 / (download) - annotate - [select for diffs], Wed Aug 2 18:57:54 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.574: +3 -3 lines
Diff to previous 1.574 (colored) to selected 1.470 (colored)

lint: fix plural form in message 150

Revision 1.574 / (download) - annotate - [select for diffs], Wed Aug 2 18:51:25 2023 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.573: +22 -23 lines
Diff to previous 1.573 (colored) to selected 1.470 (colored)

lint: distinguish between arguments and parameters

Revision 1.573 / (download) - annotate - [select for diffs], Sat Jul 15 15:51:22 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.572: +12 -23 lines
Diff to previous 1.572 (colored) to selected 1.470 (colored)

lint: clean up duplicate code for finding struct/union members

Revision 1.572 / (download) - annotate - [select for diffs], Sat Jul 15 15:38:03 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.571: +4 -2 lines
Diff to previous 1.571 (colored) to selected 1.470 (colored)

lint: properly initialize unnamed struct/union members

Previously, their 'containing type' was not initialized.  The code for
initializing them is adapted from declarator_name.

Revision 1.571 / (download) - annotate - [select for diffs], Sat Jul 15 14:54:31 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.570: +7 -7 lines
Diff to previous 1.570 (colored) to selected 1.470 (colored)

lint: fix member lookup after GCC statement expression

Revision 1.570 / (download) - annotate - [select for diffs], Sat Jul 15 14:50:47 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.569: +28 -22 lines
Diff to previous 1.569 (colored) to selected 1.470 (colored)

lint: split struct_or_union_member into separate parts

Revision 1.569 / (download) - annotate - [select for diffs], Sat Jul 15 13:51:36 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.568: +8 -2 lines
Diff to previous 1.568 (colored) to selected 1.470 (colored)

lint: fix use-after-free bug in GCC statement expressions

Revision 1.568 / (download) - annotate - [select for diffs], Sat Jul 15 13:35:24 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.567: +10 -9 lines
Diff to previous 1.567 (colored) to selected 1.470 (colored)

lint: add detailed logging for finding memory allocation bugs

Revision 1.567 / (download) - annotate - [select for diffs], Sat Jul 15 12:24:57 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.566: +15 -5 lines
Diff to previous 1.566 (colored) to selected 1.470 (colored)

tests/lint: demonstrate use-after-free in GCC statement expression

Revision 1.566 / (download) - annotate - [select for diffs], Fri Jul 14 09:20:23 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.565: +7 -16 lines
Diff to previous 1.565 (colored) to selected 1.470 (colored)

lint: clean up redundant and verbose code

Revision 1.565 / (download) - annotate - [select for diffs], Fri Jul 14 09:04:08 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.564: +25 -25 lines
Diff to previous 1.564 (colored) to selected 1.470 (colored)

lint: rename function for creating a new expression node

Revision 1.564 / (download) - annotate - [select for diffs], Fri Jul 14 08:53:52 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.563: +12 -9 lines
Diff to previous 1.563 (colored) to selected 1.470 (colored)

lint: clean up comments, add a test for the '?:' operator

Revision 1.563 / (download) - annotate - [select for diffs], Thu Jul 13 08:40:38 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.562: +3 -3 lines
Diff to previous 1.562 (colored) to selected 1.470 (colored)

lint: indent copyright lines consistently

Revision 1.562 / (download) - annotate - [select for diffs], Thu Jul 13 06:41:27 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.561: +5 -5 lines
Diff to previous 1.561 (colored) to selected 1.470 (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.561 / (download) - annotate - [select for diffs], Wed Jul 12 19:34:01 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.560: +7 -10 lines
Diff to previous 1.560 (colored) to selected 1.470 (colored)

lint: clean up handling of __real__ and __imag__

These two operatos are not binary, therefore they don't need a right
operand.  The questionable operands were a copy-and-paste mistake, as
the code was taken from the ++ and -- operands (tree.c 1.46 from
2008-04-25).  The ++ and -- operands aren't binary either, but since
lint represents address calculations in their premultiplied form, the
expression ptr++ contains a hidden right operand specifying the number
of bytes by which to increment the pointer.

Creating an integer-constant-expression node with type 'long double'
didn't make sense either.  Luckily, these expressions are only built but
not analyzed any further.

Revision 1.560 / (download) - annotate - [select for diffs], Mon Jul 10 19:47:12 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.559: +44 -59 lines
Diff to previous 1.559 (colored) to selected 1.470 (colored)

lint: merge duplicate code for getting the name of an operator

Revision 1.559 / (download) - annotate - [select for diffs], Mon Jul 10 09:51:30 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.558: +3 -3 lines
Diff to previous 1.558 (colored) to selected 1.470 (colored)

lint: clean up wchar_t and hash tables

Revision 1.558 / (download) - annotate - [select for diffs], Sun Jul 9 12:04:08 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.557: +5 -7 lines
Diff to previous 1.557 (colored) to selected 1.470 (colored)

lint: in the warning about ordered enums, mention the affected type

Revision 1.557 / (download) - annotate - [select for diffs], Sun Jul 9 11:18:55 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.556: +3 -3 lines
Diff to previous 1.556 (colored) to selected 1.470 (colored)

lint: clean up wording in diagnostics

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

Revision 1.556 / (download) - annotate - [select for diffs], Sun Jul 9 11:01:27 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.555: +6 -6 lines
Diff to previous 1.555 (colored) to selected 1.470 (colored)

lint: clean up the wording of a few diagnostics

Revision 1.555 / (download) - annotate - [select for diffs], Sun Jul 9 10:42:07 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.554: +3 -3 lines
Diff to previous 1.554 (colored) to selected 1.470 (colored)

lint: remove redundant '#' after 'argument' in diagnostics

Revision 1.554 / (download) - annotate - [select for diffs], Sat Jul 8 16:13:00 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.553: +13 -8 lines
Diff to previous 1.553 (colored) to selected 1.470 (colored)

lint: warn about pointer casts between different kinds of types

Pointer casts from an integer type to a floating-point type and vice
versa get a 'maybe troublesome' warning now.  The previous assumption
that all types of the same bit-size are convertible may have been valid
from a technical point of view, but still such code should get more
attention.

The rules for struct and union types could be made more fine-grained
later, if the need arises.  To suppress this warning, it's always
possible to cast to an intermediate 'void *'.

Revision 1.553 / (download) - annotate - [select for diffs], Sat Jul 8 15:26:25 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.552: +6 -7 lines
Diff to previous 1.552 (colored) to selected 1.470 (colored)

lint: do not use portable type sizes in integer constraints

This reverts the change from tree.c 1.547 from 2023-07-03.  Back then, I
didn't know that the actual value from a type's 'portable size in bits'
was not supposed to be used.

Revision 1.552 / (download) - annotate - [select for diffs], Sat Jul 8 12:45:43 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.551: +3 -4 lines
Diff to previous 1.551 (colored) to selected 1.470 (colored)

lint: warn about conversion from 128-bit to smaller integer types

Revision 1.551 / (download) - annotate - [select for diffs], Sat Jul 8 12:07:21 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.550: +3 -3 lines
Diff to previous 1.550 (colored) to selected 1.470 (colored)

lint: clean up

PUSH nodes are not marked as binary, yet they have a left and a right
operand.

If none of the queries is enabled, omit the query from the debug log.

Revision 1.550 / (download) - annotate - [select for diffs], Sat Jul 8 09:35:35 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.549: +27 -14 lines
Diff to previous 1.549 (colored) to selected 1.470 (colored)

lint: clarify the meaning of 'portable size in bits' of a type

No functional change.

Revision 1.549 / (download) - annotate - [select for diffs], Fri Jul 7 20:19:08 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.548: +13 -17 lines
Diff to previous 1.548 (colored) to selected 1.470 (colored)

lint: only warn about traditional/C90 differences in migration mode

In C99 mode, there is no point warning about traditional C.

No change in the tests, as a complete test suite would require several
new test files, and migration mode is not used intensively.

Revision 1.548 / (download) - annotate - [select for diffs], Fri Jul 7 06:03:31 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.547: +3 -3 lines
Diff to previous 1.547 (colored) to selected 1.470 (colored)

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

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

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

Revision 1.547 / (download) - annotate - [select for diffs], Mon Jul 3 21:36:16 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.546: +3 -3 lines
Diff to previous 1.546 (colored) to selected 1.470 (colored)

lint: consistently use portable type size in integer constraints

Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible
loss of accuracy when converting from 'long' to 'int' on an ILP32
platform that uses 'unsigned long' for size_t, when run in portable mode
(-p), which is enabled by default in the NetBSD build.

The integer constraints avoid false-positive warnings by looking at the
actual values an expression can take.  The function can_represent is
guarded by a condition that uses the portable_size_in_bits, but then
internally used the opposite size_in_bits, which led to inconsistent
results.

The warning looks confusing though, as on an ILP32 platform, 'int' and
'long' have the same size and representation, therefore there cannot be
an actual loss of accuracy.  The warning may need to be reworded to
explicitly mention the portability mode, in which sizeof(int) is assumed
to be 3 instead of 4, to catch possible loss of accuracy on other
platforms.

Revision 1.546 / (download) - annotate - [select for diffs], Mon Jul 3 07:19:57 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.545: +4 -6 lines
Diff to previous 1.545 (colored) to selected 1.470 (colored)

lint: clean up redundant casts

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

lint: rename uppercase QUAD to LLONG

No binary change.

Revision 1.544 / (download) - annotate - [select for diffs], Sun Jul 2 18:14:44 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.543: +132 -132 lines
Diff to previous 1.543 (colored) to selected 1.470 (colored)

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

No functional change.

Revision 1.543 / (download) - annotate - [select for diffs], Sun Jul 2 08:16:19 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.542: +7 -7 lines
Diff to previous 1.542 (colored) to selected 1.470 (colored)

lint: clean up variable names

Revision 1.542 / (download) - annotate - [select for diffs], Sat Jul 1 10:04:27 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.541: +9 -10 lines
Diff to previous 1.541 (colored) to selected 1.470 (colored)

lint: constify, reduce indentation

No functional change.

Revision 1.541 / (download) - annotate - [select for diffs], Sat Jul 1 09:31:55 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.540: +3 -3 lines
Diff to previous 1.540 (colored) to selected 1.470 (colored)

lint: clean up duplicate and dead code for integer constants

No functional change.

Revision 1.540 / (download) - annotate - [select for diffs], Sat Jul 1 09:21:31 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.539: +4 -4 lines
Diff to previous 1.539 (colored) to selected 1.470 (colored)

lint: clean up typos

Revision 1.539 / (download) - annotate - [select for diffs], Sat Jul 1 06:09:24 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.538: +3 -3 lines
Diff to previous 1.538 (colored) to selected 1.470 (colored)

lint: fix initialization of unnamed union member

Revision 1.538 / (download) - annotate - [select for diffs], Fri Jun 30 21:39:54 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.537: +5 -5 lines
Diff to previous 1.537 (colored) to selected 1.470 (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.537 / (download) - annotate - [select for diffs], Fri Jun 30 21:06:18 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.536: +33 -6 lines
Diff to previous 1.536 (colored) to selected 1.470 (colored)

lint: fix handling of unnamed struct/union members

The support for unnamed struct/union members that was added in decl.c
1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers
of these structures and computed wrong sizes for structures containing
anonymous unions. At that time, the handling of initializers was broken
as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.

Real-life examples for code that lint couldn't handle are:

	* external/bsd/jemalloc/dist/src/jemalloc.c
	* external/mit/xorg/lib/dri.old/Makefile

Revision 1.536 / (download) - annotate - [select for diffs], Fri Jun 30 12:21:25 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.535: +218 -298 lines
Diff to previous 1.535 (colored) to selected 1.470 (colored)

lint: clean up tree.c

No functional change.

Revision 1.535 / (download) - annotate - [select for diffs], Fri Jun 30 09:26:03 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.534: +18 -31 lines
Diff to previous 1.534 (colored) to selected 1.470 (colored)

lint: make alignof(incomplete enum) an error

Revision 1.534 / (download) - annotate - [select for diffs], Fri Jun 30 08:48:38 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.533: +6 -6 lines
Diff to previous 1.533 (colored) to selected 1.470 (colored)

lint: use NULL for null pointer constants

No binary change.

Revision 1.533 / (download) - annotate - [select for diffs], Fri Jun 30 08:45:22 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.532: +7 -3 lines
Diff to previous 1.532 (colored) to selected 1.470 (colored)

lint: add query for assigning an integer 0 to a pointer

Revision 1.532 / (download) - annotate - [select for diffs], Thu Jun 29 12:52:06 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.531: +16 -12 lines
Diff to previous 1.531 (colored) to selected 1.470 (colored)

lint: use standard terminology for bit-field width

No functional change.

Revision 1.531 / (download) - annotate - [select for diffs], Sat Jun 24 20:50:54 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.530: +66 -65 lines
Diff to previous 1.530 (colored) to selected 1.470 (colored)

lint: reduce memory allocations

The type val_t has the same size as the tn_s member in the same union.

No functional change.

Revision 1.530 / (download) - annotate - [select for diffs], Sat Jun 24 17:50:31 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.529: +3 -2 lines
Diff to previous 1.529 (colored) to selected 1.470 (colored)

lint: don't warn about comparison between char and character constant

Revision 1.529 / (download) - annotate - [select for diffs], Sat Jun 24 08:11:12 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.528: +18 -5 lines
Diff to previous 1.528 (colored) to selected 1.470 (colored)

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

Revision 1.528 / (download) - annotate - [select for diffs], Thu Jun 22 13:57:44 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.527: +8 -2 lines
Diff to previous 1.527 (colored) to selected 1.470 (colored)

lint: add query for comma operator

Revision 1.527 / (download) - annotate - [select for diffs], Fri Jun 9 15:36:31 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.526: +17 -17 lines
Diff to previous 1.526 (colored) to selected 1.470 (colored)

lint: miscellaneous clean-ups

No binary change, except for line numbers in assertions.

Revision 1.526 / (download) - annotate - [select for diffs], Fri Jun 9 13:03:49 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.525: +43 -43 lines
Diff to previous 1.525 (colored) to selected 1.470 (colored)

lint: indent local variables consistently

No binary change.

Revision 1.525 / (download) - annotate - [select for diffs], Sat Jun 3 20:28:54 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.524: +3 -3 lines
Diff to previous 1.524 (colored) to selected 1.470 (colored)

lint: provide more detailed types when operands do not match

Revision 1.524 / (download) - annotate - [select for diffs], Mon May 22 12:55:04 2023 UTC (10 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.523: +5 -5 lines
Diff to previous 1.523 (colored) to selected 1.470 (colored)

lint: rename constant NOTSPEC to NO_TSPEC

It was too easy to misread the old name as NOT_SPEC instead of the
intended NO_TSPEC.

Revision 1.523 / (download) - annotate - [select for diffs], Sat May 13 20:55:44 2023 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.522: +27 -8 lines
Diff to previous 1.522 (colored) to selected 1.470 (colored)

lint: add query for chained assignments

Revision 1.522 / (download) - annotate - [select for diffs], Wed May 10 21:46:26 2023 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.521: +7 -10 lines
Diff to previous 1.521 (colored) to selected 1.470 (colored)

lint: make code simpler

No functional change.

Revision 1.521 / (download) - annotate - [select for diffs], Tue May 9 15:51:33 2023 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.520: +26 -2 lines
Diff to previous 1.520 (colored) to selected 1.470 (colored)

lint: track integer constraints through conditional expressions

Revision 1.520 / (download) - annotate - [select for diffs], Tue May 9 15:45:06 2023 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.519: +9 -4 lines
Diff to previous 1.519 (colored) to selected 1.470 (colored)

lint: preserve integer constraints on cast

Revision 1.519 / (download) - annotate - [select for diffs], Sat Apr 22 20:54:28 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.518: +17 -9 lines
Diff to previous 1.518 (colored) to selected 1.470 (colored)

lint: allow cast from a type to a union containing that type

Revision 1.518 / (download) - annotate - [select for diffs], Sat Apr 22 20:17:19 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.517: +4 -3 lines
Diff to previous 1.517 (colored) to selected 1.470 (colored)

lint: fix missing initialization for cast to union

The left operand of a unary AST node must not be NULL.

The previous code crashed lint when run with some query enabled, as
is_cast_redundant assumes that a non-null AST node has valid operands.

$ cat <<EOF > crash.c
double
demo(void) {
	union u {
		double *num;
	} u;
	u = (union u)&((double) { 0.0 });
	return *u.num;
}
EOF
$ /usr/libexec/lint1 -w -S -g -q8 crash.c /dev/null

Revision 1.517 / (download) - annotate - [select for diffs], Sat Apr 22 17:49:15 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.516: +19 -19 lines
Diff to previous 1.516 (colored) to selected 1.470 (colored)

lint: rename type_t.t_str to t_sou

The name 't_str' could have meant 'string' or 'struct'.  Since both
struct and union types have members, rename it to 't_sou'.

No functional change.

Revision 1.516 / (download) - annotate - [select for diffs], Sat Apr 22 17:42:29 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.515: +13 -2 lines
Diff to previous 1.515 (colored) to selected 1.470 (colored)

lint: don't warn about cast between union and one of its member types

Seen in src/sbin/newfs_udf/udf_core.c for context.anchors.

Revision 1.515 / (download) - annotate - [select for diffs], Sat Apr 22 15:14:37 2023 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.514: +3 -3 lines
Diff to previous 1.514 (colored) to selected 1.470 (colored)

lint: do not warn about parenthesized assignment in controlling expr

Same as for GCC and Clang.

Revision 1.514 / (download) - annotate - [select for diffs], Sat Apr 22 09:39:14 2023 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.513: +5 -5 lines
Diff to previous 1.513 (colored) to selected 1.470 (colored)

lint: fix typos in comments

Revision 1.513 / (download) - annotate - [select for diffs], Fri Apr 14 18:42:31 2023 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.512: +16 -13 lines
Diff to previous 1.512 (colored) to selected 1.470 (colored)

lint: document suppressed LDBL_MAX warning more accurately

The crucial point is not that lint is cross-compiled but that tools/lint
is run on the usr.bin/xlint code, and in that situation, the platform
mismatch happens.

Revision 1.512 / (download) - annotate - [select for diffs], Wed Apr 12 19:09:48 2023 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.511: +19 -3 lines
Diff to previous 1.511 (colored) to selected 1.470 (colored)

lint: suppress warnings about LDBL_MAX in cross-build mode

This fixes the cross build for sparc64 on x86_64, in which lint
complained:
	warning: floating-point constant out of range [248]
	warning: floating point overflow on operator '-' [142]
	warning: floating-point constant out of range [248]

Revision 1.511 / (download) - annotate - [select for diffs], Tue Apr 11 19:40:04 2023 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.510: +5 -5 lines
Diff to previous 1.510 (colored) to selected 1.470 (colored)

lint: fix converting a complex floating-point constant

The complex '+' in msg_142 line 27 led to an invalid floating point
value when converting from 'double' to '_Complex double'.

Revision 1.510 / (download) - annotate - [select for diffs], Tue Apr 11 19:07:08 2023 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.509: +5 -10 lines
Diff to previous 1.509 (colored) to selected 1.470 (colored)

lint: fix wrong warning about overflow in floating constant expressions

Revision 1.509 / (download) - annotate - [select for diffs], Tue Apr 11 19:02:19 2023 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.508: +92 -155 lines
Diff to previous 1.508 (colored) to selected 1.470 (colored)

lint: condense code

No functional change.

Revision 1.508 / (download) - annotate - [select for diffs], Tue Apr 11 00:03:42 2023 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.507: +9 -3 lines
Diff to previous 1.507 (colored) to selected 1.470 (colored)

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

Seen in lib/libm.

Revision 1.507 / (download) - annotate - [select for diffs], Tue Mar 28 14:44:35 2023 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.506: +2 -5 lines
Diff to previous 1.506 (colored) to selected 1.470 (colored)

lint: warn about extern declarations outside headers

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

Revision 1.506 / (download) - annotate - [select for diffs], Fri Feb 24 19:18:50 2023 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.505: +2971 -3013 lines
Diff to previous 1.505 (colored) to selected 1.470 (colored)

lint: order functions to to reduce forward declarations

No functional change.

Revision 1.505 / (download) - annotate - [select for diffs], Wed Feb 22 22:30:40 2023 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.504: +12 -6 lines
Diff to previous 1.504 (colored) to selected 1.470 (colored)

lint: fix confusing message about nonportable character constants

Revision 1.504 / (download) - annotate - [select for diffs], Sun Jan 29 18:16:48 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.503: +4 -3 lines
Diff to previous 1.503 (colored) to selected 1.470 (colored)

lint: fix definition of __func__

Revision 1.503 / (download) - annotate - [select for diffs], Sun Jan 29 17:36:26 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.502: +3 -2 lines
Diff to previous 1.502 (colored) to selected 1.470 (colored)

lint: demonstrate wrong declaration of __func__

Revision 1.502 / (download) - annotate - [select for diffs], Sun Jan 29 17:13:10 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.501: +6 -2 lines
Diff to previous 1.501 (colored) to selected 1.470 (colored)

lint: don't warn about negative '>>' when the actual value is positive

Revision 1.501 / (download) - annotate - [select for diffs], Sun Jan 29 13:57:35 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.500: +5 -7 lines
Diff to previous 1.500 (colored) to selected 1.470 (colored)

lint: inline an expression, clean up comments

No functional change.

Revision 1.500 / (download) - annotate - [select for diffs], Sun Jan 29 13:47:16 2023 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.499: +10 -8 lines
Diff to previous 1.499 (colored) to selected 1.470 (colored)

lint: untangle conditions in promote_c90

No functional change.

Revision 1.499 / (download) - annotate - [select for diffs], Sat Jan 28 00:55:48 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.498: +31 -23 lines
Diff to previous 1.498 (colored) to selected 1.470 (colored)

lint: extract casting to a union into separate function

No functional change.

Revision 1.498 / (download) - annotate - [select for diffs], Sat Jan 28 00:46:14 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.497: +4 -4 lines
Diff to previous 1.497 (colored) to selected 1.470 (colored)

lint: use stronger wording in comments of unimplemented offsetof

Revision 1.497 / (download) - annotate - [select for diffs], Sat Jan 28 00:39:49 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.496: +75 -68 lines
Diff to previous 1.496 (colored) to selected 1.470 (colored)

lint: split usual arithmetic conversions into separate functions

No functional change.

Revision 1.496 / (download) - annotate - [select for diffs], Sat Jan 28 00:24:05 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.495: +62 -61 lines
Diff to previous 1.495 (colored) to selected 1.470 (colored)

lint: split integer promotions into separate functions

No functional change.

Revision 1.495 / (download) - annotate - [select for diffs], Sat Jan 28 00:12:00 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.494: +5 -50 lines
Diff to previous 1.494 (colored) to selected 1.470 (colored)

lint: remove commented code from new_tnode

The approach in that code was wrong anyway.  If an expression is shifted
to the right, that doesn't change the declared type of the expression,
it only changes the possible range of values.  A better way to implement
these restricted value spaces is by using integer_constraints.

No functional change.

Revision 1.494 / (download) - annotate - [select for diffs], Sun Jan 22 16:05:08 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.493: +3 -2 lines
Diff to previous 1.493 (colored) to selected 1.470 (colored)

lint: prevent undefined behavior for signed '<<'

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

Revision 1.493 / (download) - annotate - [select for diffs], Sat Jan 21 20:07:01 2023 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.492: +3 -3 lines
Diff to previous 1.492 (colored) to selected 1.470 (colored)

lint: make code for strict bool mode more consistent

Guard all entry points with a check for Tflag and remove the now
redundant internal check for Tflag.

No functional change.

Revision 1.492 / (download) - annotate - [select for diffs], Sat Jan 14 10:33:34 2023 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.491: +5 -5 lines
Diff to previous 1.491 (colored) to selected 1.470 (colored)

lint: use fewer abbreviations

No binary change except for line numbers in assertions in decl.c.

Revision 1.491 / (download) - annotate - [select for diffs], Sat Jan 14 10:17:31 2023 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.490: +49 -55 lines
Diff to previous 1.490 (colored) to selected 1.470 (colored)

lint: split struct_or_union_member into two halves

No functional change.

Revision 1.490 / (download) - annotate - [select for diffs], Fri Jan 13 19:41:50 2023 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.489: +3 -3 lines
Diff to previous 1.489 (colored) to selected 1.470 (colored)

lint: remove custom memory allocator

Besides adding complexity, the custom memory allocator didn't invalidate
freed memory, which made it harder to find possible use-after-free bugs.

Revision 1.489 / (download) - annotate - [select for diffs], Sun Jan 8 18:37:12 2023 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.488: +7 -5 lines
Diff to previous 1.488 (colored) to selected 1.470 (colored)

lint: do not report usual arithmetic conversions for constants

Revision 1.488 / (download) - annotate - [select for diffs], Sun Jan 8 18:29:21 2023 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.487: +17 -19 lines
Diff to previous 1.487 (colored) to selected 1.470 (colored)

lint: extract usual arithmetic conversions to separate function

No functional change.

Revision 1.487 / (download) - annotate - [select for diffs], Sun Jan 8 15:22:33 2023 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.486: +8 -6 lines
Diff to previous 1.486 (colored) to selected 1.470 (colored)

lint: recognize enum constant named 'max' as a count of values

Seen in external/bsd/mdocml/dist/mdoc.h(50).

Revision 1.486 / (download) - annotate - [select for diffs], Wed Jan 4 05:08:22 2023 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.485: +9 -8 lines
Diff to previous 1.485 (colored) to selected 1.470 (colored)

lint: fix the result type of '?:' for void pointers

The change from 2015-07-29 was wrong since that rule only applies to
null pointer constants but not to other void pointers.

Revision 1.485 / (download) - annotate - [select for diffs], Tue Jan 3 21:14:14 2023 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.484: +9 -19 lines
Diff to previous 1.484 (colored) to selected 1.470 (colored)

lint: condense building of nodes for '?:' expressions

No binary change except for line numbers in assertions.

Revision 1.484 / (download) - annotate - [select for diffs], Wed Nov 30 20:59:28 2022 UTC (16 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.483: +13 -12 lines
Diff to previous 1.483 (colored) to selected 1.470 (colored)

lint: add measurement unit to local variable names

No binary change, except for line numbers in assertions.

Revision 1.483 / (download) - annotate - [select for diffs], Sat Oct 1 10:07:55 2022 UTC (18 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.482: +3 -7 lines
Diff to previous 1.482 (colored) to selected 1.470 (colored)

lint: inline local variable in build_function_argument

No functional change.

Revision 1.482 / (download) - annotate - [select for diffs], Sat Oct 1 10:04:06 2022 UTC (18 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.481: +3 -2 lines
Diff to previous 1.481 (colored) to selected 1.470 (colored)

lint: miscellaneous cleanup

No functional change.

Revision 1.481 / (download) - annotate - [select for diffs], Sat Oct 1 09:42:40 2022 UTC (18 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.480: +3 -3 lines
Diff to previous 1.480 (colored) to selected 1.470 (colored)

lint: add hyphen to adjective 'old-style'

Revision 1.480 / (download) - annotate - [select for diffs], Sun Aug 28 19:09:12 2022 UTC (19 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.479: +3 -3 lines
Diff to previous 1.479 (colored) to selected 1.470 (colored)

lint: inline previous_declaration for nonconstant message IDs

This adds back the compile-time printf validation in debug mode that was
missing before.

Revision 1.479 / (download) - annotate - [select for diffs], Sun Aug 28 12:04:47 2022 UTC (19 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.478: +24 -17 lines
Diff to previous 1.478 (colored) to selected 1.470 (colored)

lint: clean up visual clutter

No functional change.

Revision 1.478 / (download) - annotate - [select for diffs], Sun Aug 28 10:43:18 2022 UTC (19 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.477: +3 -3 lines
Diff to previous 1.477 (colored) to selected 1.470 (colored)

lint: rename functions to be clearer

No need anymore to keep external identifiers at the "6 significant
initial characters" mandated by C90.

Revision 1.477 / (download) - annotate - [select for diffs], Thu Aug 25 19:03:47 2022 UTC (19 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.476: +3 -3 lines
Diff to previous 1.476 (colored) to selected 1.470 (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.476 / (download) - annotate - [select for diffs], Fri Aug 19 19:40:39 2022 UTC (19 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.475: +6 -6 lines
Diff to previous 1.475 (colored) to selected 1.470 (colored)

lint: add more details to message about large bit-shifts

Revision 1.475 / (download) - annotate - [select for diffs], Sat Jul 16 22:36:06 2022 UTC (21 months ago) by rillig
Branch: MAIN
Changes since 1.474: +6 -4 lines
Diff to previous 1.474 (colored) to selected 1.470 (colored)

lint: add more details to message about pointer alignment

The previous message 'may cause alignment problem' was not detailed
enough to be actionable, it didn't give the necessary insight to why
lint was complaining at all.

The new message 'increases alignment from 1 to 4' or 'from 2 to 8'
describes the potentially problematic conversion, and together with the
involved type names, it allows an informed decision about whether lint's
warning is warranted or not.

In a typical NetBSD build, this warning is in the top 10.  The number of
these warnings depends on the architecture, it is typically between 800
and 1600.

Revision 1.474 / (download) - annotate - [select for diffs], Fri Jul 8 21:19:07 2022 UTC (21 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.473: +10 -8 lines
Diff to previous 1.473 (colored) to selected 1.470 (colored)

lint: fix edge cases in the query for redundant cast before assignment

Casting from and to _Bool is only allowed outside strict bool mode.
Outside strict bool mode, _Bool is an integer type, therefore return
early if any of the operands has type _Bool.  In strict bool mode, even
casting from _Bool to _Bool is not allowed, as it is not needed in
practice.

Handle _Complex types before real floating-point types.  Return early
for _Complex types, as these are floating-point types as well.

For pointer casts, not only flag casts to or from 'pointer to void', but
also casts between the same types.

In debug mode, when constructing the type '_Complex float', the type
name of '_Complex' occurs in the debug log.  Outside of debug mode,
printing this type name is an error since this type keyword only occurs
internally, when constructing a type.  At that point, it is not supposed
to occur in any user-visible message.

Revision 1.473 / (download) - annotate - [select for diffs], Fri Jul 8 20:27:36 2022 UTC (21 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.472: +51 -14 lines
Diff to previous 1.472 (colored) to selected 1.470 (colored)

lint: fix query for redundant cast before assignment

Previously, 'i = (int)dbl' was marked as redundant, even though it
performs a value conversion.

Revision 1.472 / (download) - annotate - [select for diffs], Wed Jul 6 22:26:30 2022 UTC (21 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.471: +35 -2 lines
Diff to previous 1.471 (colored) to selected 1.470 (colored)

lint: do not warn about 'may lose accuracy' in safe cases of '%'

The possible values of the expression 'a % b' for unsigned integers lie
between 0 and (b - 1).  For signed integers, it's more complicated, so
ignore them for now.

Revision 1.471 / (download) - annotate - [select for diffs], Tue Jul 5 22:50:41 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.470: +38 -3 lines
Diff to previous 1.470 (colored)

lint: add additional queries that are not enabled by default

In the last 18 months, several lint warnings have been made adjusted to
allow common usage patterns.  For example, lint no longer warns about a
constant condition in the statement 'do { ... } while (false)' (message
161), as this pattern is well-known in statement-like macros, making it
unlikely that the 'false' is a mistake.  Another example is casts
between unequal pointer types (message 247) for a few well-known
patterns that are unlikely to be bugs.

Occasionally, it is useful to query the code for patterns or events that
would not justify a warning.  These patterns are modeled as predefined
queries that can be selected individually, in addition to and
independently of the existing warnings and errors.

New queries can be added as needed, in the same way as new warnings.
Queries that are deemed no longer used can be deactivated in the same
way as warnings that are no longer used.

As long as none of the queries is enabled, they produce a minimal
overhead of querying a single global variable.  Computations that are
more expensive than a few machine instructions should be guarded by
any_query_enabled.

https://mail-index.netbsd.org/source-changes-d/2022/06/28/msg013716.html

ok christos@

Revision 1.470 / (download) - annotate - [selected], Sun Jul 3 14:15:38 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.469: +4 -2 lines
Diff to previous 1.469 (colored)

lint: add debug logging for struct and enum details

Revision 1.469 / (download) - annotate - [select for diffs], Sat Jul 2 10:47:29 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.468: +6 -6 lines
Diff to previous 1.468 (colored) to selected 1.470 (colored)

lint: prevent undefined behavior when folding '<<' or '>>'

Revision 1.468 / (download) - annotate - [select for diffs], Sat Jul 2 10:41:13 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.467: +13 -3 lines
Diff to previous 1.467 (colored) to selected 1.470 (colored)

lint: document usage of 'convert'

No functional change.

Revision 1.467 / (download) - annotate - [select for diffs], Sat Jul 2 10:23:38 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.466: +5 -8 lines
Diff to previous 1.466 (colored) to selected 1.470 (colored)

lint: only convert the right operand of '<<' or '>>' in traditional C

Traditional C says: "Then the right operand is converted to int".

C90 dropped that sentence, probably because it didn't have any effect on
the result or the conditions for undefined behavior.

To stick to the wording of the specification, also convert UINT to INT.

While here, fix the call to 'convert'.  The first argument being 'CVT'
means that the conversion comes from a cast-expression instead of an
implicit conversion.  This prevents warnings for 'uint64_t << uint64_t'.
Keeping this unnecessary conversion in C90 or later would have generated
warnings for the functions at the bottom of msg_132.c.

Revision 1.466 / (download) - annotate - [select for diffs], Fri Jul 1 20:53:13 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.465: +6 -11 lines
Diff to previous 1.465 (colored) to selected 1.470 (colored)

lint: add quotes around operator in message 138, remove message 240

Message 138 doesn't occur in practice, it was the last one that was
missing the quotes around the placeholder.

Message 240 was also missing the quotes, but it was not reachable. There
was also no apparent benefit in warning about 'assignment of different
structures' when the message about 'assignment type mismatch' serves the
same purpose.

Revision 1.465 / (download) - annotate - [select for diffs], Fri Jul 1 19:52:41 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.464: +25 -13 lines
Diff to previous 1.464 (colored) to selected 1.470 (colored)

lint: restructure 'convert'

The conditions are now grouped by target type, highlighting that
conversions between integer and floating point types are not checked by
this function, in fact, they are not checked at all.

No functional change.

Revision 1.464 / (download) - annotate - [select for diffs], Fri Jul 1 17:48:49 2022 UTC (21 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.463: +14 -23 lines
Diff to previous 1.463 (colored) to selected 1.470 (colored)

lint: rename functions for value conversion

No functional change.

Revision 1.463 / (download) - annotate - [select for diffs], Fri Jun 24 21:22:11 2022 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.462: +7 -2 lines
Diff to previous 1.462 (colored) to selected 1.470 (colored)

lint: do not warn about pointer casts to array types

If the (recursive) element type of the array is compatible, that's good
enough.  Even after the previous commits, this warning is the one that
occurs most in a standard NetBSD build, and it is generally ignored.
For now, focus on reducing the number of false positives to an
acceptable level.

Revision 1.462 / (download) - annotate - [select for diffs], Fri Jun 24 20:44:53 2022 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.461: +14 -9 lines
Diff to previous 1.461 (colored) to selected 1.470 (colored)

lint: allow pointer cast between compatible structs

Lint already allowed pointer casts from 'struct counter' to 'struct
counter_impl'.  Now it also allows the other direction.

Revision 1.461 / (download) - annotate - [select for diffs], Fri Jun 24 20:16:21 2022 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.460: +25 -2 lines
Diff to previous 1.460 (colored) to selected 1.470 (colored)

lint: do not warn about pointer cast between sockaddr variants

Revision 1.460 / (download) - annotate - [select for diffs], Fri Jun 24 19:27:43 2022 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.459: +5 -5 lines
Diff to previous 1.459 (colored) to selected 1.470 (colored)

lint: allow pointer cast from char to struct/union

Revision 1.459 / (download) - annotate - [select for diffs], Wed Jun 22 19:23:18 2022 UTC (21 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.458: +37 -36 lines
Diff to previous 1.458 (colored) to selected 1.470 (colored)

lint: add quotes around placeholders for the remaining messages

Reword some of the messages slightly, exchanging brevity for clarity.

Message 138 is kept as-is, as it is not yet covered by any tests.

Message 240 is kep as-is, as it is unreachable.

Revision 1.458 / (download) - annotate - [select for diffs], Tue Jun 21 22:21:49 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.457: +4 -6 lines
Diff to previous 1.457 (colored) to selected 1.470 (colored)

lint: merge duplicate code in typeok_minus

No functional change.

Revision 1.457 / (download) - annotate - [select for diffs], Tue Jun 21 22:16:26 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.456: +7 -8 lines
Diff to previous 1.456 (colored) to selected 1.470 (colored)

lint: clean up comments, don't include unused header

No functional change.

Revision 1.456 / (download) - annotate - [select for diffs], Tue Jun 21 22:10:30 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.455: +13 -14 lines
Diff to previous 1.455 (colored) to selected 1.470 (colored)

lint: use is_struct_or_union instead of comparing twice

No functional change.

Revision 1.455 / (download) - annotate - [select for diffs], Tue Jun 21 21:18:30 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.454: +8 -8 lines
Diff to previous 1.454 (colored) to selected 1.470 (colored)

lint: add quotes and details to some more messages

Revision 1.454 / (download) - annotate - [select for diffs], Sun Jun 19 12:14:33 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.453: +5 -5 lines
Diff to previous 1.453 (colored) to selected 1.470 (colored)

lint: add quotes around placeholders in 4 messages

Revision 1.453 / (download) - annotate - [select for diffs], Wed Jun 15 18:29:21 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.452: +7 -7 lines
Diff to previous 1.452 (colored) to selected 1.470 (colored)

lint: rename mod_t.m_requires_bool to m_compares_with_zero

The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict
bool mode, in default mode they accept any scalar expression and compare
it with zero.  The new names are more accurate.

No functional change.

Revision 1.452 / (download) - annotate - [select for diffs], Mon May 30 08:14:52 2022 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.451: +35 -10 lines
Diff to previous 1.451 (colored) to selected 1.470 (colored)

lint: revert 'do not pre-multiply pointer expressions' from 2022-05-26

In tree.c 1.448, removing the pre-multiplication generated wrong
warnings about out-of-bounds array access.

Revision 1.451 / (download) - annotate - [select for diffs], Mon May 30 07:19:28 2022 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.450: +6 -2 lines
Diff to previous 1.450 (colored) to selected 1.470 (colored)

lint: fix assertion failure in '(unsigned long)(ptr) >> 12'

Since tree.c 1.449 from 2022-05-26.

Revision 1.450 / (download) - annotate - [select for diffs], Sun May 29 23:24:09 2022 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.449: +13 -7 lines
Diff to previous 1.449 (colored) to selected 1.470 (colored)

lint: fix wrong errors about sizeof of a bit-field (since 2022-05-26)

Revision 1.449 / (download) - annotate - [select for diffs], Thu May 26 20:17:40 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.448: +42 -2 lines
Diff to previous 1.448 (colored) to selected 1.470 (colored)

lint: do not warn about 'uint32_t = uint64_t >> 32'

If all possible values fit into the destination type, there is no
possibility of losing accuracy.

Enhances PR 36668.

Revision 1.448 / (download) - annotate - [select for diffs], Thu May 26 18:08:33 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.447: +10 -35 lines
Diff to previous 1.447 (colored) to selected 1.470 (colored)

lint: do not pre-multiply pointer expressions 'ptr + int'

In the AST, it is confusing to see that 'stderr == __sF + 304', it
should rather be 'stderr == __sF + 2'.

No functional change.

Revision 1.447 / (download) - annotate - [select for diffs], Thu May 26 17:23:09 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.446: +27 -20 lines
Diff to previous 1.446 (colored) to selected 1.470 (colored)

lint: improve local variable and function names

No functional change.

Revision 1.446 / (download) - annotate - [select for diffs], Thu May 26 16:52:30 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.445: +14 -20 lines
Diff to previous 1.445 (colored) to selected 1.470 (colored)

lint: reduce scope of local variables in build_plus_minus

No functional change.

Revision 1.445 / (download) - annotate - [select for diffs], Thu May 26 10:48:47 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.444: +4 -4 lines
Diff to previous 1.444 (colored) to selected 1.470 (colored)

lint: re-order conditions for lossy conversions

Now that can_represent does more work, put it at the end of the
conditions.

No functional change.

Revision 1.444 / (download) - annotate - [select for diffs], Thu May 26 09:26:00 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.443: +150 -16 lines
Diff to previous 1.443 (colored) to selected 1.470 (colored)

lint: do not warn about loss in accuracy if the actual value fits

The expression 'any & 0xff' can always be assigned to 'uint8_t' without
loss of any value bits.  In the same way, '(any & 0xff) << 8' can always
be assigned to 'uint16_t'.

Previously, lint warned about these cases.  Fix these wrong warnings by
tracking the possible values of integer expressions across a single
expression.

Fixes PR 36668, so that <sys/endian.h> does not need to be cluttered
with useless casts anymore.

Revision 1.443 / (download) - annotate - [select for diffs], Thu May 26 06:43:58 2022 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.442: +3 -40 lines
Diff to previous 1.442 (colored) to selected 1.470 (colored)

lint: remove long list of node types in switch statement

No functional change.

Revision 1.442 / (download) - annotate - [select for diffs], Fri May 20 21:18:55 2022 UTC (22 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.441: +3 -3 lines
Diff to previous 1.441 (colored) to selected 1.470 (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.441 / (download) - annotate - [select for diffs], Wed May 18 20:10:11 2022 UTC (23 months ago) by rillig
Branch: MAIN
Changes since 1.440: +3 -3 lines
Diff to previous 1.440 (colored) to selected 1.470 (colored)

lint: do not warn about '==' on the right-hand side of ','

Revision 1.440 / (download) - annotate - [select for diffs], Wed May 18 20:01:21 2022 UTC (23 months ago) by rillig
Branch: MAIN
Changes since 1.439: +38 -11 lines
Diff to previous 1.439 (colored) to selected 1.470 (colored)

lint: reduce negations in typeok_point, document check_expr_misc

No functional change.

Revision 1.439 / (download) - annotate - [select for diffs], Sat Apr 30 22:31:23 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.438: +13 -7 lines
Diff to previous 1.438 (colored) to selected 1.470 (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.438 / (download) - annotate - [select for diffs], Sat Apr 30 21:38:03 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.437: +30 -23 lines
Diff to previous 1.437 (colored) to selected 1.470 (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.437 / (download) - annotate - [select for diffs], Sat Apr 30 19:18:48 2022 UTC (23 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.436: +7 -7 lines
Diff to previous 1.436 (colored) to selected 1.470 (colored)

lint: inline macro Sflag in cases of expected behavior

In the grammar rules 'enums_with_opt_comma' and 'block_item_list',
checking for allow_c99 was redundant since c99ism does not warn in C99
mode.

In the grammar rule 'designator', align the two actions structurally.

No functional change.

Revision 1.436 / (download) - annotate - [select for diffs], Tue Apr 19 23:16:14 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.435: +3 -3 lines
Diff to previous 1.435 (colored) to selected 1.470 (colored)

lint: fix integer overflow on seeing -(uint64_t)INT64_MIN

Seen in external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c,
which is protected by a NOLINT in ../Makefile.inc.

Revision 1.435 / (download) - annotate - [select for diffs], Tue Apr 19 22:14:30 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.434: +6 -6 lines
Diff to previous 1.434 (colored) to selected 1.470 (colored)

lint: only warn about unsigned constants in C90 migration mode

For C99 code, the difference between traditional C and C90 is not
relevant.

Seen in sqlite3.c line 30448.

Revision 1.434 / (download) - annotate - [select for diffs], Tue Apr 19 20:08:52 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.433: +34 -2 lines
Diff to previous 1.433 (colored) to selected 1.470 (colored)

lint: do not warn about converting (1234567L & 0xFF) to unsigned char

Due to the '& 0xFF', there is no possible loss of accuracy.

Revision 1.433 / (download) - annotate - [select for diffs], Sat Apr 16 22:21:10 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.432: +27 -28 lines
Diff to previous 1.432 (colored) to selected 1.470 (colored)

lint: merge mod_t.m_test_context into m_requires_bool

These two flags mean exactly the same.

No functional change.

Revision 1.432 / (download) - annotate - [select for diffs], Sat Apr 16 21:14:33 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.431: +8 -8 lines
Diff to previous 1.431 (colored) to selected 1.470 (colored)

lint: rename members of tnode_t to more closely match reality

The flags do not describe the left operand of the node but both, as for
most operators, either none or both operands are in test context or in
value context.

The one exception is the operator '?' from the '?:' conditional, for
which the left operand is in test context and the right operand is in
value context.

No binary change.

Revision 1.431 / (download) - annotate - [select for diffs], Sat Apr 16 20:57:10 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.430: +13 -20 lines
Diff to previous 1.430 (colored) to selected 1.470 (colored)

lint: investigate why lint only warns about some constant conditions

Noticed in lex.c, in the macro kwdef, where lint complains about the
condition containing '||' but not about the conditions containing only
'>' or '=='.

Revision 1.430 / (download) - annotate - [select for diffs], Sat Apr 16 20:02:55 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.429: +3 -3 lines
Diff to previous 1.429 (colored) to selected 1.470 (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.429 / (download) - annotate - [select for diffs], Sat Apr 16 19:18:17 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.428: +9 -8 lines
Diff to previous 1.428 (colored) to selected 1.470 (colored)

lint: migrate gflag to allow_gcc

No functional change.

Revision 1.428 / (download) - annotate - [select for diffs], Sat Apr 16 14:06:10 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.427: +11 -11 lines
Diff to previous 1.427 (colored) to selected 1.470 (colored)

lint: clean up conditions for migration check between trad and C90

No functional change, as each of the conditions was effectively '!tflag
&& !sflag && !Sflag' (even if distributed over several statements).

Revision 1.427 / (download) - annotate - [select for diffs], Fri Apr 15 21:50:07 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.426: +4 -3 lines
Diff to previous 1.426 (colored) to selected 1.470 (colored)

lint: in C99 mode, do not warn about non-prototype conversions

Message 259 is "argument #%d is converted from '%s' to '%s' due to
prototype", and it is intended to warn about compatibility between
traditional C where functions had no prototypes and standard C where
functions have prototypes.

Running lint in C99 mode is further away from traditional C than running
lint in C90 mode, so that warning doesn't make sense for C99.  There are
still some inconsistencies in the 5 language version modes that lint
offers:

	-t		for traditional C
	(no option)	for migrating traditional C to C90
	-s		for C90 code
	-S		for C99 code
	-Ac11		for C11 code

By disabling warning 259 in C99 mode, a typical NetBSD build produces
14.500 fewer warnings than before, of about 100.000 total.

Message 259 overlaps with message 298 "conversion from '%s' to '%s' may
lose accuracy, arg #%d", and in some cases of potentially lossy
conversions, lint now produces none of these messages.  In some other
cases, these warnings were reported redundantly.  The cases where
message 298 makes sense will be added back later, as needed.

Revision 1.426 / (download) - annotate - [select for diffs], Fri Apr 15 17:08:21 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.425: +16 -24 lines
Diff to previous 1.425 (colored) to selected 1.470 (colored)

lint: merge conditions in check_integer_conversion

No functional change.

Revision 1.425 / (download) - annotate - [select for diffs], Fri Apr 15 16:38:30 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.424: +12 -14 lines
Diff to previous 1.424 (colored) to selected 1.470 (colored)

lint: reduce indentation in check_integer_conversion

No functional change.

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

lint: distinguish between storage class and declaration kind

These types overlap but are not the same.

No functional change.

Revision 1.423 / (download) - annotate - [select for diffs], Sat Apr 9 16:02:14 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.422: +4 -4 lines
Diff to previous 1.422 (colored) to selected 1.470 (colored)

lint: extract is_member into separate function

No functional change.

Revision 1.422 / (download) - annotate - [select for diffs], Sat Apr 9 15:43:41 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.421: +26 -15 lines
Diff to previous 1.421 (colored) to selected 1.470 (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.421 / (download) - annotate - [select for diffs], Sat Apr 9 14:50:18 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.420: +3 -3 lines
Diff to previous 1.420 (colored) to selected 1.470 (colored)

lint: split CTCONST into BOOL_CONST and ENUM_CONST

Having a unified compile-time constant "storage class" made the code
more difficult to understand.

No functional change.

Revision 1.420 / (download) - annotate - [select for diffs], Sat Apr 9 13:38:17 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.419: +7 -7 lines
Diff to previous 1.419 (colored) to selected 1.470 (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.419 / (download) - annotate - [select for diffs], Sat Apr 9 13:22:05 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.418: +5 -5 lines
Diff to previous 1.418 (colored) to selected 1.470 (colored)

lint: rename length to length_in_bits

No functional change.

Revision 1.418 / (download) - annotate - [select for diffs], Sun Apr 3 00:39:32 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.417: +7 -4 lines
Diff to previous 1.417 (colored) to selected 1.470 (colored)

lint: fix crash after syntax error in GCC statement expression

Since cgram.y 1.226 from 2021-05-03.

Revision 1.417 / (download) - annotate - [select for diffs], Sat Apr 2 22:38:45 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.416: +3 -4 lines
Diff to previous 1.416 (colored) to selected 1.470 (colored)

lint: clean up style

Remove outdated ARGSUSED (the one in tree.c had been wrong since 1995),
remove unused argument.

No functional change.

Revision 1.416 / (download) - annotate - [select for diffs], Sat Apr 2 14:28:30 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.415: +3 -3 lines
Diff to previous 1.415 (colored) to selected 1.470 (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.415 / (download) - annotate - [select for diffs], Sat Apr 2 12:24:55 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.414: +3 -2 lines
Diff to previous 1.414 (colored) to selected 1.470 (colored)

lint: add debug logging for the declaration stack

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

Revision 1.414 / (download) - annotate - [select for diffs], Fri Apr 1 23:16:32 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.413: +6 -6 lines
Diff to previous 1.413 (colored) to selected 1.470 (colored)

lint: add type details to message about 'sizeof(function)'

The code in add_function is severely broken, it mixes up the return type
of the function with the argument types.  For now, at least show the
guessed type in the diagnostic, to allow human readers quickly spot the
bug.

Extend the test cases in decl_direct_abstract.c to show that the
behavior differs unreasonably if the first parameter of the function is
equal to its return type.

Revision 1.413 / (download) - annotate - [select for diffs], Fri Apr 1 22:28:21 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.412: +3 -10 lines
Diff to previous 1.412 (colored) to selected 1.470 (colored)

lint: improve determination of abstract typename

Still not perfect, but at least a step in the right direction.  See
decl_direct_abstract.c for the missing edge cases.

See PR#22119.

Revision 1.412 / (download) - annotate - [select for diffs], Fri Apr 1 01:06:26 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.411: +3 -2 lines
Diff to previous 1.411 (colored) to selected 1.470 (colored)

lint: replace crash with assertion failure

Triggered by 'sizeof(int())'.

GCC evaluates this expression to 1, without any warning.

Clang warns about an "invalid application of 'sizeof' to a function
type".

Revision 1.411 / (download) - annotate - [select for diffs], Sun Mar 13 15:26:54 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.410: +4 -3 lines
Diff to previous 1.410 (colored) to selected 1.470 (colored)

lint: add braces around multi-line loop body

No functional change.

Revision 1.410 / (download) - annotate - [select for diffs], Sun Feb 27 18:29:14 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.409: +18 -30 lines
Diff to previous 1.409 (colored) to selected 1.470 (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.409 / (download) - annotate - [select for diffs], Sun Feb 27 11:40:29 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.408: +3 -3 lines
Diff to previous 1.408 (colored) to selected 1.470 (colored)

lint: C99 has been released, so refer to it by its proper name

Revision 1.408 / (download) - annotate - [select for diffs], Sun Feb 27 11:14:42 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.407: +8 -8 lines
Diff to previous 1.407 (colored) to selected 1.470 (colored)

lint: unabbreviate two more members of sym_t

No functional change.

Revision 1.407 / (download) - annotate - [select for diffs], Sun Feb 27 10:44:45 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.406: +6 -5 lines
Diff to previous 1.406 (colored) to selected 1.470 (colored)

lint: unabbreviate some fields in sym_t

No functional change.

Revision 1.406 / (download) - annotate - [select for diffs], Sun Feb 27 10:31:58 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.405: +7 -7 lines
Diff to previous 1.405 (colored) to selected 1.470 (colored)

lint: encode lifetime of allocated memory in function names

No functional change.

Revision 1.405 / (download) - annotate - [select for diffs], Sun Feb 27 08:31:26 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.404: +21 -21 lines
Diff to previous 1.404 (colored) to selected 1.470 (colored)

lint: encode lifetime of allocated memory in the function names

No functional change.

Revision 1.404 / (download) - annotate - [select for diffs], Sat Feb 26 20:36:11 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.403: +27 -6 lines
Diff to previous 1.403 (colored) to selected 1.470 (colored)

lint: fix memory corruption in statement expressions (since 2021-12-17)

The commit that introduced the assertion failure looks innocent, it only
adds a few predefined functions for GCC mode.  Nevertheless, before that
commit, lint consistently complained about 'error: void type illegal in
expression [109]', which doesn't make sense either.

This fix also removes the creative use of the initialization stack to
store the type of the statement expression.  Having a separate stack for
these statement expressions makes the code easier to understand.

Revision 1.403 / (download) - annotate - [select for diffs], Sat Feb 26 19:01:09 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.402: +24 -2 lines
Diff to previous 1.402 (colored) to selected 1.470 (colored)

lint: extract code for handling statement expressions from the grammar

This prepares the fix of the memory corruption bug that is demonstrated
in t_integration.sh, test case assertion_failures.

No functional change.

Revision 1.402 / (download) - annotate - [select for diffs], Tue Dec 21 15:33:20 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.401: +3 -6 lines
Diff to previous 1.401 (colored) to selected 1.470 (colored)

lint: sync comment with recent change of parameter name

Revision 1.401 / (download) - annotate - [select for diffs], Tue Dec 21 15:24:28 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.400: +7 -7 lines
Diff to previous 1.400 (colored) to selected 1.470 (colored)

lint: invert condition in build_name

No functional change.

Revision 1.400 / (download) - annotate - [select for diffs], Fri Dec 17 00:05:24 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.399: +4 -14 lines
Diff to previous 1.399 (colored) to selected 1.470 (colored)

lint: in GCC mode, declare alloca and variants

The prototype declarations define the correct parameter types of these
functions so that they are no longer subject to the default argument
promotions (C11 6.5.2.2p6).

The GCC builtins are only recognized in GCC mode (-g).

Revision 1.399 / (download) - annotate - [select for diffs], Thu Dec 16 23:46:21 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.398: +6 -7 lines
Diff to previous 1.398 (colored) to selected 1.470 (colored)

lint: narrow down parameter of build_name

Passing an arbitrary tokenizer symbol left too much freedom and
uncertainty to the caller, and 0 was a magic number in this context.

No functional change.

Revision 1.398 / (download) - annotate - [select for diffs], Wed Dec 15 00:44:05 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.397: +3 -3 lines
Diff to previous 1.397 (colored) to selected 1.470 (colored)

lint: unexport struct_or_union_member

Strangely, lint2 didn't notice this unnecessary export.

Revision 1.397 / (download) - annotate - [select for diffs], Mon Dec 6 23:26:28 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.396: +12 -2 lines
Diff to previous 1.396 (colored) to selected 1.470 (colored)

lint: fix return type of GCC's __builtin_alloca

Needed for libgmp.

Revision 1.396 / (download) - annotate - [select for diffs], Sat Dec 4 00:01:24 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.395: +5 -5 lines
Diff to previous 1.395 (colored) to selected 1.470 (colored)

lint: add quotes around placeholders in message 123

Revision 1.395 / (download) - annotate - [select for diffs], Tue Nov 16 21:01:05 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.394: +65 -68 lines
Diff to previous 1.394 (colored) to selected 1.470 (colored)

lint: fix check for function calls in strict bool mode

Previously, if a function call occurred in the controlling expression,
its return type could be any scalar, not just bool.  This was against
the goal of strict bool mode, which makes bool a separate and
incompabile type to all other types.  For example, it would allow
controlling expressions like 'strcmp(a, b)' without the usual '!= 0',
but only if at least one of 'a' and 'b' came from a macro definition
from a system header.

The fix is that the decision of whether the type of the controlling
expression may be scalar is no longer based on the operand types but on
the main operator of the controlling expression.

Revision 1.394 / (download) - annotate - [select for diffs], Tue Nov 16 06:55:03 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.393: +5 -2 lines
Diff to previous 1.393 (colored) to selected 1.470 (colored)

tests/lint: explain the missing error message in strict bool mode

There are 2 separate bugs that lead to the missing error message.

The first bug is that when parsing a name, the information about whether
that name comes from a system header is not properly recorded for the
last token before switching from or to a system header.

The second bug is that for determining whether the type of a function
call expression is relaxed, the types of the function call arguments are
taken into account, even though the type only depends on the function
itself.  The same idea applies to the operators '<<' and '>>', as their
result type only depends on the left operand, at least since C90.

Revision 1.393 / (download) - annotate - [select for diffs], Mon Nov 1 19:48:51 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.392: +4 -4 lines
Diff to previous 1.392 (colored) to selected 1.470 (colored)

lint: enter full C90 compatibility mode

The C99 comment in tree.c:3468 has been there since 2017-03-06, without
anyone complaining that their compiler would not handle it.

Strangely, running GCC 10.3.0 in '-std=c90' mode does not complain about
declarations after statements, '-Wdeclaration-after-statement' is needed
separately.

No functional change.

Revision 1.392 / (download) - annotate - [select for diffs], Mon Nov 1 19:10:07 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.391: +30 -22 lines
Diff to previous 1.391 (colored) to selected 1.470 (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.391 / (download) - annotate - [select for diffs], Mon Nov 1 18:11:25 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.390: +5 -6 lines
Diff to previous 1.390 (colored) to selected 1.470 (colored)

lint: do not warn about array size mismatch in array[(int)enum]

The cast to 'int' explicitly converts the type away from being an enum.

Revision 1.390 / (download) - annotate - [select for diffs], Mon Nov 1 13:30:11 2021 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.389: +15 -16 lines
Diff to previous 1.389 (colored) to selected 1.470 (colored)

simplify.

Revision 1.389 / (download) - annotate - [select for diffs], Mon Nov 1 11:46:50 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.388: +25 -12 lines
Diff to previous 1.388 (colored) to selected 1.470 (colored)

lint: in the check for array[enum], allow enum constant NUM

When an enum type defines a constant NUM_VALUES, this constant is
usually not part of the enum values available to the application but
rather a handy place for defining the number of other enum values. Don't
warn about this case.

Seen in openpam_impl.h and several other places.

Revision 1.388 / (download) - annotate - [select for diffs], Sun Oct 31 23:15:44 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.387: +5 -7 lines
Diff to previous 1.387 (colored) to selected 1.470 (colored)

lint: fix invalid memory access in array[enum] check

Lint checks whether in an expression 'array[enum]', the array size
matches the value of the maximum enum constant.

The previous tests for this check were missing the case where an enum
name was explicitly cast to an integer type and then used as an array
index. In this situation, the resulting type of the array index is a
plain 'int' without any information about its previous 'enum' history.

An entirely different case is when the 'enum' is implicitly converted to
an integer type, as in the test color_name_too_many. There, for the
final type of the array index, rn->tn_type->t_is_enum is true, which
means that rn->tn_type->t_enum is properly filled.

The bug was a simple typo, I had forgotten a tn_left indirection, which
is necessary to get the type before the implicit conversion.

Found and reported by Christos, triggered by src/lib/libperfuse/ops.c
1.89 line 1226 expression 'VTTOIF(vap->va_type)'.

Revision 1.387 / (download) - annotate - [select for diffs], Sun Oct 31 16:42:16 2021 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.386: +5 -2 lines
Diff to previous 1.386 (colored) to selected 1.470 (colored)

Avoid null pointer exception hpcmips/mipsel src/lib/libperfuse/ops.c

Revision 1.386 / (download) - annotate - [select for diffs], Sat Oct 30 22:04:42 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.385: +41 -2 lines
Diff to previous 1.385 (colored) to selected 1.470 (colored)

lint: warn if an enum name is used for mismatched array access

This helps to keep the enum definition and the straight-forward
implementation of a to_string or name function in sync.

The test for message 241 had to be adjusted because of exactly this bug.
That test defined a bit mask enum but accessed it like a value enum
type.

Revision 1.385 / (download) - annotate - [select for diffs], Sat Oct 9 21:56:12 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.384: +14 -7 lines
Diff to previous 1.384 (colored) to selected 1.470 (colored)

lint: add more details to warning about nonportable character comparison

Especially when macros are involved, this makes it easier to see that
there is a real problem.

Seen in bin/sh/expand.c:273, where a plain char is compared to numbers
larger than 127.

Revision 1.384 / (download) - annotate - [select for diffs], Sat Oct 9 20:03:20 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.383: +35 -4 lines
Diff to previous 1.383 (colored) to selected 1.470 (colored)

lint: warn that bsearch effectively discards 'const'

Just like strchr, bsearch takes a const pointer and returns a non-const
pointer into the same object.

Revision 1.383 / (download) - annotate - [select for diffs], Sun Sep 26 14:52:37 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.382: +6 -2 lines
Diff to previous 1.382 (colored) to selected 1.470 (colored)

tests/lint: explain difference between i386 and sparc for 259

Seen in usr.bin/make/cond.c 1.278 from 2021-09-21, line 800, the call to
is_token, where unsigned char gets converted to unsigned int or unsigned
long, depending on the platform.

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

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

Fixes tools build on macOS 11.6 arm64 hosts.

Revision 1.381 / (download) - annotate - [select for diffs], Sun Sep 12 10:06:03 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.380: +9 -9 lines
Diff to previous 1.380 (colored) to selected 1.470 (colored)

lint: un-abbreviate rvused and rvdisc

No functional change.

Revision 1.380 / (download) - annotate - [select for diffs], Sun Sep 5 18:34:50 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.379: +3 -3 lines
Diff to previous 1.379 (colored) to selected 1.470 (colored)

lint: reduce number of ifdef names

No functional change.

Revision 1.379 / (download) - annotate - [select for diffs], Sun Sep 5 17:49:55 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.378: +4 -4 lines
Diff to previous 1.378 (colored) to selected 1.470 (colored)

lint: do not warn about comparison 'unsigned <= 0'

Seen in scanners generated by Flex, and about 50 occurrences in the
NetBSD src and xsrc tree, all of which are not suspicious of being bugs.

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

lint: fix lint warnings

Revision 1.377 / (download) - annotate - [select for diffs], Sat Sep 4 12:30:46 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.376: +10 -10 lines
Diff to previous 1.376 (colored) to selected 1.470 (colored)

lint: spell out abbreviations in comments

No functional change.

Revision 1.376 / (download) - annotate - [select for diffs], Sat Sep 4 10:09:19 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.375: +18 -23 lines
Diff to previous 1.375 (colored) to selected 1.470 (colored)

lint: sort operators in typeok_op according to ops.def

Well, except for INIT, FARG, RETURN.  These are listed at the very
bottom of the operators table but still behave much like ASSIGN.

No functional change.

Revision 1.375 / (download) - annotate - [select for diffs], Sat Sep 4 09:45:26 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.374: +48 -60 lines
Diff to previous 1.374 (colored) to selected 1.470 (colored)

lint: extract typeok_point and typeok_arrow from typeok_op

No functional change.

Revision 1.374 / (download) - annotate - [select for diffs], Sat Sep 4 09:26:21 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.373: +11 -29 lines
Diff to previous 1.373 (colored) to selected 1.470 (colored)

lint: clean up switch statement in typeok_op

In the old times where typeok_op was inlined into typeok, it was
necessary to write the complicated if-not-return-break.  Not anymore.

No functional change.

Revision 1.373 / (download) - annotate - [select for diffs], Sat Sep 4 09:18:25 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.372: +5 -7 lines
Diff to previous 1.372 (colored) to selected 1.470 (colored)

lint: make typeok_quest simpler

No functional change.

Revision 1.372 / (download) - annotate - [select for diffs], Fri Sep 3 22:48:49 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.371: +25 -2 lines
Diff to previous 1.371 (colored) to selected 1.470 (colored)

lint: set the return type of __builtin_*_overflow to bool, not int

Needed for inetd.c in strict bool mode.

Revision 1.371 / (download) - annotate - [select for diffs], Fri Sep 3 22:27:32 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.370: +25 -20 lines
Diff to previous 1.370 (colored) to selected 1.470 (colored)

lint: extract build_name_call from build_name

This reduces the indentation, providing enough space to write out the
full diagnostic in the code.  It also prepares for supporting GCC
builtins like __builtin_add_overflow, which return _Bool instead of int.

No functional change.

Revision 1.370 / (download) - annotate - [select for diffs], Thu Sep 2 20:10:17 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.369: +106 -63 lines
Diff to previous 1.369 (colored) to selected 1.470 (colored)

lint: split check_expr_misc into separate functions

No functional change.

Revision 1.369 / (download) - annotate - [select for diffs], Thu Sep 2 19:19:17 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.368: +162 -111 lines
Diff to previous 1.368 (colored) to selected 1.470 (colored)

lint: split check_assign_types_compatible into separate functions

No functional change.

Revision 1.368 / (download) - annotate - [select for diffs], Thu Sep 2 17:29:19 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.367: +4 -4 lines
Diff to previous 1.367 (colored) to selected 1.470 (colored)

lint: fix unintended warning for converting long long to signed char

Revision 1.367 / (download) - annotate - [select for diffs], Thu Sep 2 16:31:01 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.366: +12 -17 lines
Diff to previous 1.366 (colored) to selected 1.470 (colored)

lint: move a condition into should_warn_about_prototype_conversion

No functional change.

Revision 1.366 / (download) - annotate - [select for diffs], Thu Sep 2 16:16:49 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.365: +5 -9 lines
Diff to previous 1.365 (colored) to selected 1.470 (colored)

lint: clean up should_warn_about_prototype_conversion

Revision 1.365 / (download) - annotate - [select for diffs], Wed Sep 1 06:48:24 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.364: +11 -6 lines
Diff to previous 1.364 (colored) to selected 1.470 (colored)

lint: remove array creation from expr_derive_type

It is only used for creating string types.  The creation of other array
types happens in add_array.

This is a preparation to make all stored types const.

No functional change.

Revision 1.364 / (download) - annotate - [select for diffs], Tue Aug 31 19:17:45 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.363: +25 -23 lines
Diff to previous 1.363 (colored) to selected 1.470 (colored)

lint: extract condition for message 259 into separate function

No functional change.

Revision 1.363 / (download) - annotate - [select for diffs], Sun Aug 29 17:01:27 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.362: +3 -3 lines
Diff to previous 1.362 (colored) to selected 1.470 (colored)

lint: in C99 mode, make implicit function declarations an error

In tree.c 1.294 from 2021-06-28, I had already tried this, but at that
time, there were too many implicit function definitions in the NetBSD
tree.  Most of them were GCC builtins, which lint did not recognize.
Therefore I had to revert to a warning in tree.c 1.302 from 2021-06-30.

In the meantime, lint has learnt to recognize compiler builtins, see
is_compiler_builtin, so try again now.  The build logs from x86_64,
i386, sparc and sparc64 show no more implicit function declarations.

Revision 1.362 / (download) - annotate - [select for diffs], Sun Aug 29 16:17:08 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.361: +10 -11 lines
Diff to previous 1.361 (colored) to selected 1.470 (colored)

lint: treat _mm_ as builtin function name prefix for all compilers

This prefix is not specific to GCC, it is also known by the Intel C
Compiler and the Microsoft C compiler.

Revision 1.361 / (download) - annotate - [select for diffs], Sun Aug 29 15:49:04 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.360: +24 -12 lines
Diff to previous 1.360 (colored) to selected 1.470 (colored)

lint: add __sync_ and _mm_ as prefixes for builtin functions

These two additions cover all cases that occur in the current NetBSD
build on x86_64.  This allows build_name to use the usual pattern 'if
Sflag then error else if sflag then warning'.  That function currently
issues a warning in C99 as well, even though C99 prohibits implicit
function declarations.

Revision 1.360 / (download) - annotate - [select for diffs], Sat Aug 28 16:51:57 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.359: +4 -4 lines
Diff to previous 1.359 (colored) to selected 1.470 (colored)

lint: remove double inversion from is_out_of_char_range

No functional change.

Revision 1.359 / (download) - annotate - [select for diffs], Sat Aug 28 16:43:50 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.358: +12 -12 lines
Diff to previous 1.358 (colored) to selected 1.470 (colored)

lint: clean up check_integer_comparison

No functional change.

Revision 1.358 / (download) - annotate - [select for diffs], Sat Aug 28 16:36:54 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.357: +11 -5 lines
Diff to previous 1.357 (colored) to selected 1.470 (colored)

lint: do not emit GCC builtin functions

Lint1 no longer emits declarations of GCC builtin functions and calls to
them.

Previously, lint generated 3421 useless warnings in a default NetBSD
build, like this:

	__atomic_load_n, arg 1 used inconsistently
	    acl.c(216)[pointer to unsigned int]
	    rbtdb.c(921)[pointer to unsigned short]

This was because lint just doesn't understand that these functions are
type-generic, which is indeed unusual in C.

These useless warnings made the lint output more frightening than it
should actually be.  Together with the strange formatting of the
diagnostics (space-space-tab after the main message, two spaces and two
colons between the occurrences, symbols are listed in hashcode order),
this creates the impression that lint is not intended to be a
user-friendly tool.

For now, fix the excess warnings, leaving the other items for later.

Revision 1.357 / (download) - annotate - [select for diffs], Sat Aug 28 15:36:54 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.356: +4 -4 lines
Diff to previous 1.356 (colored) to selected 1.470 (colored)

lint: merge duplicate code in convert_constant_floating

Revision 1.356 / (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.355: +3 -3 lines
Diff to previous 1.355 (colored) to selected 1.470 (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.355 / (download) - annotate - [select for diffs], Sat Aug 28 12:59:25 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.354: +7 -7 lines
Diff to previous 1.354 (colored) to selected 1.470 (colored)

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

Lint does not need to support any types larger than 256 MB since they
don't occur in practice.  Practically, such large types have never been
supported at all since the function type_size_in_bits used int for the
internal calculations, resulting in overflows.

Revision 1.354 / (download) - annotate - [select for diffs], Sat Aug 28 12:29:40 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.353: +5 -5 lines
Diff to previous 1.353 (colored) to selected 1.470 (colored)

lint: remove redundant type casts from convert_constant_floating

Since tree.c 1.70 from 2012-03-27, lint has been using properly typed
constants for the min and max values, independent from the host
platform.

No functional change.

Revision 1.353 / (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.352: +9 -7 lines
Diff to previous 1.352 (colored) to selected 1.470 (colored)

lint: un-abbreviate unsigned integer types

No functional change.

Revision 1.352 / (download) - annotate - [select for diffs], Wed Aug 25 22:00:26 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.351: +13 -14 lines
Diff to previous 1.351 (colored) to selected 1.470 (colored)

lint: rename local variable in plength

The assertion in build_plus_minus is safe since that function is only
called if the types are compatible.  Pointer and floating are not
compatible.

No functional change.

Revision 1.351 / (download) - annotate - [select for diffs], Mon Aug 23 17:03:23 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.350: +23 -26 lines
Diff to previous 1.350 (colored) to selected 1.470 (colored)

lint: expand macro in string concatenation

No functional change.

Revision 1.350 / (download) - annotate - [select for diffs], Mon Aug 23 06:50:01 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.349: +3 -3 lines
Diff to previous 1.349 (colored) to selected 1.470 (colored)

lint: add quotes around placeholder in message 141

Revision 1.349 / (download) - annotate - [select for diffs], Mon Aug 23 06:32:30 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.348: +6 -9 lines
Diff to previous 1.348 (colored) to selected 1.470 (colored)

lint: make overflow check for binary '+' simpler

No functional change.

Revision 1.348 / (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.347: +11 -12 lines
Diff to previous 1.347 (colored) to selected 1.470 (colored)

lint: remove unnecessary width parameter for msb

No functional change.

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

lint: fix wrong warning about signed integer overflow in '-'

The newly added test cases in line 30 and 33 may or may not be worth a
warning since the expressions deal with unsigned integers, where the
behavior on overflow is well defined.

Revision 1.346 / (download) - annotate - [select for diffs], Sun Aug 22 21:27:15 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.345: +8 -9 lines
Diff to previous 1.345 (colored) to selected 1.470 (colored)

lint: merge duplicate code for binary operator

No functional change.

Revision 1.345 / (download) - annotate - [select for diffs], Sun Aug 22 21:17:04 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.344: +5 -4 lines
Diff to previous 1.344 (colored) to selected 1.470 (colored)

lint: fix folding of comparisons in constant expressions

Revision 1.344 / (download) - annotate - [select for diffs], Sat Aug 21 11:27:26 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.343: +34 -20 lines
Diff to previous 1.343 (colored) to selected 1.470 (colored)

lint: extract check_prototype_conversion_integer

No functional change.

Revision 1.343 / (download) - annotate - [select for diffs], Sat Aug 21 08:39:01 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.342: +21 -21 lines
Diff to previous 1.342 (colored) to selected 1.470 (colored)

lint: rename local variable '1' in fold_float

It looked too similar to the number 1.

Revision 1.342 / (download) - annotate - [select for diffs], Sat Aug 21 08:29:59 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.341: +10 -9 lines
Diff to previous 1.341 (colored) to selected 1.470 (colored)

lint: fix spacing in tree.c

Revision 1.341 / (download) - annotate - [select for diffs], Sat Aug 21 08:18:48 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.340: +39 -6 lines
Diff to previous 1.340 (colored) to selected 1.470 (colored)

lint: do not warn about '(void)arg' and similar expressions

In the current NetBSD build, 5260 of the 46264 total lint warnings are
about expressions that have a null effect.  Most of these occurrences
follow well-established patterns, which makes the warnings bogus.
Remove these warnings.

Revision 1.340 / (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.339: +11 -11 lines
Diff to previous 1.339 (colored) to selected 1.470 (colored)

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

No functional change.

Revision 1.339 / (download) - annotate - [select for diffs], Thu Aug 19 20:53:37 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.338: +10 -10 lines
Diff to previous 1.338 (colored) to selected 1.470 (colored)

lint: clean up formatting of 'fold'

Revision 1.338 / (download) - annotate - [select for diffs], Thu Aug 19 20:48:47 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.337: +3 -3 lines
Diff to previous 1.337 (colored) to selected 1.470 (colored)

lint: fix wrong integer overflow warning for unsigned types

Revision 1.337 / (download) - annotate - [select for diffs], Mon Aug 16 18:51:03 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.336: +2 -8 lines
Diff to previous 1.336 (colored) to selected 1.470 (colored)

lint: remove dead code from check_bad_enum_operation

There is a single caller of that function, and it checks the exact same
condition beforehand.

Revision 1.336 / (download) - annotate - [select for diffs], Sun Aug 15 14:26:39 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.335: +41 -18 lines
Diff to previous 1.335 (colored) to selected 1.470 (colored)

lint: extend check for unconst functions

The functions memchr, strpbrk, strrchr and strstr effectively remove the
const qualifier of their first argument, just like strchr.

Revision 1.335 / (download) - annotate - [select for diffs], Sun Aug 15 13:08:19 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.334: +3 -3 lines
Diff to previous 1.334 (colored) to selected 1.470 (colored)

lint: fix wrong warning about 'unsigned char >> constant'

Revision 1.334 / (download) - annotate - [select for diffs], Sat Aug 14 13:00:55 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.333: +5 -5 lines
Diff to previous 1.333 (colored) to selected 1.470 (colored)

lint: use standard quoting style for messages 124 and 184

Revision 1.333 / (download) - annotate - [select for diffs], Sat Aug 14 12:46:23 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.332: +6 -5 lines
Diff to previous 1.332 (colored) to selected 1.470 (colored)

lint: allow initialization of struct with constant member

The operator INIT, just like RETURN and FARG, initializes an object with
an expression.  The target object of such an initialization may be a
struct with constant members.

The operator ASSIGN, on the other hand, is entirely different.  It
overwrites the existing value of the object, and this is not allowed for
structs that have a constant member.  Therefore it was wrong to use the
operator ASSIGN for initialization.

Revision 1.332 / (download) - annotate - [select for diffs], Tue Aug 10 20:43:12 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.331: +9 -12 lines
Diff to previous 1.331 (colored) to selected 1.470 (colored)

lint: fix 3 of the 4 wrong messages about lvalue in initial assignment

Revision 1.331 / (download) - annotate - [select for diffs], Mon Aug 9 20:07:23 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.330: +63 -2 lines
Diff to previous 1.330 (colored) to selected 1.470 (colored)

lint: warn about 'char * = strchr(const char *, int)'

Found in findcc.c, there are about 25 other instances of this
incongruency in the whole source tree.

For more examples of functions from the C Standard Library that
implicitly remove the 'const' qualifier from an argument, see the C++
include file 'cstring'.

Revision 1.330 / (download) - annotate - [select for diffs], Tue Aug 3 21:09:26 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.329: +4 -33 lines
Diff to previous 1.329 (colored) to selected 1.470 (colored)

lint: merge almost duplicate code from 'sametype' into 'eqtype'

In 'sametype', the branch for comparing array types was unreachable
since it requires both tspecs to be the same, but t2 underwent the
array-to-pointer conversion.

Previously, lint warned about enum type mismatches, even without -e for
strict enum mode.  Instead, it got the case for 'char *' wrong, which is
now fixed.  Now lint behaves like GCC 10.3.0 in this regard.  The
warning about enum mismatch is useful though, so it may be re-added in a
future commit.

Revision 1.329 / (download) - annotate - [select for diffs], Tue Aug 3 20:57:06 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.328: +4 -4 lines
Diff to previous 1.328 (colored) to selected 1.470 (colored)

lint: union casts are only available as a GCC extension, not in C99

Revision 1.328 / (download) - annotate - [select for diffs], Tue Aug 3 18:38:02 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.327: +4 -3 lines
Diff to previous 1.327 (colored) to selected 1.470 (colored)

lint: casting to a struct is not allowed in C99, only with GCC

Revision 1.327 / (download) - annotate - [select for diffs], Tue Aug 3 17:44:59 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.326: +32 -2 lines
Diff to previous 1.326 (colored) to selected 1.470 (colored)

lint: clean up and move 'sametype'

This function is only used by lint1.  That's good since the lint2 code
was completely broken, as it would regard any two struct types as being
the same.

Remove the large switch statement since it is unlikely that there will
be new type derivations in C anytime soon.

No functional change.

Revision 1.326 / (download) - annotate - [select for diffs], Sun Aug 1 19:11:54 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.325: +4 -65 lines
Diff to previous 1.325 (colored) to selected 1.470 (colored)

lint: merge duplicate debugging code

The functions 'debug_node' and 'display_expression' were similar enough
to be merged.

Migrate debug_node to use the existing debug logging functions.

Remove the now unused option 'd' from the options string.

Revision 1.325 / (download) - annotate - [select for diffs], Sun Aug 1 18:37:29 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.324: +65 -67 lines
Diff to previous 1.324 (colored) to selected 1.470 (colored)

lint: remove option -d, clean up debug logging

The command line option -d was not used by /usr/bin/lint, and it only
triggered a handful of debug messages.  Move this debug logging over to
the compile-time -DDEBUG setting.

Move display_expression further up to avoid the forward declaration.

Revision 1.324 / (download) - annotate - [select for diffs], Sun Aug 1 14:45:39 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.323: +2 -4 lines
Diff to previous 1.323 (colored) to selected 1.470 (colored)

lint: remove unreachable code from usual arithmetic conversions

Revision 1.323 / (download) - annotate - [select for diffs], Sun Aug 1 13:49:17 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.322: +9 -3 lines
Diff to previous 1.322 (colored) to selected 1.470 (colored)

lint: fix usual arithmetic conversions for 128-bit integer types

Revision 1.322 / (download) - annotate - [select for diffs], Sat Jul 31 18:16:42 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.321: +2 -42 lines
Diff to previous 1.321 (colored) to selected 1.470 (colored)

lint: extract debug logging to separate file

Lint currently has several different kinds of debug log:

* The -DDEBUG log is controlled at compile time.
* The -d command line options enables some other debug logging.
* The -DYYDEBUG log for parsing is controlled at compile time.
* The -y command line option only has an effect in -DYYDEBUG mode.

Extracting the logging into a separate file is a first step towards
unifying these logs and making the code for debug logging stand out less
than the current #ifdef DEBUG.

No functional change.

Revision 1.321 / (download) - annotate - [select for diffs], Sat Jul 31 11:37:53 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.320: +9 -11 lines
Diff to previous 1.320 (colored) to selected 1.470 (colored)

lint: in has_constant_member, don't reuse variables

No functional change.

Revision 1.320 / (download) - annotate - [select for diffs], Sat Jul 31 11:03:04 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.319: +3 -4 lines
Diff to previous 1.319 (colored) to selected 1.470 (colored)

lint: merge duplicate code for generating unqualified type

This is a preparation for fixing the wrong warnings in msg_115.c.

No functional change.

Revision 1.319 / (download) - annotate - [select for diffs], Sun Jul 25 10:39:10 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.318: +12 -15 lines
Diff to previous 1.318 (colored) to selected 1.470 (colored)

lint: add type information to message about invalid cast

This probably doesn't matter in practice since the compiler is supposed
to catch this kind of error.  Adding the type information mainly ensures
that parsing abstract type names works as specified.

Revision 1.318 / (download) - annotate - [select for diffs], Tue Jul 20 19:44:36 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.317: +24 -24 lines
Diff to previous 1.317 (colored) to selected 1.470 (colored)

lint: use consistent naming scheme for functions that build nodes

No functional change.

Revision 1.317 / (download) - annotate - [select for diffs], Tue Jul 20 19:35:53 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.316: +13 -7 lines
Diff to previous 1.316 (colored) to selected 1.470 (colored)

lint: split 'build' into build_binary and build_unary

No functional change.

Revision 1.316 / (download) - annotate - [select for diffs], Thu Jul 15 21:22:19 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.315: +5 -2 lines
Diff to previous 1.315 (colored) to selected 1.470 (colored)

lint: allow pointer casts from 'char *' and 'unsigned char *'

For the sake of traditional code that did not yet migrate to using 'void
*' for arbitrary pointers.

In the standard NetBSD build, this reduces the number of lint warnings
by around 7000, of 57000 total.

Revision 1.315 / (download) - annotate - [select for diffs], Thu Jul 15 17:03:50 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.314: +3 -3 lines
Diff to previous 1.314 (colored) to selected 1.470 (colored)

lint: replace call to ttos with type_name

Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as
ttos and more expressive.  It can also be called multiple times without
invalidating the returned strings.

Used only in debug mode.

Revision 1.314 / (download) - annotate - [select for diffs], Wed Jul 14 17:07:24 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.313: +18 -2 lines
Diff to previous 1.313 (colored) to selected 1.470 (colored)

lint: extract build_member_access from the grammar

No functional change.

Revision 1.313 / (download) - annotate - [select for diffs], Tue Jul 6 04:44:20 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.312: +8 -8 lines
Diff to previous 1.312 (colored) to selected 1.470 (colored)

lint: rename type generic_association_types to generic_association

The word 'types' was misleading and unnecessary.

No functional change.

Revision 1.312 / (download) - annotate - [select for diffs], Sun Jul 4 17:28:05 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.311: +3 -3 lines
Diff to previous 1.311 (colored) to selected 1.470 (colored)

lint: replace wrong assumption with citation from C99

No functional change.

Revision 1.311 / (download) - annotate - [select for diffs], Sun Jul 4 17:16:09 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.310: +3 -2 lines
Diff to previous 1.310 (colored) to selected 1.470 (colored)

lint: document where to fix missing const in lvalue-to-rvalue

No functional change.

Revision 1.310 / (download) - annotate - [select for diffs], Sun Jul 4 17:01:58 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.309: +6 -6 lines
Diff to previous 1.309 (colored) to selected 1.470 (colored)

lint: align messages for invalid left operand of '.' or '->'

Revision 1.309 / (download) - annotate - [select for diffs], Sun Jul 4 16:44:13 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.308: +5 -8 lines
Diff to previous 1.308 (colored) to selected 1.470 (colored)

lint: clean up new_tnode

No functional change.

Revision 1.308 / (download) - annotate - [select for diffs], Sun Jul 4 13:14:54 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.307: +2 -6 lines
Diff to previous 1.307 (colored) to selected 1.470 (colored)

lint: remove remaining support for lvalue casts

These had been GCC extensions until GCC 3.4, they were removed in GCC
4.0.

Revision 1.307 / (download) - annotate - [select for diffs], Sun Jul 4 12:24:38 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.306: +2 -4 lines
Diff to previous 1.306 (colored) to selected 1.470 (colored)

lint: remove support for obsolete GCC-style lvalue casts

Since GCC 4.0, a cast results in an rvalue.

Revision 1.306 / (download) - annotate - [select for diffs], Sun Jul 4 09:13:59 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.305: +7 -7 lines
Diff to previous 1.305 (colored) to selected 1.470 (colored)

lint: in strict bool mode, allow mixed types in generated C code

This allows flex lexers to be run through lint in strict bool mode.

Revision 1.305 / (download) - annotate - [select for diffs], Sun Jul 4 08:19:06 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.304: +3 -5 lines
Diff to previous 1.304 (colored) to selected 1.470 (colored)

lint: remove outdated assertion

Since err.c 1.12 from 2000-07-06, lint allows to suppress individual
error messages.  Suppressed error messages do not increment nerr.
Keeping nerr at 0 had triggered the assertion.

Revision 1.304 / (download) - annotate - [select for diffs], Sat Jul 3 20:40:17 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.303: +5 -2 lines
Diff to previous 1.303 (colored) to selected 1.470 (colored)

lint: fix assertion failure in display_expression for bool constants

Revision 1.303 / (download) - annotate - [select for diffs], Wed Jun 30 14:42:13 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.302: +17 -3 lines
Diff to previous 1.302 (colored) to selected 1.470 (colored)

lint: do not warn about use of implicitly declared GCC builtins

Revision 1.302 / (download) - annotate - [select for diffs], Wed Jun 30 14:32:41 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.301: +3 -3 lines
Diff to previous 1.301 (colored) to selected 1.470 (colored)

lint: in C99 mode, only warn about implicit function declarations

Since tree.c 1.294 from 2021-06-28 (two days ago), lint errored out on
an implicit function declaration.  In principle it is correct to do so
since C99 requires it, but in practice there are a several functions
that are not declared in the translation unit itself since they are
provided by the compiler.  Typical examples for GCC and Clang are the
various functions named '__builtin_*' and '__atomic_*'.

For now, only warn about these but don't error out.

Revision 1.301 / (download) - annotate - [select for diffs], Wed Jun 30 14:23:50 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.300: +6 -6 lines
Diff to previous 1.300 (colored) to selected 1.470 (colored)

lint: mention the name of an implicitly declared function

In the regular NetBSD builds, this happened in swab.c:65.  That line
contains __predict_false, which may or may not be a macro.  In other
cases, there may be more than one function call in a single line.

Revision 1.300 / (download) - annotate - [select for diffs], Wed Jun 30 14:11:08 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.299: +3 -3 lines
Diff to previous 1.299 (colored) to selected 1.470 (colored)

lint: fix type name in message 101 for wrong member name

Revision 1.299 / (download) - annotate - [select for diffs], Wed Jun 30 12:28:03 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.298: +4 -3 lines
Diff to previous 1.298 (colored) to selected 1.470 (colored)

lint: improve comment about INT keeping t_is_enum

Revision 1.298 / (download) - annotate - [select for diffs], Tue Jun 29 21:16:54 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.297: +5 -10 lines
Diff to previous 1.297 (colored) to selected 1.470 (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.297 / (download) - annotate - [select for diffs], Tue Jun 29 20:44:38 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.296: +3 -12 lines
Diff to previous 1.296 (colored) to selected 1.470 (colored)

lint: do not sign-extend pointers

Sign extension only makes sense for integer types.

No idea why the code had tried to sign-extend pointers for the past 26
years.

Revision 1.296 / (download) - annotate - [select for diffs], Tue Jun 29 14:19:51 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.295: +7 -2 lines
Diff to previous 1.295 (colored) to selected 1.470 (colored)

lint: document where to fix the wrong warning for '\xff'

Revision 1.295 / (download) - annotate - [select for diffs], Tue Jun 29 10:12:35 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.294: +5 -5 lines
Diff to previous 1.294 (colored) to selected 1.470 (colored)

lint: fix typos in comment

Revision 1.294 / (download) - annotate - [select for diffs], Mon Jun 28 11:27:00 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.293: +6 -3 lines
Diff to previous 1.293 (colored) to selected 1.470 (colored)

lint: in C99 mode, complain about implicitly declared functions

C99, foreword, p5, item 22 lists among the major changes from C90:
"remove implicit function declaration".

Revision 1.293 / (download) - annotate - [select for diffs], Mon Jun 28 10:23:49 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.292: +4 -4 lines
Diff to previous 1.292 (colored) to selected 1.470 (colored)

lint: add type information to message 155 (type mismatch)

Revision 1.292 / (download) - annotate - [select for diffs], Sun Jun 27 21:16:40 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.291: +4 -3 lines
Diff to previous 1.291 (colored) to selected 1.470 (colored)

lint: fix type comparison in _Generic selection expressions

In the newly added test comma_expression, there were two distinct type
objects for the tspec DOUBLE.

Revision 1.291 / (download) - annotate - [select for diffs], Sun Jun 27 20:47:13 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.290: +16 -2 lines
Diff to previous 1.290 (colored) to selected 1.470 (colored)

lint: fix result type of _Generic expressions

Revision 1.290 / (download) - annotate - [select for diffs], Sun Jun 20 20:48:25 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.289: +3 -5 lines
Diff to previous 1.289 (colored) to selected 1.470 (colored)

lint: remove unnecessary call to print_tnode

For the possible operators that occur in message 324, print_tnode is
equivalent to op_name, and the latter is simpler.

When the function print_node was added to the code base, it had another
use in init.c, for understanding how initialization works in lint.  That
code has since been rewritten completely, therefore print_tnode is no
longer needed.  For debugging, display_expression is the better choice
since it has multi-line output and does not suffer from a fixed-length
buffer.

No functional change.

Revision 1.289 / (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.288: +13 -12 lines
Diff to previous 1.288 (colored) to selected 1.470 (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.288 / (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.287: +12 -12 lines
Diff to previous 1.287 (colored) to selected 1.470 (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.287 / (download) - annotate - [select for diffs], Tue Jun 15 20:46:45 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.286: +6 -6 lines
Diff to previous 1.286 (colored) to selected 1.470 (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.286 / (download) - annotate - [select for diffs], Tue Jun 15 18:23:39 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.285: +23 -16 lines
Diff to previous 1.285 (colored) to selected 1.470 (colored)

lint: extract convert_constant_to_floating

Revision 1.285 / (download) - annotate - [select for diffs], Tue Jun 15 18:16:11 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.284: +141 -108 lines
Diff to previous 1.284 (colored) to selected 1.470 (colored)

lint: split convert_constant_check_range

No functional change.

Revision 1.284 / (download) - annotate - [select for diffs], Tue Jun 15 17:17:14 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.283: +6 -9 lines
Diff to previous 1.283 (colored) to selected 1.470 (colored)

lint: merge duplicate code

Revision 1.283 / (download) - annotate - [select for diffs], Tue Jun 15 17:13:08 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.282: +135 -126 lines
Diff to previous 1.282 (colored) to selected 1.470 (colored)

lint: extract convert_constant_check_range

No functional change.

Revision 1.282 / (download) - annotate - [select for diffs], Tue Jun 15 16:56:00 2021 UTC (2 years, 10 months ago) by rillig
Branch: MAIN
Changes since 1.281: +73 -64 lines
Diff to previous 1.281 (colored) to selected 1.470 (colored)

lint: extract convert_constant_floating

No functional change.

Revision 1.281 / (download) - annotate - [select for diffs], Tue May 4 05:40:10 2021 UTC (2 years, 11 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.280: +10 -13 lines
Diff to previous 1.280 (colored) to selected 1.470 (colored)

lint: fix assertion failure when promoting a bit-field larger than int

Revision 1.280 / (download) - annotate - [select for diffs], Sun Apr 18 17:54:33 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.279: +5 -6 lines
Diff to previous 1.279 (colored) to selected 1.470 (colored)

lint: rename parameter to expr

That parameter used to be used for a single purpose, later it got used
for checking the reachability as well, which made the name misleading.

Revision 1.279 / (download) - annotate - [select for diffs], Sun Apr 18 17:47:32 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.278: +3 -3 lines
Diff to previous 1.278 (colored) to selected 1.470 (colored)

lint: remove redundant CONSTCOND

In do-while-0 loops, these are no longer needed since tree.c 1.202 from
2021-01-31.

Revision 1.278 / (download) - annotate - [select for diffs], Sun Apr 18 09:53:03 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.277: +5 -2 lines
Diff to previous 1.277 (colored) to selected 1.470 (colored)

lint: extend documentation about handling initializations

Revision 1.277 / (download) - annotate - [select for diffs], Sat Apr 17 16:58:04 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.276: +4 -3 lines
Diff to previous 1.276 (colored) to selected 1.470 (colored)

lint: do not warn about alignment when casting from incomplete struct

This removes a bunch of technically correct but practically useless
warnings from the regular NetBSD build.

Revision 1.276 / (download) - annotate - [select for diffs], Sat Apr 10 18:06:53 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.275: +6 -2 lines
Diff to previous 1.275 (colored) to selected 1.470 (colored)

lint: prepare renaming of 'struct type'

It's confusing to have the same struct tag in both lint1 and lint2, with
mostly the same members, but also some differences.  Before actually
changing this, I reviewed all occurrences of the word 'type' in the
code.

No functional change.

Revision 1.275 / (download) - annotate - [select for diffs], Fri Apr 9 21:42:12 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.274: +11 -2 lines
Diff to previous 1.274 (colored) to selected 1.470 (colored)

lint: fix wrong warning about uninitialized _Complex variable

Seen in divxc3.c.

Revision 1.274 / (download) - annotate - [select for diffs], Fri Apr 9 20:00:06 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.273: +5 -2 lines
Diff to previous 1.273 (colored) to selected 1.470 (colored)

lint: do not warn about pointer conversion to or from incomplete type

This cuts down the warnings in a NetBSD release build by about 38,000.

Revision 1.273 / (download) - annotate - [select for diffs], Fri Apr 9 19:52:59 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.272: +23 -29 lines
Diff to previous 1.272 (colored) to selected 1.470 (colored)

lint: clean up the check for pointer conversions

No functional change.

Revision 1.272 / (download) - annotate - [select for diffs], Thu Apr 8 19:20:54 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.271: +16 -5 lines
Diff to previous 1.271 (colored) to selected 1.470 (colored)

lint: don't warn about cast between pointers to compatible structs

Revision 1.271 / (download) - annotate - [select for diffs], Tue Apr 6 21:59:58 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.270: +5 -5 lines
Diff to previous 1.270 (colored) to selected 1.470 (colored)

lint: for shift in C99 mode, do not warn about difference to pre-C90

C99 is too far away from traditional C to make this warning useful.
There are 3 different situations in which this warning is generated:

For '1 << (unsigned char)1', the result type is 'unsigned int' in
traditional C.  The result type is unsigned because at least 1 of the
operators is unsigned, and it is 'unsigned int' because the usual
arithmetic promotions are applied.

For '1 >> (long)1', as well as for '1 << (long)1', the result type is
'long' in traditional C since the usual arithmetic promotions are
applied.

Omitting this warning in C99 mode reduces the amount of lint warnings in
a typical NetBSD release build by approximately 6800 of 107000 total.

Revision 1.270 / (download) - annotate - [select for diffs], Tue Apr 6 21:35:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.269: +17 -17 lines
Diff to previous 1.269 (colored) to selected 1.470 (colored)

lint: reduce indentation of typeok_shift

No functional change.

Revision 1.269 / (download) - annotate - [select for diffs], Tue Apr 6 21:32:57 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.268: +6 -4 lines
Diff to previous 1.268 (colored) to selected 1.470 (colored)

lint: add details to warning about too large shift amount

The previous message 'shift greater than size of object' was too short
to give reasonable hints, especially when the expressions involve
typedefs or macros.

Revision 1.268 / (download) - annotate - [select for diffs], Tue Apr 6 21:17:27 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.267: +5 -2 lines
Diff to previous 1.267 (colored) to selected 1.470 (colored)

lint: fix wrong warning about losing accuracy when converting to _Bool

Revision 1.267 / (download) - annotate - [select for diffs], Tue Apr 6 13:17:04 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.266: +3 -206 lines
Diff to previous 1.266 (colored) to selected 1.470 (colored)

lint: move check for strict bool mode into separate file

No functional change.

Revision 1.266 / (download) - annotate - [select for diffs], Mon Apr 5 02:05:47 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.265: +8 -3 lines
Diff to previous 1.265 (colored) to selected 1.470 (colored)

lint: warn about for wrong type cast in argument to ctype.h functions

The argument to most of the functions from <ctype.h> "shall either be
representable as an 'unsigned char' or shall equal the value of the
macro EOF".

When confronted with the infamous warning 'array subscript has type
char', there are enough programmers who don't know the background of
that warning and thus fix it in a wrong way.  Neither GCC nor Clang
explain its warning to target these programmers.

Both GCC and Clang warn about 'array subscript has type char', but they
ignore the other requirements of the <ctype.h> functions, even though
these are in the C standard library.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177
https://stackoverflow.com/a/60696378

Revision 1.265 / (download) - annotate - [select for diffs], Fri Apr 2 22:41:53 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.264: +3 -3 lines
Diff to previous 1.264 (colored) to selected 1.470 (colored)

lint: reword message about constant argument to '!'

In the other messages, operators are typically written in their literal
form as well.  Using single quotes disambiguates them from normal
punctuation.

Revision 1.264 / (download) - annotate - [select for diffs], Fri Apr 2 17:10:52 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.263: +5 -5 lines
Diff to previous 1.263 (colored) to selected 1.470 (colored)

lint: fix typo from previous commit in merge_qualifiers

Revision 1.263 / (download) - annotate - [select for diffs], Fri Apr 2 17:01:39 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.262: +24 -33 lines
Diff to previous 1.262 (colored) to selected 1.470 (colored)

lint: clean up merge_qualifiers

No functional change.

Revision 1.262 / (download) - annotate - [select for diffs], Fri Apr 2 16:38:08 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.261: +16 -16 lines
Diff to previous 1.261 (colored) to selected 1.470 (colored)

lint: rename local variable in build_colon

The name 'rtp' was confusing since it did not correspond to 'rn'.  The
'r' meant 'result', not 'right-hand side'.

No functional change.

Revision 1.261 / (download) - annotate - [select for diffs], Fri Apr 2 16:17:19 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.260: +17 -19 lines
Diff to previous 1.260 (colored) to selected 1.470 (colored)

lint: replace a new modtab with op_name

This reduces the types of variables that are passed around.

No functional change.

Revision 1.260 / (download) - annotate - [select for diffs], Fri Apr 2 15:06:35 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.259: +19 -19 lines
Diff to previous 1.259 (colored) to selected 1.470 (colored)

lint: rename getopname to op_name

There are several functions called 'get' that allocate memory.  Remove
this possible confusion.

No functional change.

Revision 1.259 / (download) - annotate - [select for diffs], Fri Apr 2 12:16:50 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.258: +18 -18 lines
Diff to previous 1.258 (colored) to selected 1.470 (colored)

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

No functional change.

Revision 1.258 / (download) - annotate - [select for diffs], Fri Apr 2 11:53:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.257: +9 -9 lines
Diff to previous 1.257 (colored) to selected 1.470 (colored)

lint: rename functions for duplicating types

No functional change.

Revision 1.257 / (download) - annotate - [select for diffs], Fri Apr 2 10:13:03 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.256: +47 -46 lines
Diff to previous 1.256 (colored) to selected 1.470 (colored)

lint: name memory allocation functions consistently

No functional change.

Revision 1.256 / (download) - annotate - [select for diffs], Fri Apr 2 09:52:36 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.255: +9 -9 lines
Diff to previous 1.255 (colored) to selected 1.470 (colored)

lint: rename getnode to expr_zalloc_tnode

The new name highlights that the returned memory is only valid in the
scope of the current expression.  This was misleading before since the
other related functions all have a 't' (probably for 'temporary') in
their names.

Also encode in the function name that the returned memory is zeroed out
as that could not be inferred from the old name.

No functional change.

Revision 1.255 / (download) - annotate - [select for diffs], Thu Apr 1 15:06:49 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.254: +2 -6 lines
Diff to previous 1.254 (colored) to selected 1.470 (colored)

lint: remove wrong assumption from comment

The size in bits of a struct or union is not measured at all at this
point since portable_size_in_bits only takes the broad type
classification (tspec_t), not the precise type information (type_t).

No functional change.

Revision 1.254 / (download) - annotate - [select for diffs], Tue Mar 30 15:18:19 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.253: +4 -4 lines
Diff to previous 1.253 (colored) to selected 1.470 (colored)

lint: add type information for message about unknown member name

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

lint: sprinkle const on function declarations

No functional change.

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

lint: remove space between 'sizeof ('

No functional change.

Revision 1.251 / (download) - annotate - [select for diffs], Fri Mar 26 23:17:33 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.250: +3 -3 lines
Diff to previous 1.250 (colored) to selected 1.470 (colored)

lint: add quotes around placeholder in message about undefined variable

Before: error: expected undefined [99]
After:  error: 'expected' undefined [99]

Seen in external/mpl/bind, which for Clang defines in stdatomic.h:
> #define atomic_exchange_explicit(obj, desired, order) \
>     __c11_atomic_exchange_explicit(obj, expected, order)
Note the mismatch between 'desired' and 'expected'.

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

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

No functional change.

Revision 1.249 / (download) - annotate - [select for diffs], Fri Mar 26 16:59:18 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.248: +5 -2 lines
Diff to previous 1.248 (colored) to selected 1.470 (colored)

lint: allow pointer cast to 'char *' and 'unsigned char *'

This reduces the number of warnings in the regular NetBSD build by 5560.

Revision 1.248 / (download) - annotate - [select for diffs], Fri Mar 26 16:53:19 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.247: +16 -17 lines
Diff to previous 1.247 (colored) to selected 1.470 (colored)

lint: rename variables in check_pointer_conversion

No functional change.

Revision 1.247 / (download) - annotate - [select for diffs], Fri Mar 26 16:45:06 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.246: +21 -9 lines
Diff to previous 1.246 (colored) to selected 1.470 (colored)

lint: extract decision for warning about pointer cast

This makes the code several lines longer but way more readable.  In the
previous dense expression it was hard to see what was going on at all
and that there are two completely separate situations in which this
warning applies.

No functional change.

Revision 1.246 / (download) - annotate - [select for diffs], Mon Mar 22 15:29:43 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.245: +27 -20 lines
Diff to previous 1.245 (colored) to selected 1.470 (colored)

lint: use precise type information in message about type mismatch

While here, reword the message, avoiding operators and parentheses.

Since 2021-01-02, providing the precise type name is as easy as the
broad type classification (just replace tspec_name with type_name), and
it's definitely more useful to the human readers.

Revision 1.245 / (download) - annotate - [select for diffs], Sun Mar 21 19:08:10 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.244: +8 -8 lines
Diff to previous 1.244 (colored) to selected 1.470 (colored)

lint: invert 'rchflag', call it warn_about_unreachable instead

No functional change.

Revision 1.244 / (download) - annotate - [select for diffs], Sun Mar 21 18:58:34 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.243: +5 -2 lines
Diff to previous 1.243 (colored) to selected 1.470 (colored)

lint: reduce number of places where 'reached' is set

When determining the reachability of a statement, the idea was that
whenever 'reached' was set to false, 'rchflg' (the abbreviation for "do
not warn about unreachable statements") would be reset as well.

In some (trivial) cases, this was done, but many more interesting cases
simply forgot to set this second variable.  To prevent this in the
future, encapsulate this in a simple helper function.

Now even if a statement is reachable, 'rchflg' gets reset.  This does
not hurt since as long as the current statement is reachable, the value
of 'rchflg' does not matter.

No functional change.  There would be quite a big functional change
though if check_statement_reachable were to reset 'rchflg' instead of
'reached', as the comment already suggests.  In that case, with the
current code, many legitimate warnings about unreachable statements
would be skipped, especially those involving 'if' statements, since
these didn't reset 'rchflg' properly before.

Revision 1.243 / (download) - annotate - [select for diffs], Sun Mar 21 11:48:04 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.242: +4 -3 lines
Diff to previous 1.242 (colored) to selected 1.470 (colored)

lint: fix wrong 'statement not reached' in do-while loop

Revision 1.242 / (download) - annotate - [select for diffs], Sat Mar 20 21:08:09 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.241: +6 -7 lines
Diff to previous 1.241 (colored) to selected 1.470 (colored)

lint: clean up new_name_node

No functional change.

Revision 1.241 / (download) - annotate - [select for diffs], Sat Mar 20 20:56:58 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.240: +14 -8 lines
Diff to previous 1.240 (colored) to selected 1.470 (colored)

lint: move getopname over to tree.c

Except for the one use in print_tnode, the name of the operator is only
used in tree.c.

No functional change.

Revision 1.240 / (download) - annotate - [select for diffs], Sat Mar 20 20:39:35 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.239: +9 -9 lines
Diff to previous 1.239 (colored) to selected 1.470 (colored)

lint: remove redundant operator properties table

It's enough to have modtab, which describes the properties of the
various operators.  There is no need to have a second table imods that
holds the same content.  Rather make modtab constant as well.

The only possible functional change is that the names of the internal
operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in
diagnostics, where previously lint invoked undefined behavior by passing
a null pointer for a '%s' conversion specifier.

Revision 1.239 / (download) - annotate - [select for diffs], Sat Mar 20 18:38:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.238: +4 -7 lines
Diff to previous 1.238 (colored) to selected 1.470 (colored)

lint: inline access to type properties in check_bad_enum_operation

No functional change.

Revision 1.238 / (download) - annotate - [select for diffs], Sat Mar 20 17:18:50 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.237: +3 -3 lines
Diff to previous 1.237 (colored) to selected 1.470 (colored)

lint: in strict bool mode, check initialization as well

C99 6.7.8p11 says for initialization that "the same type constraints and
conversions as for simple assignments apply", so actually apply them.
(I had just forgotten this "operator" when I first implemented strict
bool mode.)

Revision 1.237 / (download) - annotate - [select for diffs], Fri Mar 19 08:21:26 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.236: +4 -4 lines
Diff to previous 1.236 (colored) to selected 1.470 (colored)

lint: rename in_bit to in_bits

No functional change.

Revision 1.236 / (download) - annotate - [select for diffs], Fri Mar 19 08:19:24 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.235: +6 -6 lines
Diff to previous 1.235 (colored) to selected 1.470 (colored)

lint: rename tsize to type_size_in_bits

The shorter name size_in_bits was already taken by the function-like
macro with argument type tspec_t.

No functional change.

Revision 1.235 / (download) - annotate - [select for diffs], Thu Mar 18 22:05:33 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.234: +11 -12 lines
Diff to previous 1.234 (colored) to selected 1.470 (colored)

lint: make the debug log for nodes more readable

The operator NAME has the name 'name', therefore no special case is
needed.

Having the words 'with type' in the message makes the message easier to
find from the debug log.  Given that the operator name is used unquoted,
the log message 'name: int value=111' was nearly impossible to find in
the code.

Replace the '()' with an actual word, to avoid any confusion about
whether the type name might be a function type without prototype.

Reduce the amount of '=' signs, instead use commas to separate the
properties of the node.

No functional change outside debug mode.

Revision 1.234 / (download) - annotate - [select for diffs], Thu Mar 18 21:26:56 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.233: +3 -3 lines
Diff to previous 1.233 (colored) to selected 1.470 (colored)

lint: reword message about type mismatch in initialization

Using parentheses for quotes is unusual, furthermore the previous
message didn't follow proper grammar rules, sacrificing clarity for
brevity.

Revision 1.233 / (download) - annotate - [select for diffs], Wed Mar 17 01:15:31 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.232: +4 -4 lines
Diff to previous 1.232 (colored) to selected 1.470 (colored)

lint: rename 'blklev' to 'block_level'

No functional change.

Revision 1.232 / (download) - annotate - [select for diffs], Sun Feb 28 22:12:16 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.231: +10 -2 lines
Diff to previous 1.231 (colored) to selected 1.470 (colored)

lint: fix null pointer dereference on parse error

Fixes PR bin/22119.

Revision 1.231 / (download) - annotate - [select for diffs], Sun Feb 28 20:04:52 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.230: +6 -2 lines
Diff to previous 1.230 (colored) to selected 1.470 (colored)

lint: document where in C99 the behavior of cconv is specified

Revision 1.230 / (download) - annotate - [select for diffs], Sun Feb 28 19:24:15 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.229: +3 -3 lines
Diff to previous 1.229 (colored) to selected 1.470 (colored)

lint: replace wrong comment with assertion

The broad type of a value is indeed stored in the value itself, in the
member v_tspec.  For nodes that refer to this value, it is redundantly
stored, it always equals tn->tn_type->t_tspec.

After initialization, neither tn->tn_type nor val->v_tspec are modified.
This is not ensured by the compiler but has to be analyzed manually.

No functional change.

Revision 1.229 / (download) - annotate - [select for diffs], Sun Feb 28 19:16:05 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.228: +4 -4 lines
Diff to previous 1.228 (colored) to selected 1.470 (colored)

lint: rename is_nonzero to constant_is_nonzero

The new function name emphasizes that the given node must have the
operator CON.

No functional change.

Revision 1.228 / (download) - annotate - [select for diffs], Sun Feb 28 18:51:51 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.227: +35 -31 lines
Diff to previous 1.227 (colored) to selected 1.470 (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.227 / (download) - annotate - [select for diffs], Sun Feb 28 03:59:28 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.226: +17 -5 lines
Diff to previous 1.226 (colored) to selected 1.470 (colored)

lint: do not warn about constant expressions involving sizeof

These expressions are indeed constant for a specific platform, but on
another platform their value may change.  This makes them unsuspicious
and legitimate for portable code.

Seen in rump_syscalls.c, as 'sizeof(int) > sizeof(register_t)'.

Revision 1.226 / (download) - annotate - [select for diffs], Sun Feb 28 03:33:18 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.225: +4 -4 lines
Diff to previous 1.225 (colored) to selected 1.470 (colored)

lint: rename parameter in function 'expr'

For symmetry with the function is_constcond_false.

No functional change.

Revision 1.225 / (download) - annotate - [select for diffs], Sun Feb 28 02:00:05 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.224: +4 -4 lines
Diff to previous 1.224 (colored) to selected 1.470 (colored)

lint: add type information for 'incompatible struct pointers'

Revision 1.224 / (download) - annotate - [select for diffs], Sun Feb 28 01:30:22 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.223: +5 -4 lines
Diff to previous 1.223 (colored) to selected 1.470 (colored)

lint: add type information to enum type mismatch

Revision 1.223 / (download) - annotate - [select for diffs], Sun Feb 28 01:06:57 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.222: +8 -8 lines
Diff to previous 1.222 (colored) to selected 1.470 (colored)

lint: make messages for incompatible pointers more specific

Message 153 didn't state obviously which of the pointer types was the
one before conversion (or cast) and which was the resulting type.

Message 229 didn't have any type information at all.

Revision 1.222 / (download) - annotate - [select for diffs], Sun Feb 28 00:40:22 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.221: +4 -4 lines
Diff to previous 1.221 (colored) to selected 1.470 (colored)

lint: add type information to 'possible pointer alignment problem [135]'

This warning occurs more than 7400 times in a regular NetBSD build, and
without giving any type information, leaves the reader clueless about
what the underlying issue might be.  Add type information since that is
a no-brainer to implement.

Revision 1.221 / (download) - annotate - [select for diffs], Sun Feb 28 00:28:47 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.220: +7 -7 lines
Diff to previous 1.220 (colored) to selected 1.470 (colored)

lint: skip alignment computation if possible

Testing a global variable is simpler than calling a 20-line function.

No functional change.

Revision 1.220 / (download) - annotate - [select for diffs], Sun Feb 28 00:23:55 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.219: +5 -4 lines
Diff to previous 1.219 (colored) to selected 1.470 (colored)

lint: rename getbound to alignment_in_bits

No functional change.

Revision 1.219 / (download) - annotate - [select for diffs], Sat Feb 27 15:26:30 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.218: +5 -5 lines
Diff to previous 1.218 (colored) to selected 1.470 (colored)

lint: rename confusing local variable

The variable name rtp is reserved for the type of the right-hand
operand.

No functional change.

Revision 1.218 / (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.217: +8 -8 lines
Diff to previous 1.217 (colored) to selected 1.470 (colored)

lint: change spelling of initialisation to initialization

That's the wording from the ISO C99 standard.

Revision 1.217 / (download) - annotate - [select for diffs], Mon Feb 22 15:01:03 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.216: +4 -4 lines
Diff to previous 1.216 (colored) to selected 1.470 (colored)

lint: improve debug message and comment

Revision 1.216 / (download) - annotate - [select for diffs], Sun Feb 21 15:02:16 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.215: +3 -3 lines
Diff to previous 1.215 (colored) to selected 1.470 (colored)

lint: extract check_non_constant_initializer from init_using_expr

No functional change.

Revision 1.215 / (download) - annotate - [select for diffs], Sun Feb 21 11:23:33 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.214: +10 -10 lines
Diff to previous 1.214 (colored) to selected 1.470 (colored)

lint: always initialize return values of constant_addr

Before, the caller was responsible for initializing the return values
from the function.  This was an unexpected burden.

Ensure that in each branch that returns true, both return values are
properly set.

Strangely, the only caller of that function, init_using_expr, uses
neither of the return values.  It just tests whether the expression is
constant or not.

No functional change.

Revision 1.214 / (download) - annotate - [select for diffs], Sun Feb 21 10:28:33 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.213: +5 -4 lines
Diff to previous 1.213 (colored) to selected 1.470 (colored)

lint: add type information to message about enum mismatch

Revision 1.213 / (download) - annotate - [select for diffs], Sun Feb 21 07:21:57 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.212: +7 -11 lines
Diff to previous 1.212 (colored) to selected 1.470 (colored)

lint: indent node details in debug mode

Revision 1.212 / (download) - annotate - [select for diffs], Sat Feb 20 19:10:38 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.211: +6 -10 lines
Diff to previous 1.211 (colored) to selected 1.470 (colored)

lint: fix lint warnings

No functional change.

Revision 1.211 / (download) - annotate - [select for diffs], Sat Feb 20 18:55:10 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.210: +10 -3 lines
Diff to previous 1.210 (colored) to selected 1.470 (colored)

lint: do not warn about 'do { ... } while (false)' in strict bool mode

Revision 1.210 / (download) - annotate - [select for diffs], Sat Feb 20 16:34:57 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.209: +13 -13 lines
Diff to previous 1.209 (colored) to selected 1.470 (colored)

lint: extend debugging for initializing objects

No functional change outside debug mode.

Revision 1.209 / (download) - annotate - [select for diffs], Fri Feb 19 22:27:49 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.208: +12 -12 lines
Diff to previous 1.208 (colored) to selected 1.470 (colored)

lint: rename t_isenum and t_aincompl to be more expressive

No functional change.

Revision 1.208 / (download) - annotate - [select for diffs], Fri Feb 19 22:16:12 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.207: +11 -11 lines
Diff to previous 1.207 (colored) to selected 1.470 (colored)

lint: rename str_t and its members to be more expressive

No functional change.

Revision 1.207 / (download) - annotate - [select for diffs], Mon Feb 15 07:40:18 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.206: +2 -3 lines
Diff to previous 1.206 (colored) to selected 1.470 (colored)

lint: remove redundant comment

That comment was useful when there was no function is_null_pointer.
Back then, the code for testing a null pointer was written in-line,
which made it really hard to see what's going on.  This is no longer the
case.

Revision 1.206 / (download) - annotate - [select for diffs], Mon Feb 15 07:36:40 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.205: +29 -24 lines
Diff to previous 1.205 (colored) to selected 1.470 (colored)

lint: extract typeok_colon_pointer from typeok_colon

The subtype information is now only accessed if both operands are
actually pointers.

No functional change.

Revision 1.205 / (download) - annotate - [select for diffs], Thu Feb 4 06:54:59 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.204: +4 -4 lines
Diff to previous 1.204 (colored) to selected 1.470 (colored)

lint: add back "due to prototype" to message 259

That message is only supposed to warn about compatibility to traditional
C, in case the function should ever be compiled without its prototype
being in effect.  All other type checks are supposed to be in another
function, as documented, but that type check misses to report a few
error-prone type combinations (long to char, long to int).

30 years after the introduction of prototypes with C90, almost all
existing code uses prototypes.  The warning has thus lost most of its
usefulness and can rather be confusing since a conversion from 'char' to
'long' is not problematic with prototypes in action, and the probability
of the code being backported to a pre-C90 compiler is diminishingly
small.

The words "due to prototype" now serve as a hint again.  The proper fix
could be to suppress this warning in C99 mode since that's far enough
from traditional C.

Revision 1.204 / (download) - annotate - [select for diffs], Sun Jan 31 14:05:00 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.203: +6 -6 lines
Diff to previous 1.203 (colored) to selected 1.470 (colored)

lint: reword message 259 about function argument conversion

The words "due to prototype" are an anachronism from the 1990s.
Nowadays every function is defined using a prototype, which makes these
words redundant.

Revision 1.203 / (download) - annotate - [select for diffs], Sun Jan 31 13:56:14 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.202: +8 -6 lines
Diff to previous 1.202 (colored) to selected 1.470 (colored)

lint: make warning about function argument conversion more detailed

For every conversion it is useful to know both the source and the target
type since these are not always obvious from the code.

The only surprise is the warning in d_gcc_extension.  The conversion
there is from 'double' to 'long double', which is a lossless conversion.
This may be a bug in lint.

Revision 1.202 / (download) - annotate - [select for diffs], Sun Jan 31 12:44:34 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.201: +6 -4 lines
Diff to previous 1.201 (colored) to selected 1.470 (colored)

lint: don't warn about constant condition in 'do { } while (0)'

Revision 1.201 / (download) - annotate - [select for diffs], Sun Jan 31 12:20:00 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.200: +5 -3 lines
Diff to previous 1.200 (colored) to selected 1.470 (colored)

lint: fix strange message about nested '==' operators

If one of the nested subexpressions is parenthesized, the author
probably knew how these expressions are evaluated.  Therefore don't warn
in such a situation.

Maybe the original author once made a typo and tried to initialize
variables but instead compared them, like this:

	int a, b, c;

	a == b == c;

This would explain the text of the message, which still sounds strange.
At least it doesn't show up as often anymore.

Revision 1.200 / (download) - annotate - [select for diffs], Sun Jan 31 11:44:48 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.199: +8 -8 lines
Diff to previous 1.199 (colored) to selected 1.470 (colored)

lint: mention the operator in messages about bit shifts

Revision 1.199 / (download) - annotate - [select for diffs], Sat Jan 30 23:15:32 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.198: +23 -25 lines
Diff to previous 1.198 (colored) to selected 1.470 (colored)

lint: flatten has_side_effect

Since GCC performs tail call optimization, the generated code is
practically the same.

Replace redundant comments with open questions.

No functional change.

Revision 1.198 / (download) - annotate - [select for diffs], Sat Jan 30 23:05:08 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.197: +5 -14 lines
Diff to previous 1.197 (colored) to selected 1.470 (colored)

lint: fix wrong 'expression has null effect'

Revision 1.197 / (download) - annotate - [select for diffs], Sat Jan 30 22:48:50 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.196: +14 -9 lines
Diff to previous 1.196 (colored) to selected 1.470 (colored)

lint: extract has_side_effect from check_null_effect

No functional change.

Revision 1.196 / (download) - annotate - [select for diffs], Sat Jan 30 21:58:04 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.195: +4 -4 lines
Diff to previous 1.195 (colored) to selected 1.470 (colored)

lint: add type information to message 275

Before:	cast discards 'const' from pointer target type
After:	cast discards 'const' from type 'pointer to const char'

Seen in sqlite3.c.

Revision 1.195 / (download) - annotate - [select for diffs], Sat Jan 30 21:49:08 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.194: +4 -4 lines
Diff to previous 1.194 (colored) to selected 1.470 (colored)

lint: add type information to warning about troublesome casts

The previous warning text did not mention the actual types that are
involved in the type conversion.  These types can be hard to see from
the source code as soon as macros are involved, and even in plain code,
one would have to follow the declarations, which is an unnecessary
burden.  Lint already has all information about the involved types, so
there is no reason for omitting this crucial information.

Seen in external/mit/lua/dist/src/lvm.c and several other files.
Including the type information in the message immediately makes the
message scarier.

Before:	pointer casts may be troublesome
After:	pointer cast from 'pointer to struct TString' to 'pointer to
	union GCUnion' may be troublesome

Revision 1.194 / (download) - annotate - [select for diffs], Sat Jan 30 18:16:45 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.193: +11 -11 lines
Diff to previous 1.193 (colored) to selected 1.470 (colored)

lint: rename incompl to is_incomplete

No functional change.

Revision 1.193 / (download) - annotate - [select for diffs], Sat Jan 30 18:14:25 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.192: +3 -4 lines
Diff to previous 1.192 (colored) to selected 1.470 (colored)

lint: fix type conversion for very large data types

Data types that are 4 GB or larger are an edge case.  Nevertheless,
compute their size correctly.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Jan 30 18:12:07 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.191: +8 -8 lines
Diff to previous 1.191 (colored) to selected 1.470 (colored)

lint: remove redundant parentheses

No functional change.

Revision 1.191 / (download) - annotate - [select for diffs], Sun Jan 24 14:47:43 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.190: +11 -49 lines
Diff to previous 1.190 (colored) to selected 1.470 (colored)

lint: reduce preprocessor magic for platform target types

Revision 1.190 / (download) - annotate - [select for diffs], Sun Jan 24 11:34:01 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.189: +28 -33 lines
Diff to previous 1.189 (colored) to selected 1.470 (colored)

lint: extract duplicate code into is_null_pointer

No functional change.

Revision 1.189 / (download) - annotate - [select for diffs], Sun Jan 24 11:21:58 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.188: +4 -6 lines
Diff to previous 1.188 (colored) to selected 1.470 (colored)

lint: fix wrong warning about null pointer comparison

Revision 1.188 / (download) - annotate - [select for diffs], Sun Jan 24 10:57:17 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.187: +6 -6 lines
Diff to previous 1.187 (colored) to selected 1.470 (colored)

lint: fix local variable names in check_pointer_comparison

Revision 1.187 / (download) - annotate - [select for diffs], Sun Jan 24 10:55:11 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.186: +12 -12 lines
Diff to previous 1.186 (colored) to selected 1.470 (colored)

lint: clean up typeok_eq and check_pointer_comparison

Since typeok_eq does not issue any diagnostics, prefix it with "is_".

By convention, the variable rt aliases rn->tn_type->t_tspec.  Make it
obvious that in check_pointer_comparison, rt corresponds to the subtype
of the pointer.

Revision 1.186 / (download) - annotate - [select for diffs], Sun Jan 24 10:50:42 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.185: +4 -2 lines
Diff to previous 1.185 (colored) to selected 1.470 (colored)

lint: document bug in typeok_eq

Since rt is an alias for rn->tn_type->t_tspec, it cannot be PTR and VOID
at the same time.  This makes the condition unsatisfiable.  Removing
that part of the code didn't show any change in behavior, as expected.

It may even be that fixing this obvious bug doesn't show any change in
behavior since that function is only used in a single place and
check_pointer_comparison performs its own checks before issuing any
warning.

At least the test cases added to msg_124.c all run as expected.

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jan 24 00:15:20 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.184: +5 -5 lines
Diff to previous 1.184 (colored) to selected 1.470 (colored)

lint: update data types in comments from int to bool

Revision 1.184 / (download) - annotate - [select for diffs], Sat Jan 23 22:34:01 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.183: +6 -8 lines
Diff to previous 1.183 (colored) to selected 1.470 (colored)

lint: fix error message for relaxed bool operations in system headers

In strict mode, allowing 1 as bool constant expression is probably not
needed in practice since most comparisons are != 0 instead of == 0.

Furthermore, in the expression (flags & 0x0002) == true, comparing with
true is misleading since the '==' operator can never evaluate to true in
this case.

Revision 1.183 / (download) - annotate - [select for diffs], Sat Jan 23 22:20:17 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.182: +65 -27 lines
Diff to previous 1.182 (colored) to selected 1.470 (colored)

lint: fix two wrong error messages in strict bool mode

The strict bool mode gets complicated because for system headers the
rules need to be relaxed since they cannot be changed easily, often not at all.

Still, if lint validates a program in strict bool mode, that program
must run with equal behavior regarding boolean expressions even on a
pre-C99 platform.

Revision 1.182 / (download) - annotate - [select for diffs], Mon Jan 18 20:02:34 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.181: +32 -40 lines
Diff to previous 1.181 (colored) to selected 1.470 (colored)

lint: clean up code (mostly comments)

Revision 1.181 / (download) - annotate - [select for diffs], Sun Jan 17 23:04:09 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.180: +18 -6 lines
Diff to previous 1.180 (colored) to selected 1.470 (colored)

lint: allow system headers to use int as bool, even in strict bool mode

Revision 1.180 / (download) - annotate - [select for diffs], Sun Jan 17 17:16:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.179: +5 -5 lines
Diff to previous 1.179 (colored) to selected 1.470 (colored)

lint: rename typeok_amper to typeok_address

This is about the address-of operator, not about the '&' sign that is
also used for bitwise and.

Revision 1.179 / (download) - annotate - [select for diffs], Sun Jan 17 17:14:34 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.178: +6 -6 lines
Diff to previous 1.178 (colored) to selected 1.470 (colored)

lint: add type information to message 126

Revision 1.178 / (download) - annotate - [select for diffs], Sun Jan 17 16:32:36 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.177: +17 -16 lines
Diff to previous 1.177 (colored) to selected 1.470 (colored)

lint: flatten typeok_ordered_comparison

Revision 1.177 / (download) - annotate - [select for diffs], Sun Jan 17 16:25:30 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.176: +6 -7 lines
Diff to previous 1.176 (colored) to selected 1.470 (colored)

lint: extend a few message comments

Revision 1.176 / (download) - annotate - [select for diffs], Sun Jan 17 16:19:54 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.175: +3 -3 lines
Diff to previous 1.175 (colored) to selected 1.470 (colored)

lint: add test for incrementing const variable

Revision 1.175 / (download) - annotate - [select for diffs], Sun Jan 17 16:01:19 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.174: +5 -6 lines
Diff to previous 1.174 (colored) to selected 1.470 (colored)

lint: clean up typeok_ordered_comparison

Revision 1.174 / (download) - annotate - [select for diffs], Sun Jan 17 15:40:27 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.173: +17 -18 lines
Diff to previous 1.173 (colored) to selected 1.470 (colored)

lint: fix return type of conaddr

Revision 1.173 / (download) - annotate - [select for diffs], Sun Jan 17 15:31:11 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.172: +15 -12 lines
Diff to previous 1.172 (colored) to selected 1.470 (colored)

lint: reduce scope of local variables in check_expr_misc

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jan 17 15:24:03 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.171: +27 -27 lines
Diff to previous 1.171 (colored) to selected 1.470 (colored)

lint: replace integer constants with bool constants

Revision 1.171 / (download) - annotate - [select for diffs], Sun Jan 17 15:06:54 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.170: +18 -18 lines
Diff to previous 1.170 (colored) to selected 1.470 (colored)

lint: rename bitwise operators

When there are several variants of the AND operator, both of them should
get a distinguishing prefix, otherwise it's not clear which of the two
possible operators is meant by the plain AND.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Jan 17 14:55:22 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.169: +12 -12 lines
Diff to previous 1.169 (colored) to selected 1.470 (colored)

lint: rename operator STAR to INDIR

C99 calls this operator the "indirection operator".  The word "star"
does not occur in the index of that standard.

Revision 1.169 / (download) - annotate - [select for diffs], Sun Jan 17 14:50:11 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.168: +12 -12 lines
Diff to previous 1.168 (colored) to selected 1.470 (colored)

lint: rename operator AMPER to ADDR

There is no operator called 'ampersand'.  The ampersand sign is merely
the textual representation of both the operator ADDR and the operator
BITAND.

Revision 1.168 / (download) - annotate - [select for diffs], Sun Jan 17 14:45:21 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.167: +8 -8 lines
Diff to previous 1.167 (colored) to selected 1.470 (colored)

lint: rename build_ampersand to build_address

At that stage of analysis, the ampersand is no longer ambiguous, it has
already been resolved as the address-of operator, instead of the
bitwise-and operator.

Revision 1.167 / (download) - annotate - [select for diffs], Sun Jan 17 14:37:48 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.166: +47 -41 lines
Diff to previous 1.166 (colored) to selected 1.470 (colored)

lint: extract fallback_symbol from new_name_node

The code was too close to the right margin, causing unnatural line
breaks.  Furthermore it was getting too long and detailed.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Jan 17 14:26:31 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.165: +12 -15 lines
Diff to previous 1.165 (colored) to selected 1.470 (colored)

lint: flatten check_pointer_integer_conversion

Revision 1.165 / (download) - annotate - [select for diffs], Sun Jan 17 13:50:32 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.164: +8 -2 lines
Diff to previous 1.164 (colored) to selected 1.470 (colored)

lint: in strict bool mode, don't treat bool as arithmetic type

Revision 1.164 / (download) - annotate - [select for diffs], Sun Jan 17 12:23:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.163: +30 -28 lines
Diff to previous 1.163 (colored) to selected 1.470 (colored)

lint: rename mod_t members

Revision 1.163 / (download) - annotate - [select for diffs], Sat Jan 16 19:11:36 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.162: +26 -23 lines
Diff to previous 1.162 (colored) to selected 1.470 (colored)

lint: refactor strict bool mode and improve comments

The previous comment above typeok_strict_bool_compatible was too hard to
understand.

Revision 1.162 / (download) - annotate - [select for diffs], Sat Jan 16 19:03:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.161: +5 -4 lines
Diff to previous 1.161 (colored) to selected 1.470 (colored)

lint: in strict bool mode, perform the normal checks as well

Revision 1.161 / (download) - annotate - [select for diffs], Sat Jan 16 18:58:21 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.160: +5 -8 lines
Diff to previous 1.160 (colored) to selected 1.470 (colored)

lint: simplify typeok_strict_bool_compatible

Revision 1.160 / (download) - annotate - [select for diffs], Sat Jan 16 18:48:52 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.159: +18 -3 lines
Diff to previous 1.159 (colored) to selected 1.470 (colored)

lint: add missing warning for bool() == int

Revision 1.159 / (download) - annotate - [select for diffs], Sat Jan 16 18:46:59 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.158: +5 -16 lines
Diff to previous 1.158 (colored) to selected 1.470 (colored)

lint: simplify typeok_strict_bool_assign

When that function is called, the nodes are already before_conversion.

Revision 1.158 / (download) - annotate - [select for diffs], Sat Jan 16 17:54:22 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.157: +4 -4 lines
Diff to previous 1.157 (colored) to selected 1.470 (colored)

lint: remove redundant calls to before_conversion

Revision 1.157 / (download) - annotate - [select for diffs], Sat Jan 16 16:53:23 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.156: +9 -9 lines
Diff to previous 1.156 (colored) to selected 1.470 (colored)

lint: replace integer constant expressions with true and false

LINTFLAGS=-gST make lint, with manual review.

The error messages from lint are all correct, they are not complete
though.  The return value of a function returning bool may still be
compared to the integer 0.

Revision 1.156 / (download) - annotate - [select for diffs], Sat Jan 16 16:03:46 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.155: +6 -25 lines
Diff to previous 1.155 (colored) to selected 1.470 (colored)

lint: in strict bool mode, integer constants do not have type bool

Previously, lint1 allowed integer constants such as 0 and 1 to be used
as bool constants.  This was only half-baked since after fixing all
error messages from that strict mode, there may still be integer
literals in the code that should be replaced with true or false.  This
would stop a migration from int to bool in the middle, leaving
inconsistent code around.

To find the remaining type inconsistencies, treat integers and bool as
completely incompatible, even for compile time constants.

Revision 1.155 / (download) - annotate - [select for diffs], Sat Jan 16 15:02:11 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.154: +16 -3 lines
Diff to previous 1.154 (colored) to selected 1.470 (colored)

lint: prepare to make strict bool mode even stricter

Currently, strict bool mode still allows integer constant expressions to
be converted implicitly to bool.  This is something that other languages
such as Go, Java, C#, Pascal don't allow.

By providing a custom implementation of <stdbool.h> that defines false
and true to custom bool constant identifiers, lint will cover these
cases as well.

To prepare for this, reword the rules and restructure the tests in
d_c99_bool_strict.c.

Revision 1.154 / (download) - annotate - [select for diffs], Sat Jan 16 02:40:02 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.153: +102 -96 lines
Diff to previous 1.153 (colored) to selected 1.470 (colored)

lint: replace 0 and 1 with false and true, where appropriate

Change in behavior: Passing the option -h exactly 4294967296 times or
any multiple thereof is no longer equivalent to passing it never at all,
it is now equivalent to passing it once.  See main2.c, hflag++ for the
actual change.

Other than that, no functional change intended.

A very large portion of the code already conformed to the requirements
of the strict bool mode.  The only missing thing was using the constant
literals false and true instead of 0 and 1.  For sure there are some
integer literals left that can be converted.  For now, all literals that
appeared in the form " = 0" or " = 1" have been replaced.

Revision 1.153 / (download) - annotate - [select for diffs], Fri Jan 15 23:43:51 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.152: +6 -19 lines
Diff to previous 1.152 (colored) to selected 1.470 (colored)

lint: merge duplicate code for non-zero detection

Revision 1.152 / (download) - annotate - [select for diffs], Thu Jan 14 07:42:31 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.151: +5 -4 lines
Diff to previous 1.151 (colored) to selected 1.470 (colored)

lint: add type details to message for enum type mismatch

Before December 2020, it was cumbersome to add type information to a
message since the caller had to explicitly allocate buffers for the type
names.  That's probably the reason why this crucial detail had been left
out of the warning.

Revision 1.151 / (download) - annotate - [select for diffs], Tue Jan 12 20:42:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.150: +184 -16 lines
Diff to previous 1.150 (colored) to selected 1.470 (colored)

lint: add new check for strict bool mode

In strict bool mode, bool is considered incompatible with all other
scalar types, just as in Java, C#, Pascal.

The controlling expressions in if statements, while loops, for loops and
the '?:' operator must be of type bool.  The logical operators work on
bool instead of int, the bitwise operators accept both integer and bool.
The arithmetic operators don't accept bool.

Since <stdbool.h> implements bool using C preprocessor macros instead of
predefining the identifiers "true" and "false", the integer constants 0
and 1 may be used in all contexts that require a bool expression.
Except from these, no implicit conversion between bool and scalar types
is allowed.

See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.

The command line option -T has been chosen because all obvious choices
(-b or -B for bool, -s or -S for strict) are already in use.  The -T may
stand for "types are checked strictly".

The default behavior of lint doesn't change.  The strict bool check is
purely optional.

An example program for strict bool mode is usr.bin/make, which has been
using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in
most places for a long time now, even before the refactoring in 2020.

Revision 1.150 / (download) - annotate - [select for diffs], Mon Jan 11 20:04:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.149: +51 -30 lines
Diff to previous 1.149 (colored) to selected 1.470 (colored)

lint: split typeok into several functions

Revision 1.149 / (download) - annotate - [select for diffs], Mon Jan 11 19:29:49 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.148: +72 -60 lines
Diff to previous 1.148 (colored) to selected 1.470 (colored)

lint: sprinkle a few const modifiers throughout the code

Revision 1.148 / (download) - annotate - [select for diffs], Sun Jan 10 12:46:38 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.147: +8 -5 lines
Diff to previous 1.147 (colored) to selected 1.470 (colored)

lint: fix conversion of non-constant scalar to _Bool

Revision 1.147 / (download) - annotate - [select for diffs], Sun Jan 10 12:34:56 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.146: +10 -4 lines
Diff to previous 1.146 (colored) to selected 1.470 (colored)

lint: fix conversion of constant expressions to _Bool

Revision 1.146 / (download) - annotate - [select for diffs], Sun Jan 10 11:17:53 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.145: +5 -4 lines
Diff to previous 1.145 (colored) to selected 1.470 (colored)

lint: rename cvtcon to convert_constant

No functional change.

Revision 1.145 / (download) - annotate - [select for diffs], Sun Jan 10 00:12:50 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.144: +10 -14 lines
Diff to previous 1.144 (colored) to selected 1.470 (colored)

lint: remove redundant braces in is_confusing_precedence

This nicely aligns the different branches, in which "l" and "r" are
swapped.

No functional change.

Revision 1.144 / (download) - annotate - [select for diffs], Sun Jan 10 00:05:46 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.143: +83 -91 lines
Diff to previous 1.143 (colored) to selected 1.470 (colored)

lint: rename type classification macros

The previous names tspec_is_int and tspec_is_uint were confusing because
there are actually tspec_t constants called INT and UINT, these
classification macros return true for other integer types as well,
though.

While here, remove the prefix "tspec_" from these macros.  It wasn't as
helpful as intended, in many cases it was obviously redundant, when it
was called as tspec_is_integer(tn->tn_type->t_tspec).

No functional change.

Revision 1.143 / (download) - annotate - [select for diffs], Sat Jan 9 23:18:19 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.142: +18 -21 lines
Diff to previous 1.142 (colored) to selected 1.470 (colored)

lint: push down complexity from typeok to typeok_shr

Contrary to the comment in typeok, the types of the expressions before
promotions and conversions are not needed for SHL, SHLASS and SHRASS.
Move that code over to typeok_shr, the only place where it is actually
used.  This removes another 3 variables from typeok.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Jan 9 23:02:51 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.141: +27 -22 lines
Diff to previous 1.141 (colored) to selected 1.470 (colored)

lint: move pointer subtypes from typeok to the sub-functions

The code in typeok is already complicated enough.  Only few of the
checks actually examine the subtype of the pointer, the others don't
need to look at it.  Therefore don't initialize the variables lstp
(left-hand side subtype) and rstp unless they are actually needed.

This reduces the number of variables in typeok and the number of
parameters to the sub-functions.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Jan 9 19:13:17 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.140: +21 -21 lines
Diff to previous 1.140 (colored) to selected 1.470 (colored)

lint: change return type of typeok to bool

No functional change.

Revision 1.140 / (download) - annotate - [select for diffs], Sat Jan 9 19:07:07 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.139: +288 -200 lines
Diff to previous 1.139 (colored) to selected 1.470 (colored)

lint: split typeok into several smaller functions

This reduces the number of local variables from 16 to around 5, in most
of the smaller functions.

No functional change.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Jan 9 18:21:08 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.138: +39 -30 lines
Diff to previous 1.138 (colored) to selected 1.470 (colored)

lint: extract typeok_amper from typeok

No functional change.

Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 9 18:15:14 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.137: +26 -18 lines
Diff to previous 1.137 (colored) to selected 1.470 (colored)

lint: extract typeok_incdec from typeok

No functional change.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Jan 9 17:21:33 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.136: +5 -4 lines
Diff to previous 1.136 (colored) to selected 1.470 (colored)

lint: fix crash for error 108 (invalid type of unary operator)

Revision 1.136 / (download) - annotate - [select for diffs], Sat Jan 9 14:10:15 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.135: +13 -13 lines
Diff to previous 1.135 (colored) to selected 1.470 (colored)

lint: make target platform independent of host platform

If lint is run on a platform that has CHAR_BIT == 10, this doesn't
magically make an ILP32 platform have 40 bits per uint32_t.

At the moment, all of the supported platforms are either ILP32 or
I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE,
so nothing changes practically.

Revision 1.135 / (download) - annotate - [select for diffs], Tue Jan 5 17:37:57 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.134: +9 -19 lines
Diff to previous 1.134 (colored) to selected 1.470 (colored)

lint: make check_precedence_confusion simpler

In C, only binary operators have possibly confusing precedence.  All
binary operators have lower precedence than an explicit cast.  When an
expression is parsed, the parentheses are associated with the innermost
possible node.  This means that as soon as a cast operator is
parenthesized, its contained expression can no longer have confusing
precedence.

This allows the code to be written more succinct since the local
variables are no longer necessary.

Revision 1.134 / (download) - annotate - [select for diffs], Tue Jan 5 00:17:21 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.133: +47 -105 lines
Diff to previous 1.133 (colored) to selected 1.470 (colored)

lint: extract code for determining possible precedence confusion

The function check_precedence_confusion was pretty long, and right in
the middle of that function was the complicated part of determining
which of the operand combinations are confusing and which aren't.

Extract this part into a separate function to document on which
information this decision is based.  This makes it easier to understand
the code since there are fewer local variables around.

As a left-over from a previous commit, rop and rparn don't need to be
initialized twice, now that the assertion for a binary operator is in
place.

Remove the large and useless switch statement over all operator types.
This list was completely unsorted, for no apparent reason.  To see the
list of operators, better look them up in ops.def, there was no need to
have this list duplicated here.

Revision 1.133 / (download) - annotate - [select for diffs], Mon Jan 4 23:58:19 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.132: +10 -11 lines
Diff to previous 1.132 (colored) to selected 1.470 (colored)

lint: precedence confusion is only possible with binary operators

No functional change.

The operator table in ops.def states that every operator that has
possibly confusing precedence is also a binary operator, so assert that
instead of having two different code paths.

Revision 1.132 / (download) - annotate - [select for diffs], Mon Jan 4 23:50:46 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.131: +3 -12 lines
Diff to previous 1.131 (colored) to selected 1.470 (colored)

lint: fix bug in "precedence confusion possible [169]"

Revision 1.131 / (download) - annotate - [select for diffs], Mon Jan 4 23:47:26 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.130: +6 -23 lines
Diff to previous 1.130 (colored) to selected 1.470 (colored)

lint: document and demonstrate the bug in check_precedence_confusion

It took quite a while to get to the correct interpretation of this small
piece of code and to draw the right conclusions from it.  Now the bug is
finally ready to be fixed, as already announced in the test.

Revision 1.130 / (download) - annotate - [select for diffs], Mon Jan 4 23:17:03 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.129: +16 -12 lines
Diff to previous 1.129 (colored) to selected 1.470 (colored)

lint: add more rationale for removing effect-less code

Revision 1.129 / (download) - annotate - [select for diffs], Mon Jan 4 22:41:56 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.128: +15 -2 lines
Diff to previous 1.128 (colored) to selected 1.470 (colored)

lint: finish the comments in check_precedence_confusion

Revision 1.128 / (download) - annotate - [select for diffs], Mon Jan 4 22:33:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.127: +4 -6 lines
Diff to previous 1.127 (colored) to selected 1.470 (colored)

lint: replace LERROR with lint_assert in check_expr_misc

This reduces the visual clutter.  There is no reason for anyone to
modify the code around the CALL operator, therefore the assertion is not
expected to fail anytime soon.

Revision 1.127 / (download) - annotate - [select for diffs], Mon Jan 4 22:26:50 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.126: +3 -3 lines
Diff to previous 1.126 (colored) to selected 1.470 (colored)

lint: fix typos and other minor stylistic issues

Revision 1.126 / (download) - annotate - [select for diffs], Mon Jan 4 21:30:06 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.125: +9 -44 lines
Diff to previous 1.125 (colored) to selected 1.470 (colored)

lint: fix bugs in dprint_node in debug mode (since today)

The node was dereferenced before the null check.  GCC 5.5 didn't warn
about this obvious bug, not even with -Wall -Wextra -O2.  Such a case
didn't occur though in the few tests that this function was used in.

The indentation for the nested nodes only needs to be set for a few
lines of code, make this region as small as possible.

There are nodes that use both tn_left and tn_right, even though they are
not defined as binary operators.  An example is CALL, for which tn_left
is the address of the function name and tn_right, which are the
arguments, linked via PUSH nodes.  CALL is not a binary operator since
it doesn't do any calculations with its arguments.

Revision 1.125 / (download) - annotate - [select for diffs], Mon Jan 4 21:17:31 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.124: +44 -44 lines
Diff to previous 1.124 (colored) to selected 1.470 (colored)

lint: move dprint_node to the top of the file

It now resides right below dumpnode, which implements the same idea but
uses a fixed-size output buffer and prints everything in a single line,
which quickly gets hard to read.  Maybe that's the reason why it had
been commented out since it got added in 2014.

Revision 1.124 / (download) - annotate - [select for diffs], Mon Jan 4 17:06:20 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.123: +46 -2 lines
Diff to previous 1.123 (colored) to selected 1.470 (colored)

lint: in debug mode, print node tree for precedence

From the code alone, it is too difficult to see how the various internal
operators are combined and what properties they have.  A simple tree
visualization helps to see all the details.

This is used to track down the typo in check_precedence_confusion, to
see whether it could have possibly had any influence at all.

Revision 1.123 / (download) - annotate - [select for diffs], Mon Jan 4 15:52:51 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.122: +11 -2 lines
Diff to previous 1.122 (colored) to selected 1.470 (colored)

lint: add test for "precedence confusion possible [169]"

Revision 1.122 / (download) - annotate - [select for diffs], Sun Jan 3 20:38:26 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.121: +7 -6 lines
Diff to previous 1.121 (colored) to selected 1.470 (colored)

lint: rename funcarg and funccall to longer names

From the previous short names, it was no obvious that these functions
create a new tree node.

The function named funccall in lint2 has been left as-is, since it has a
completely different prototype.

Revision 1.121 / (download) - annotate - [select for diffs], Sun Jan 3 20:31:08 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.120: +24 -28 lines
Diff to previous 1.120 (colored) to selected 1.470 (colored)

lint: rename functions that create nodes

Revision 1.120 / (download) - annotate - [select for diffs], Sun Jan 3 19:10:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.119: +15 -15 lines
Diff to previous 1.119 (colored) to selected 1.470 (colored)

lint: rename type.t_isfield to t_bitfield

Revision 1.119 / (download) - annotate - [select for diffs], Sun Jan 3 18:35:51 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.118: +2 -3 lines
Diff to previous 1.118 (colored) to selected 1.470 (colored)

lint: remove redundant include of externs1.h

It is already included by lint1.h.

Revision 1.118 / (download) - annotate - [select for diffs], Sun Jan 3 17:42:45 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.117: +5 -5 lines
Diff to previous 1.117 (colored) to selected 1.470 (colored)

lint: let gnuism and c99ism return void instead of int

The return value was only used in a single case.  Duplicating the
condition for printing a message is ok in that case, since it makes all
other places in the code simpler.

The occasional "(void)" or "msg = " before the function call had hidden
the calls from check-msgs.lua, which didn't check the message texts in
such cases.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Jan 3 15:51:16 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.116: +5 -4 lines
Diff to previous 1.116 (colored) to selected 1.470 (colored)

lint: add type information to message 124 "illegal pointer combination"

Revision 1.116 / (download) - annotate - [select for diffs], Sat Jan 2 18:26:44 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.115: +6 -6 lines
Diff to previous 1.115 (colored) to selected 1.470 (colored)

lint: fix lint warning 161 "constant in conditional context"

Revision 1.115 / (download) - annotate - [select for diffs], Sat Jan 2 03:49:25 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.114: +56 -98 lines
Diff to previous 1.114 (colored) to selected 1.470 (colored)

lint: fix buffer truncation for type names

Previously, most type names had been cut off after 63 significant
characters.  In some cases, 127 characters survived, or 255.  And for
the debugging messages, sometimes even 1023.  This inconsistency was
useless.

It was wrong in the first place to make the caller of the function
tyname responsible for handling the buffer.  That's not something a
caller of such a simple function should do.  These callers have better
things to do.

The API of the new function type_name is as simple as possible.

In the implementation, the name of the type is generated anew each time.
I just didn't know whether the type details could change, once the type
is initialized, and I didn't want to find out.  To be on the safe side,
the resulting type name is cached, independently of the type it was
generated for.  Using a trivial, unbalanced binary tree should be good
enough for now.

All this work is necessary to support adding new debug logging, without
being distracted by irrelevant implementation details such as these
buffer sizes.  Adding new debug messages should be fun and easy; up to
now, it was overly bureaucratic.

Revision 1.114 / (download) - annotate - [select for diffs], Fri Jan 1 11:58:03 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.113: +4 -4 lines
Diff to previous 1.113 (colored) to selected 1.470 (colored)

lint: rename styp and utyp

Revision 1.113 / (download) - annotate - [select for diffs], Fri Jan 1 11:41:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.112: +31 -18 lines
Diff to previous 1.112 (colored) to selected 1.470 (colored)

lint: add missing redundant messages in source code

Revision 1.112 / (download) - annotate - [select for diffs], Fri Jan 1 11:09:40 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored) to selected 1.470 (colored)

lint: rename tokens for left and right parentheses

Revision 1.111 / (download) - annotate - [select for diffs], Fri Jan 1 01:42:55 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.110: +6 -6 lines
Diff to previous 1.110 (colored) to selected 1.470 (colored)

lint: rename basic_type_name to tspec_name

The term "basic type" is precisely defined in C99 6.2.5p14, and tspec_t
is close to that, but nowhere identical.

Revision 1.110 / (download) - annotate - [select for diffs], Fri Jan 1 01:38:14 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.109: +11 -26 lines
Diff to previous 1.109 (colored) to selected 1.470 (colored)

lint: clean up warn_incompatible_types

Splitting the code arbitrarily in separate phases made the code harder
to understand, both for humans as well as automated tools.

One of these tools, check-msgs.lua, couldn't check whether the comments
match the actual messages, and of course, the comments were wrong.
There was no good reason to deviate from the pattern followed by all the
rest of the code.

Revision 1.109 / (download) - annotate - [select for diffs], Fri Jan 1 01:07:08 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.108: +5 -3 lines
Diff to previous 1.108 (colored) to selected 1.470 (colored)

lint: fix segmentation fault when checking returned enum types (211)

Revision 1.108 / (download) - annotate - [select for diffs], Fri Jan 1 00:00:24 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.107: +55 -55 lines
Diff to previous 1.107 (colored) to selected 1.470 (colored)

lint: align comments in code with actual messages

Redundancy is bad.  Especially in this case, separating the format
strings from the actual arguments prevents the compiler from
cross-checking them.

Revision 1.107 / (download) - annotate - [select for diffs], Wed Dec 30 12:22:51 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.106: +58 -90 lines
Diff to previous 1.106 (colored) to selected 1.470 (colored)

lint: replace LERROR with lint_assert

This removes the redundancy of mentioning the function name in the error
message.  This redundancy had been correct in all but 2 cases:
build_real_imag and tsize.

Revision 1.106 / (download) - annotate - [select for diffs], Wed Dec 30 11:56:10 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.105: +13 -13 lines
Diff to previous 1.105 (colored) to selected 1.470 (colored)

lint: spell check comments

Revision 1.105 / (download) - annotate - [select for diffs], Wed Dec 30 11:04:48 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.104: +4 -4 lines
Diff to previous 1.104 (colored) to selected 1.470 (colored)

lint: un-abbreviate s_field, s_keyw and s_xsym

Revision 1.104 / (download) - annotate - [select for diffs], Wed Dec 30 10:56:51 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.103: +17 -17 lines
Diff to previous 1.103 (colored) to selected 1.470 (colored)

lint: un-abbreviate parenthesized and _strg

Revision 1.103 / (download) - annotate - [select for diffs], Wed Dec 30 10:49:10 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.102: +3 -3 lines
Diff to previous 1.102 (colored) to selected 1.470 (colored)

lint: rename remaining _nxt members to _next

Revision 1.102 / (download) - annotate - [select for diffs], Wed Dec 30 10:35:38 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.101: +4 -4 lines
Diff to previous 1.101 (colored) to selected 1.470 (colored)

lint: rename symt_t constants

There's no need to abbreviate them, furthermore FMOS was imprecise.

Revision 1.101 / (download) - annotate - [select for diffs], Wed Dec 30 10:26:12 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.100: +6 -6 lines
Diff to previous 1.100 (colored) to selected 1.470 (colored)

lint: rename s_nxt to s_next

Revision 1.100 / (download) - annotate - [select for diffs], Tue Dec 29 23:04:31 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.99: +166 -159 lines
Diff to previous 1.99 (colored) to selected 1.470 (colored)

lint: rename functions that had very short names

Revision 1.99 / (download) - annotate - [select for diffs], Tue Dec 29 21:32:46 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (colored) to selected 1.470 (colored)

lint: fix typo in comments

Revision 1.98 / (download) - annotate - [select for diffs], Tue Dec 29 13:33:03 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.97: +56 -53 lines
Diff to previous 1.97 (colored) to selected 1.470 (colored)

lint: rename functions with very short names

Revision 1.97 / (download) - annotate - [select for diffs], Tue Dec 29 12:18:42 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.96: +6 -6 lines
Diff to previous 1.96 (colored) to selected 1.470 (colored)

lint: fix indentation and alignment that used space-tab

Revision 1.96 / (download) - annotate - [select for diffs], Tue Dec 29 11:54:56 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.95: +3 -4 lines
Diff to previous 1.95 (colored) to selected 1.470 (colored)

lint: spell check

Revision 1.95 / (download) - annotate - [select for diffs], Tue Dec 29 11:35:11 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.94: +97 -96 lines
Diff to previous 1.94 (colored) to selected 1.470 (colored)

lint: remove redundant parentheses around return value

Revision 1.94 / (download) - annotate - [select for diffs], Tue Dec 29 10:24:22 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.93: +7 -7 lines
Diff to previous 1.93 (colored) to selected 1.470 (colored)

lint: rename functions that had very short names

C99 guarantees that the first 31 characters of an identifier with
external linkage are significant.  This removes the need to use
abbreviations for common words.

Revision 1.93 / (download) - annotate - [select for diffs], Mon Dec 28 19:38:54 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.92: +12 -14 lines
Diff to previous 1.92 (colored) to selected 1.470 (colored)

lint: rename fields in mod_t

Revision 1.92 / (download) - annotate - [select for diffs], Mon Dec 28 19:07:43 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.91: +4 -4 lines
Diff to previous 1.91 (colored) to selected 1.470 (colored)

lint: sort includes

Revision 1.91 / (download) - annotate - [select for diffs], Mon Dec 28 19:02:16 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.90: +20 -16 lines
Diff to previous 1.90 (colored) to selected 1.470 (colored)

lint: realign code

Revision 1.90 / (download) - annotate - [select for diffs], Mon Dec 28 18:49:02 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.89: +104 -83 lines
Diff to previous 1.89 (colored) to selected 1.470 (colored)

lint: rename tspec macros

Revision 1.89 / (download) - annotate - [select for diffs], Mon Dec 28 12:52:45 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.88: +6 -6 lines
Diff to previous 1.88 (colored) to selected 1.470 (colored)

lint1: remove trailing whitespace

Revision 1.88 / (download) - annotate - [select for diffs], Tue Jun 2 21:10:07 2020 UTC (3 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored) to selected 1.470 (colored)

Fix return of alignof()

Revision 1.84.12.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:50 2020 UTC (4 years ago) by martin
Branch: phil-wifi
Changes since 1.84.12.1: +6 -4 lines
Diff to previous 1.84.12.1 (colored) to branchpoint 1.84 (colored) next main 1.85 (colored) to selected 1.470 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.87 / (download) - annotate - [select for diffs], Fri Jul 12 23:32:45 2019 UTC (4 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp
Changes since 1.86: +6 -4 lines
Diff to previous 1.86 (colored) to selected 1.470 (colored)

allow c9x struct casts (in new libXt)

Revision 1.84.12.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:10:26 2019 UTC (4 years, 10 months ago) by christos
Branch: phil-wifi
Changes since 1.84: +19 -6 lines
Diff to previous 1.84 (colored) to selected 1.470 (colored)

Sync with HEAD

Revision 1.84.10.2 / (download) - annotate - [select for diffs], Sun Sep 30 01:45:59 2018 UTC (5 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.84.10.1: +6 -4 lines
Diff to previous 1.84.10.1 (colored) to branchpoint 1.84 (colored) next main 1.85 (colored) to selected 1.470 (colored)

Ssync with HEAD

Revision 1.86 / (download) - annotate - [select for diffs], Fri Sep 7 15:16:15 2018 UTC (5 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930
Changes since 1.85: +6 -4 lines
Diff to previous 1.85 (colored) to selected 1.470 (colored)

recognize int128

Revision 1.84.10.1 / (download) - annotate - [select for diffs], Sat Jul 28 04:38:14 2018 UTC (5 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.84: +15 -4 lines
Diff to previous 1.84 (colored) to selected 1.470 (colored)

Sync with HEAD

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jun 29 20:18:05 2018 UTC (5 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-0906, pgoyette-compat-0728
Changes since 1.84: +15 -4 lines
Diff to previous 1.84 (colored) to selected 1.470 (colored)

add missing args for 123

Revision 1.83.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:54:16 2017 UTC (6 years, 11 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.83: +22 -2 lines
Diff to previous 1.83 (colored) next main 1.84 (colored) to selected 1.470 (colored)

Sync with HEAD

Revision 1.82.2.1 / (download) - annotate - [select for diffs], Mon Mar 20 06:58:06 2017 UTC (7 years, 1 month ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.82: +22 -2 lines
Diff to previous 1.82 (colored) next main 1.83 (colored) to selected 1.470 (colored)

Sync with HEAD

Revision 1.84 / (download) - annotate - [select for diffs], Mon Mar 6 21:01:39 2017 UTC (7 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-compat-base, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.83: +22 -2 lines
Diff to previous 1.83 (colored) to selected 1.470 (colored)

fix typeof, add __builtin_offsetof

Revision 1.83 / (download) - annotate - [select for diffs], Fri Aug 19 10:19:45 2016 UTC (7 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107, pgoyette-localcount-20161104, localcount-20160914, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.82: +24 -3 lines
Diff to previous 1.82 (colored) to selected 1.470 (colored)

Add union casts.

Revision 1.82 / (download) - annotate - [select for diffs], Wed Oct 14 18:31:52 2015 UTC (8 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726
Branch point for: pgoyette-localcount
Changes since 1.81: +10 -5 lines
Diff to previous 1.81 (colored) to selected 1.470 (colored)

more descriptive errors

Revision 1.81 / (download) - annotate - [select for diffs], Fri Aug 28 09:42:07 2015 UTC (8 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (colored) to selected 1.470 (colored)

~0 and -1 are the same for two-complement machines. ISO C says left
shifts of negative values are UB, so do the shift for the unsigned
equivalent and cast to int afterwards.

Revision 1.80 / (download) - annotate - [select for diffs], Wed Jul 29 18:23:32 2015 UTC (8 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.79: +4 -4 lines
Diff to previous 1.79 (colored) to selected 1.470 (colored)

Make the return type of "? type1 : void *" or "? void * : type1" to be type1
instead of void *.

Revision 1.79 / (download) - annotate - [select for diffs], Wed Jul 29 18:22:06 2015 UTC (8 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.78: +7 -4 lines
Diff to previous 1.78 (colored) to selected 1.470 (colored)

Be more specific about the type errors

Revision 1.78 / (download) - annotate - [select for diffs], Mon Feb 9 18:17:34 2015 UTC (9 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.77: +12 -3 lines
Diff to previous 1.77 (colored) to selected 1.470 (colored)

Treat complex numbers like other floating numbers. This caused a core-dump
when linting libm complex code and assumed the size of the type larger than
the array size of value bitmaps.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Nov 20 21:17:18 2014 UTC (9 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.76: +10 -6 lines
Diff to previous 1.76 (colored) to selected 1.470 (colored)

allow c99 flexible arrays for packed structures.

Revision 1.71.2.2 / (download) - annotate - [select for diffs], Wed Aug 20 00:05:06 2014 UTC (9 years, 8 months ago) by tls
Branch: tls-maxphys
Changes since 1.71.2.1: +47 -6 lines
Diff to previous 1.71.2.1 (colored) to branchpoint 1.71 (colored) next main 1.72 (colored) to selected 1.470 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.75.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:59:20 2014 UTC (9 years, 8 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.75: +46 -7 lines
Diff to previous 1.75 (colored) next main 1.76 (colored) to selected 1.470 (colored)

Rebase.

Revision 1.68.4.3 / (download) - annotate - [select for diffs], Thu May 22 11:42:52 2014 UTC (9 years, 11 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.68.4.2: +53 -12 lines
Diff to previous 1.68.4.2 (colored) to branchpoint 1.68 (colored) next main 1.69 (colored) to selected 1.470 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.76 / (download) - annotate - [select for diffs], Thu Apr 17 18:23:18 2014 UTC (10 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Changes since 1.75: +46 -7 lines
Diff to previous 1.75 (colored) to selected 1.470 (colored)

- add a function to dump a node
- better diagnostics on abort
- allow converting a constant
- initialize right node now that we trash memory this makes a difference.
  before it was NULL.

Revision 1.75 / (download) - annotate - [select for diffs], Tue Feb 18 22:01:36 2014 UTC (10 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.74: +4 -3 lines
Diff to previous 1.74 (colored) to selected 1.470 (colored)

add __extension__ and typeof

Revision 1.74 / (download) - annotate - [select for diffs], Tue Feb 18 20:43:36 2014 UTC (10 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.73: +3 -2 lines
Diff to previous 1.73 (colored) to selected 1.470 (colored)

__real__ and __imag__ produce lvalues

Revision 1.71.2.1 / (download) - annotate - [select for diffs], Sun Jun 23 06:29:02 2013 UTC (10 years, 9 months ago) by tls
Branch: tls-maxphys
Changes since 1.71: +6 -6 lines
Diff to previous 1.71 (colored) to selected 1.470 (colored)

resync from head

Revision 1.73 / (download) - annotate - [select for diffs], Fri Apr 19 18:51:14 2013 UTC (11 years ago) by christos
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.72: +5 -5 lines
Diff to previous 1.72 (colored) to selected 1.470 (colored)

make NOSTRICT behave the same a LINTED; use the new format.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Mar 2 21:25:12 2013 UTC (11 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver
Changes since 1.71: +3 -3 lines
Diff to previous 1.71 (colored) to selected 1.470 (colored)

obey constcond to !constcond

Revision 1.68.4.2 / (download) - annotate - [select for diffs], Wed May 23 10:08:28 2012 UTC (11 years, 10 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.68.4.1: +5 -3 lines
Diff to previous 1.68.4.1 (colored) to branchpoint 1.68 (colored) to selected 1.470 (colored)

sync with head.

Revision 1.71 / (download) - annotate - [select for diffs], Fri Apr 20 18:35:28 2012 UTC (12 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5
Branch point for: tls-maxphys
Changes since 1.70: +5 -3 lines
Diff to previous 1.70 (colored) to selected 1.470 (colored)

add __PRETTY_FUNCTION__

Revision 1.68.4.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:09:44 2012 UTC (12 years ago) by yamt
Branch: yamt-pagecache
Changes since 1.68: +12 -12 lines
Diff to previous 1.68 (colored) to selected 1.470 (colored)

sync with head

Revision 1.70 / (download) - annotate - [select for diffs], Tue Mar 27 19:24:03 2012 UTC (12 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.69: +11 -11 lines
Diff to previous 1.69 (colored) to selected 1.470 (colored)

more cross lint friendlyness
XXX: needs more constants converted double/float

Revision 1.69 / (download) - annotate - [select for diffs], Wed Mar 21 14:17:22 2012 UTC (12 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored) to selected 1.470 (colored)

-0 is not unary overflow.

Revision 1.66.2.1 / (download) - annotate - [select for diffs], Tue Feb 8 16:20:13 2011 UTC (13 years, 2 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.66: +3 -136 lines
Diff to previous 1.66 (colored) next main 1.67 (colored) to selected 1.470 (colored)

Sync with HEAD

Revision 1.68 / (download) - annotate - [select for diffs], Sat Feb 5 17:14:14 2011 UTC (13 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base
Branch point for: yamt-pagecache
Changes since 1.67: +2 -135 lines
Diff to previous 1.67 (colored) to selected 1.470 (colored)

as promised make the last ops table auto-generated.

Revision 1.67 / (download) - annotate - [select for diffs], Fri Feb 4 23:31:23 2011 UTC (13 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.66: +3 -3 lines
Diff to previous 1.66 (colored) to selected 1.470 (colored)

fix typo

Revision 1.66 / (download) - annotate - [select for diffs], Sat Dec 18 20:57:41 2010 UTC (13 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Branch point for: bouyer-quota2
Changes since 1.65: +14 -12 lines
Diff to previous 1.65 (colored) to selected 1.470 (colored)

PR/44235: Martin Husemann: Fix core dump due to memory corruption.
Found by Henning Petersen

Revision 1.65 / (download) - annotate - [select for diffs], Wed Nov 24 17:51:11 2010 UTC (13 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.64: +10 -8 lines
Diff to previous 1.64 (colored) to selected 1.470 (colored)

PR/44148: Henning Petersen: catstrg() does not set the resulting string length.

Revision 1.64 / (download) - annotate - [select for diffs], Sun Mar 21 14:29:04 2010 UTC (14 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.63: +6 -2 lines
Diff to previous 1.63 (colored) to selected 1.470 (colored)

revert for now.

Revision 1.63 / (download) - annotate - [select for diffs], Sun Mar 21 00:02:13 2010 UTC (14 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.62: +42 -4 lines
Diff to previous 1.62 (colored) to selected 1.470 (colored)

make lint recognize constant shift values and not warn if the number of bits
shifted results in a narrower type.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Oct 2 21:04:03 2009 UTC (14 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.61: +16 -9 lines
Diff to previous 1.61 (colored) to selected 1.470 (colored)

compute sizes by the new tsize() function.

Revision 1.61 / (download) - annotate - [select for diffs], Fri Oct 2 19:02:16 2009 UTC (14 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.60: +2 -3 lines
Diff to previous 1.60 (colored) to selected 1.470 (colored)

remove debugging

Revision 1.60 / (download) - annotate - [select for diffs], Fri Oct 2 19:01:14 2009 UTC (14 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored) to selected 1.470 (colored)

recognize struct __packed x { }; in addition to struct x { } __packed;

Revision 1.54.2.1 / (download) - annotate - [select for diffs], Wed May 13 19:20:13 2009 UTC (14 years, 11 months ago) by jym
Branch: jym-xensuspend
Changes since 1.54: +76 -20 lines
Diff to previous 1.54 (colored) next main 1.55 (colored) to selected 1.470 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.59 / (download) - annotate - [select for diffs], Sat May 2 16:10:49 2009 UTC (14 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.58: +49 -0 lines
Diff to previous 1.58 (colored) to selected 1.470 (colored)

Add __alignof__.

Revision 1.58 / (download) - annotate - [select for diffs], Mon Apr 27 15:08:10 2009 UTC (14 years, 11 months ago) by ginsbach
Branch: MAIN
Changes since 1.57: +3 -3 lines
Diff to previous 1.57 (colored) to selected 1.470 (colored)

Print left and right type and not left type twice.  (Hi Christos!)

Revision 1.57 / (download) - annotate - [select for diffs], Wed Apr 15 01:20:57 2009 UTC (15 years ago) by christos
Branch: MAIN
Changes since 1.56: +17 -16 lines
Diff to previous 1.56 (colored) to selected 1.470 (colored)

Lukemify (WARNS=4)

Revision 1.56 / (download) - annotate - [select for diffs], Mon Apr 13 21:17:37 2009 UTC (15 years ago) by christos
Branch: MAIN
Changes since 1.55: +10 -6 lines
Diff to previous 1.55 (colored) to selected 1.470 (colored)

since we know the types, print what they are in error messages.

Revision 1.55 / (download) - annotate - [select for diffs], Mon Mar 2 20:53:11 2009 UTC (15 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.54: +4 -2 lines
Diff to previous 1.54 (colored) to selected 1.470 (colored)

Don't produce type mismatch warnings if one side of ?: is "[qual] void *"
and the other side is "[qual] pointer".

Revision 1.54 / (download) - annotate - [select for diffs], Sun Nov 16 07:06:37 2008 UTC (15 years, 5 months ago) by dholland
Branch: MAIN
Branch point for: jym-xensuspend
Changes since 1.53: +19 -19 lines
Diff to previous 1.53 (colored) to selected 1.470 (colored)

WARNS=4

Revision 1.53 / (download) - annotate - [select for diffs], Sat Sep 27 02:30:46 2008 UTC (15 years, 6 months ago) by matt
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2
Changes since 1.52: +10 -2 lines
Diff to previous 1.52 (colored) to selected 1.470 (colored)

Add the complex types to the floating point promotion rules.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Sep 26 22:52:24 2008 UTC (15 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.51: +6 -2 lines
Diff to previous 1.51 (colored) to selected 1.470 (colored)

Teach lint about long double _Complex (C99)

Revision 1.50.2.1 / (download) - annotate - [select for diffs], Thu Sep 18 04:29:28 2008 UTC (15 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.50: +22 -9 lines
Diff to previous 1.50 (colored) next main 1.51 (colored) to selected 1.470 (colored)

Sync with wrstuden-revivesa-base-2.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Jul 31 15:21:34 2008 UTC (15 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Changes since 1.50: +22 -9 lines
Diff to previous 1.50 (colored) to selected 1.470 (colored)

Add Picky flag; this produces more warnings:
1. long a; int i; a = i * i;
   suggests casting i to long, so that we gain precision in the multiplication.
2. warns about magnitude comparisons in enums.
3. warns about possible sign extension issues when integer types become widened.

Revision 1.45.2.1 / (download) - annotate - [select for diffs], Sun May 18 12:36:11 2008 UTC (15 years, 11 months ago) by yamt
Branch: yamt-pf42
Changes since 1.45: +133 -65 lines
Diff to previous 1.45 (colored) next main 1.46 (colored) to selected 1.470 (colored)

sync with head.

Revision 1.50 / (download) - annotate - [select for diffs], Sat May 3 16:28:56 2008 UTC (15 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, hpcarm-cleanup-nbase
Branch point for: wrstuden-revivesa
Changes since 1.49: +3 -3 lines
Diff to previous 1.49 (colored) to selected 1.470 (colored)

don't check for NaN if fpe.

Revision 1.49 / (download) - annotate - [select for diffs], Fri May 2 15:10:05 2008 UTC (15 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.48: +8 -3 lines
Diff to previous 1.48 (colored) to selected 1.470 (colored)

Since we cannot guarantee that all machines do ieee math, or that they have
the proper math setup deal with SIGFPE directly.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Apr 27 01:45:04 2008 UTC (15 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.47: +22 -7 lines
Diff to previous 1.47 (colored) to selected 1.470 (colored)

print the types involved in an error.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Apr 27 00:13:58 2008 UTC (15 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46 (colored) to selected 1.470 (colored)

reorder a couple of error messages.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Apr 25 22:18:34 2008 UTC (15 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.45: +106 -58 lines
Diff to previous 1.45 (colored) to selected 1.470 (colored)

preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.

Revision 1.44.14.1 / (download) - annotate - [select for diffs], Mon Mar 24 07:16:35 2008 UTC (16 years ago) by keiichi
Branch: keiichi-mipv6
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored) next main 1.45 (colored) to selected 1.470 (colored)

sync with head.

Revision 1.44.8.1 / (download) - annotate - [select for diffs], Sun Mar 23 00:49:04 2008 UTC (16 years, 1 month ago) by matt
Branch: matt-armv6
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored) next main 1.45 (colored) to selected 1.470 (colored)

sync with HEAD

Revision 1.45 / (download) - annotate - [select for diffs], Tue Mar 4 02:41:46 2008 UTC (16 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base
Branch point for: yamt-pf42
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored) to selected 1.470 (colored)

PR/38142: YAMAMOTO Takashi: lint -S complains on variable length arrays

Revision 1.44 / (download) - annotate - [select for diffs], Wed Oct 18 21:34:39 2006 UTC (17 years, 6 months ago) by he
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-base, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: matt-armv6, keiichi-mipv6
Changes since 1.43: +1 -13 lines
Diff to previous 1.43 (colored) to selected 1.470 (colored)

Simplify the previous change.  There's actually no need to treat constants
specially in ptconv(), the constants will be checked in convert() anyway.

Revision 1.43 / (download) - annotate - [select for diffs], Wed Oct 18 00:01:19 2006 UTC (17 years, 6 months ago) by he
Branch: MAIN
Changes since 1.42: +16 -3 lines
Diff to previous 1.42 (colored) to selected 1.470 (colored)

Partly redo when to emit warnings for argument type conversions.
Remove the apparently always true "styp(nt) != SHORT" part of the
innermost test.  Allow atomatic conversion of literals as long as
they fit into the target type.

This should fix some of the lint issues in proplib on some of our
platforms.

Approved by christos.

Revision 1.42 / (download) - annotate - [select for diffs], Wed Mar 22 02:08:55 2006 UTC (18 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored) to selected 1.470 (colored)

Coverity CID 199: make sure that rtp is not NULL before dereferencing.

Revision 1.41 / (download) - annotate - [select for diffs], Thu Apr 7 16:28:40 2005 UTC (19 years ago) by christos
Branch: MAIN
Changes since 1.40: +2 -88 lines
Diff to previous 1.40 (colored) to selected 1.470 (colored)

Factor out tyname() so that it can be used both by lint1 and lint2.
Since type_t is different between lint1.h and lint2.h include the
appropriate file depending on the pass. Make the argument mismatch
error print the type names of the types involved. Now that we have
a tyname() function we can fix the rest of the pass2 warnings to be
more explanatory, but not now.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jan 2 17:59:47 2005 UTC (19 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3
Changes since 1.39: +8 -7 lines
Diff to previous 1.39 (colored) to selected 1.470 (colored)

Shift assignment operators were handled incorrectly. On 64 bit machines,
	unsigned long x, y;
	x <<= y;
always produces a warning because y is casted to int. Handle them instead
the same way as regular shifts.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jan 2 10:40:49 2005 UTC (19 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.38: +13 -7 lines
Diff to previous 1.38 (colored) to selected 1.470 (colored)

say from what type to what time we are converting.

Revision 1.38 / (download) - annotate - [select for diffs], Sun Sep 12 08:58:52 2004 UTC (19 years, 7 months ago) by yamt
Branch: MAIN
Changes since 1.37: +6 -2 lines
Diff to previous 1.37 (colored) to selected 1.470 (colored)

recognize _Bool.

Revision 1.36.2.1 / (download) - annotate - [select for diffs], Tue Jun 22 07:24:12 2004 UTC (19 years, 10 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2
Changes since 1.36: +6 -2 lines
Diff to previous 1.36 (colored) next main 1.37 (colored) to selected 1.470 (colored)

Pull up revision 1.37 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jun 20 22:20:17 2004 UTC (19 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.36: +6 -2 lines
Diff to previous 1.36 (colored) to selected 1.470 (colored)

Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944

Revision 1.36 / (download) - annotate - [select for diffs], Fri May 30 13:37:49 2003 UTC (20 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.35: +4 -2 lines
Diff to previous 1.35 (colored) to selected 1.470 (colored)

PR/21706: Krister Walfridsson: CVT nodes not handled in ?: expressions.

Revision 1.35 / (download) - annotate - [select for diffs], Wed May 14 12:45:07 2003 UTC (20 years, 11 months ago) by wiz
Branch: MAIN
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored) to selected 1.470 (colored)

constant usually has two n.

Revision 1.34 / (download) - annotate - [select for diffs], Tue Oct 22 22:50:11 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.33: +5 -4 lines
Diff to previous 1.33 (colored) to selected 1.470 (colored)

add support for ({}) gcc shit.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Oct 22 21:09:35 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.32: +9 -4 lines
Diff to previous 1.32 (colored) to selected 1.470 (colored)

handle free-ing of temp symbols properly. Don't segv on bad node types.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Oct 22 18:15:01 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.31: +34 -26 lines
Diff to previous 1.31 (colored) to selected 1.470 (colored)

add C9X/GCC compound literal expressions.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Oct 22 13:48:51 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.30: +7 -4 lines
Diff to previous 1.30 (colored) to selected 1.470 (colored)

add variable array dimension.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Oct 22 13:31:34 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.29: +23 -4 lines
Diff to previous 1.29 (colored) to selected 1.470 (colored)

handle gcc __FUNCTION__ and C9X __func__

Revision 1.29 / (download) - annotate - [select for diffs], Tue Oct 22 00:25:29 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.28: +11 -6 lines
Diff to previous 1.28 (colored) to selected 1.470 (colored)

a cast to a pointer is an l-value.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Oct 22 00:06:46 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.27: +5 -3 lines
Diff to previous 1.27 (colored) to selected 1.470 (colored)

handle cast in the rhs of a - op.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Oct 21 22:48:13 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.26: +15 -5 lines
Diff to previous 1.26 (colored) to selected 1.470 (colored)

Ignore cast size test in initializers; look at example in the comment.
Maybe there is a better way...

Revision 1.26 / (download) - annotate - [select for diffs], Fri Sep 13 14:59:25 2002 UTC (21 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.25: +140 -77 lines
Diff to previous 1.25 (colored) to selected 1.470 (colored)

Minimize diffs with my C99 capable version [this commit does not include
C99 support.

- turn lerror() into a macro so that the filename and the line number of the
  error are printed before we abort.
- recurse in type printing to provide the proper type name.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Feb 5 03:04:29 2002 UTC (22 years, 2 months ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.24: +23 -23 lines
Diff to previous 1.24 (colored) to selected 1.470 (colored)

Replace u_quad_t with uint64_t and quad_t with int64_t, and use
<inttypes.h> to get those type definitions.  These types are more
portable, and a little more sane to do autoconf tests for.

Revision 1.24 / (download) - annotate - [select for diffs], Thu Jan 31 22:30:20 2002 UTC (22 years, 2 months ago) by tv
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored) to selected 1.470 (colored)

Use !finite() instead of isinf() in two places for better compatibility.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jan 31 19:36:54 2002 UTC (22 years, 2 months ago) by tv
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored) to selected 1.470 (colored)

Protect __RCSID and __COPYRIGHT from being invoked if not defined.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Nov 17 04:35:32 2001 UTC (22 years, 5 months ago) by perry
Branch: MAIN
Changes since 1.21: +21 -8 lines
Diff to previous 1.21 (colored) to selected 1.470 (colored)

Fix a bug in detecting overflow in unsigned multiplication.

XXX Note that the overflow code for many cases seems to be buggy. I've
only fixed one bug that was bothering me. A set of regression tests
and extensive testing are needed.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Sep 16 16:34:44 2001 UTC (22 years, 7 months ago) by wiz
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored) to selected 1.470 (colored)

Spell 'occurred' with two 'r's.

Revision 1.20 / (download) - annotate - [select for diffs], Mon May 28 12:40:37 2001 UTC (22 years, 10 months ago) by lukem
Branch: MAIN
Changes since 1.19: +115 -220 lines
Diff to previous 1.19 (colored) to selected 1.470 (colored)

cleanup (prior to more adding more features):
- convert to ANSI KNF
- remove trailing whitespace
- translate some comments from german into english

code compiles and runs clean, and tested by running "make lint" against
xlint source using previous and this lint produces same results.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 28 03:39:29 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, minoura-xpg4dl-base, minoura-xpg4dl, comdex-fall-1999-base, comdex-fall-1999
Changes since 1.18: +5 -2 lines
Diff to previous 1.18 (colored) to selected 1.470 (colored)

Propagate the value and test contexts to the right-hand side of a
comma operator.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 27 19:58:43 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored) to selected 1.470 (colored)

Search both sides of a comma operator for side effects.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Jul 27 13:50:48 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.16: +13 -13 lines
Diff to previous 1.16 (colored) to selected 1.470 (colored)

Fix a recurring typo: comparision -> comparison.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Jul 27 12:10:23 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.15: +8 -7 lines
Diff to previous 1.15 (colored) to selected 1.470 (colored)

Fix uses of uninitialized memory, and incorrect types for initializers.
From ITOH Yasufumi, PR 5861.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Apr 9 00:32:38 1998 UTC (26 years ago) by tv
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored) to selected 1.470 (colored)

.y.c <sys.mk> rule fixes.  Don't create a y.tab.h file unless asked for,
and use smarter creation of the header file.

Revision 1.14 / (download) - annotate - [select for diffs], Sun Feb 22 15:40:40 1998 UTC (26 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.13: +134 -14 lines
Diff to previous 1.13 (colored) to selected 1.470 (colored)

WARNSify

Revision 1.13 / (download) - annotate - [select for diffs], Wed Mar 12 18:28:58 1997 UTC (27 years, 1 month ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Changes since 1.12: +2 -39 lines
Diff to previous 1.12 (colored) to selected 1.470 (colored)

Remove hack for (very old) GCC bug on i386.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Oct 2 17:37:57 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-PATCH001, netbsd-1-2-BETA, netbsd-1-2, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Changes since 1.11: +4 -3 lines
Diff to previous 1.11 (colored) to selected 1.470 (colored)

insert a conversion operator from argument type to parameter type also
if the subtypes of both argument and parameter do not match (use
eqtype() instead of comparing t_tspec fields only).

Revision 1.11 / (download) - annotate - [select for diffs], Mon Oct 2 17:37:02 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.10: +16 -18 lines
Diff to previous 1.10 (colored) to selected 1.470 (colored)

removed some dubious warnings about conversion of constant operands of
bitwise operators

Revision 1.10 / (download) - annotate - [select for diffs], Mon Oct 2 17:35:57 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.9: +3 -4 lines
Diff to previous 1.9 (colored) to selected 1.470 (colored)

allow register variables as left operand of POINT; fixes PR 1442

Revision 1.9 / (download) - annotate - [select for diffs], Mon Oct 2 17:35:11 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.8: +13 -3 lines
Diff to previous 1.8 (colored) to selected 1.470 (colored)

don't print a warning about use of unitialized variables if one of the
enclosing compound statements had already an asm statement

Revision 1.8 / (download) - annotate - [select for diffs], Mon Oct 2 17:30:04 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored) to selected 1.470 (colored)

LINTED and CONSTCOND are now valid up to the next end of a
global or local declaration/definition/statement. Originally they were
valid on the current and next line, which made it hard to suppress
warnings in constructs with more then one line.

LONGLONG can now be used to suppress errors or warnings in the next
declaration, definition or statement.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Oct 2 17:22:51 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.6: +44 -10 lines
Diff to previous 1.6 (colored) to selected 1.470 (colored)

some minor bug fixes

Revision 1.6 / (download) - annotate - [select for diffs], Mon Oct 2 17:21:42 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored) to selected 1.470 (colored)

prototypes override old style function definitions
this is a gnu extension to ansi c

Revision 1.5 / (download) - annotate - [select for diffs], Mon Oct 2 17:14:44 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.4: +5 -13 lines
Diff to previous 1.4 (colored) to selected 1.470 (colored)

added inline keywords
"inline" is enabled by -g, "__inline" and "__inline__" are always available

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 2 17:08:47 1995 UTC (28 years, 6 months ago) by jpo
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored) to selected 1.470 (colored)

prefixed members of dinfo_t with 'd_'

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jul 4 01:53:09 1995 UTC (28 years, 9 months ago) by cgd
Branch: MAIN
Changes since 1.2: +39 -2 lines
Diff to previous 1.2 (colored) to selected 1.470 (colored)

hack around a bug in our gcc.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jul 3 21:24:33 1995 UTC (28 years, 9 months ago) by cgd
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored) to selected 1.470 (colored)

RCS id cleanup

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Mon Jul 3 20:56:37 1995 UTC (28 years, 9 months ago) by cgd
Branch: Jochen_Pohl
CVS Tags: Jochen_Pohl-950703
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored) to selected 1.470 (colored)

lint(1) implementation, by Jochen Pohl.  named 'xlint' for a similar
reason to why 'install' is named 'xinstall'.

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jul 3 20:56:37 1995 UTC (28 years, 9 months ago) by cgd
Branch: MAIN
Diff to selected 1.470 (colored)

Initial revision

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>