Source-Changes archive

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

CVS commit: src/tests/usr.bin/xlint/lint1



Module Name:    src
Committed By:   rillig
Date:           Fri Mar  5 16:31:49 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_130.c

Log Message:
tests/lint: add test for incompatible enums in switch

Neither lint nor GCC 10 nor Clang 8 have a warning for an enum type
mismatch in a switch statement.

GCC 10 issues a warning but completely misses the point of the
mismatched enum types.  It only warns because in this test, EVENING has
the numeric value 3, which is out of bounds for enum color, where the
valid range is from 0 to 2.  It says:

> msg_130.c:45:2: warning:
>     case value ‘3’ not in enumerated type ‘enum color’ [-Wswitch]

Clang 8 behaves almost the same, it just doesn't mention the value of
the constant, saying merely 'case value not in enumerated type'.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_130.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