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:           Fri Apr  9 23:03:26 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: d_c99_init.c d_c99_init.exp
            d_init_array_using_string.c d_init_array_using_string.exp
        src/usr.bin/xlint/lint1: init.c

Log Message:
lint: fix initialization with brace-enclosed string literal

C99 allows this form in 6.7.8p14 and p15.

The previous lint tests did not cover the case of an array at the top
level of the object to be initialized, they only covered the error cases
(d_c99_init.c, variables 'prefixed_message' and 'message_with_suffix').

Lint is now more generous than strictly required by C99, but since GCC
and Clang already cover the case of 'message_with_suffix', this is ok.

The test d_init_array_using_string.c was wrong before in rejecting the
initializer for 'extra_braces'.  I had tested that Clang generated a
warning for this, but I had not inspected its warning carefully enough.
Clang had not warned about the extra braces but only about a type
mismatch since I tested on a platform where wchar_t was 16 bit.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/d_c99_init.exp
cvs rdiff -u -r1.3 -r1.4 \
    src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
    src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/init.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