diff options
author | 2009-10-11 22:51:56 +0000 | |
---|---|---|
committer | 2010-03-28 17:51:36 -0700 | |
commit | f09699fa80b3b15b94b3e1878ac6cdfdb48f43ac (patch) | |
tree | e29fe5fb76dbba97a7dad2eda54de4a694c53a51 /cse.c | |
parent | Rename -Wall to Wsparse-all, so it doesn't get turned on unintentionally (diff) | |
download | sparse-f09699fa80b3b15b94b3e1878ac6cdfdb48f43ac.tar.gz sparse-f09699fa80b3b15b94b3e1878ac6cdfdb48f43ac.tar.bz2 sparse-f09699fa80b3b15b94b3e1878ac6cdfdb48f43ac.zip |
New attribute designated_init: mark a struct as requiring designated init
Some structure types provide a set of fields of which most users will
only initialize the subset they care about. Users of these types should
always use designated initializers, to avoid relying on the specific
structure layout. Examples of this type of structure include the many
*_operations structures in Linux, which contain a set of function
pointers; these structures occasionally gain a new field, lose an
obsolete field, or change the function signature for a field.
Add a new attribute designated_init; when used on a struct, it tells
Sparse to warn on any positional initialization of a field in that
struct.
The new flag -Wdesignated-init controls these warnings. Since these
warnings only fire for structures explicitly tagged with the attribute,
enable the warning by default.
Includes documentation and test case.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'cse.c')
0 files changed, 0 insertions, 0 deletions