2022-06-21 00:13:35 +03:00
|
|
|
/* $NetBSD: msg_100.c,v 1.6 2022/06/20 21:13:36 rillig Exp $ */
|
2021-01-02 13:22:42 +03:00
|
|
|
# 3 "msg_100.c"
|
|
|
|
|
2022-06-21 00:13:35 +03:00
|
|
|
/* Test for message: unary '+' is illegal in traditional C [100] */
|
2021-01-02 13:22:42 +03:00
|
|
|
|
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
it.
The 3 tests that accidentally specified multiple language levels have
been adjusted to a single language level.
2022-04-16 16:25:27 +03:00
|
|
|
/* lint1-flags: -tw */
|
2021-01-09 00:25:03 +03:00
|
|
|
|
|
|
|
int
|
2022-06-15 23:18:31 +03:00
|
|
|
unary_plus(x)
|
|
|
|
int x;
|
|
|
|
{
|
2022-06-21 00:13:35 +03:00
|
|
|
/* expect+1: warning: unary '+' is illegal in traditional C [100] */
|
2022-06-15 23:18:31 +03:00
|
|
|
return +x;
|
2021-01-09 00:25:03 +03:00
|
|
|
}
|