Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src

Module Name:    src
Committed By:   rillig
Date:           Sat Apr 16 13:25:27 UTC 2022

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_081.c msg_100.c msg_340.c
        src/usr.bin/xlint/lint1: err.c externs1.h main1.c

Log Message:
lint: model C language levels in a future-compatible way

The options -t, -s and -S are confusing because they are used
inconsistently.  The option -S enables C99 features, but when using it
instead of -s, it also doesn't enable all checks required by C90 and
later.  Prepare fixing of these inconsistencies by replacing the flag
variables with language levels that can be extended in a
straight-forward way as new C standards arrive.

| option | allow_trad | allow_c90 | allow_c99 | allow_c11 |
| -t     | x          | -         | -         | -         |
| (none) | x          | x         | -         | -         |
| -s     | -          | x         | -         | -         |
| -S     | -          | x         | x         | -         |
| -Ac11  | -          | x         | x         | x         |

Each usage of the old flag variables will be inspected and migrated
individually, to clean up the subtle variations in the conditions and to
provide a simpler model.

When lint was created in 1995, its focus was migrating traditional C
code to C90 code.  Lint does not help in migrating from C90 to C99 or
from C99 to C11 since there are only few silent changes, and simply
because nobody took the time to implement these migration aids.  If
necessary, such migration modes could be added separately.

There is a small functional change: when the option -s is combined with
either -S or -Ac11, lint now only keeps the last of these options.
Previously, these options could be combined, leading to a mixture of
language levels, halfway between C90, C99 and C11.  Especially combining
traditional C with C11 doesn't make sense, but xlint currently allows

The 3 tests that accidentally specified multiple language levels have
been adjusted to a single language level.

To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_081.c \
    src/tests/usr.bin/xlint/lint1/msg_100.c \
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_340.c
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/xlint/lint1/main1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Home | Main Index | Thread Index | Old Index