Home | History | Annotate | Download | only in lint2
History log of /src/usr.bin/xlint/lint2/main2.c
RevisionDateAuthorComments
 1.36  24-May-2025  rillig lint: constify
 1.35  03-Dec-2023  rillig 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.
 1.34  13-Jul-2023  rillig lint: indent copyright lines consistently
 1.33  10-Jul-2023  rillig lint: replce sprintf with snprintf

Even though the sprintf calls were safe, they looked suspicious.

No functional change.
 1.32  10-Jul-2023  rillig lint: clean up lint2
 1.31  03-Jul-2023  rillig lint: sync usage messages with reality
 1.30  03-Jul-2023  rillig lint: invert the -u, -v and -z flags

Now they behave the same as in the manual page.

No functional change.
 1.29  09-Jun-2023  rillig lint: indent local variables consistently

No binary change.
 1.28  28-Mar-2023  rillig lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
 1.27  21-Feb-2023  rillig lint: return instead of calling exit from main

No functional change.
 1.26  14-Jan-2023  rillig lint: rename lint2 functions to be more expressive
 1.25  13-Jan-2023  rillig 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.
 1.24  20-May-2022  rillig lint: use __RCSID in lint mode as well

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

No binary change.
 1.23  16-Nov-2021  rillig lint: clean up initialization of lint2 symbol table

No functional change.
 1.22  05-Sep-2021  rillig lint: hide irrelevant type information from lint2

No functional change.
 1.21  28-Aug-2021  rillig lint: sort the lint2 diagnostics by symbol name
 1.20  28-Aug-2021  rillig lint: remove unused parameter from forall

No functional change.
 1.19  22-Aug-2021  rillig lint: constify lint2 checking functions

No functional change.
 1.18  11-Aug-2021  rillig lint: add reminder to sort the output of lint2
 1.17  18-Apr-2021  rillig lint: remove WARNS=3, falling back to the default WARNS=5

It's strange that GCC does not warn about the nonliteral format strings
in lint1/err.c, lint2/msg.c and lint2/read.c, despite -Wformat=2, but
Clang does.
 1.16  18-Apr-2021  rillig lint: clean up option parsing
 1.15  02-Apr-2021  rillig lint: add parentheses after sizeof, as required by share/misc/style

No functional change.
 1.14  26-Mar-2021  rillig lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'

No functional change.
 1.13  16-Jan-2021  rillig 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.
 1.12  12-Jan-2021  rillig lint: update usage for lint1 and lint2

(Forgotten in the previous commit.)
 1.11  12-Jan-2021  rillig 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.
 1.10  04-Jan-2021  rillig lint: fix typos and other minor stylistic issues
 1.9  05-Sep-2016  sevan Drop main() prototype.
 1.8  14-Jan-2010  christos Add a list of functions where we usually don't care about their return
code. Can be bypassed by -hh
 1.7  20-Jun-2004  jmc 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
 1.6  31-Jan-2002  tv branches: 1.6.4;
Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.5  21-Nov-2001  wiz "than" instead of "then".
 1.4  28-May-2001  lukem 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.
 1.3  22-Feb-1998  christos WARNSify
 1.2  03-Jul-1995  cgd RCS id cleanup
 1.1  03-Jul-1995  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  03-Jul-1995  cgd lint(1) implementation, by Jochen Pohl. named 'xlint' for a similar
reason to why 'install' is named 'xinstall'.
 1.6.4.1  22-Jun-2004  tron Pull up revision 1.7 (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

RSS XML Feed