Source-Changes archive

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

CVS commit: src/sys/sys



Module Name:    src
Committed By:   kamil
Date:           Sun Sep 22 23:13:10 UTC 2019

Modified Files:
        src/sys/sys: cdefs.h

Log Message:
Make __CTASSERT static assert again

Today GCC/Clang allow to specify typedef char[] with the dynamic VLA
property (as introduced in C99). This means that __CTASSERT(), when
misused with run-time semantics, was a dummy check generating either
1 or -1 size of typedef char[].

It was caught in runtime by kUBSan as -1 is size of VLA with unspecified
semantics in runtime (Undefined Behavior).

Use bit-field to enforce compile-time constant.

This approach has been inspired by the Perl variation of static_assert().


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/sys/cdefs.h

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