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 Jan 23 23:11:40 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
            d_c99_bool_strict_syshdr.exp
        src/usr.bin/xlint/lint1: externs1.h lex.c

Log Message:
lint: apply strict bool mode to lex.c

There are 2 remaining expressions:

In line 244, !(kw->kw_deco & deco) is a bitwise and.  This is already
allowed for enums, it needs to be allowed for arbitrary integer
expressions as well.  This covers the many places where plain integers
are used for bit fields, together with #define.  This pattern is not as
typesafe as using enums, still it is common practice.

In line 769, the expression !finite(f) is a legitimate use of a function
that has return type int for traditional reasons.  It's the same as for
ferror.

There are several other functions like unlink, open or strcmp that have
return type int as well, but with a different meaning.  It is not yet
clear what the best way is to handle these different meanings.  Having
to write finite(f) == 0 in strict bool mode doesn't look idiomatic, on
the other hand, !strcmp(s1, s2) is exactly the pattern that strict bool
mode wants to avoid.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
    src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c \
    src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/lex.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