aboutsummaryrefslogtreecommitdiff
path: root/cgcc
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2009-10-11 22:51:56 +0000
committerChristopher <sparse@chrisli.org>2010-03-28 17:51:36 -0700
commitf09699fa80b3b15b94b3e1878ac6cdfdb48f43ac (patch)
treee29fe5fb76dbba97a7dad2eda54de4a694c53a51 /cgcc
parentRename -Wall to Wsparse-all, so it doesn't get turned on unintentionally (diff)
downloadsparse-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 'cgcc')
-rwxr-xr-xcgcc2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgcc b/cgcc
index 8005c3c..d37cf88 100755
--- a/cgcc
+++ b/cgcc
@@ -88,7 +88,7 @@ exit 0;
sub check_only_option {
my ($arg) = @_;
- return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sign|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undef|ptr-subtraction-blows|cast-to-as|decl|transparent-union|address-space|enum-mismatch|do-while|old-initializer|non-pointer-null|paren-string|return-void|sparse-all)$/;
+ return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sign|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undef|ptr-subtraction-blows|cast-to-as|decl|transparent-union|address-space|enum-mismatch|do-while|old-initializer|non-pointer-null|paren-string|return-void|designated-init|sparse-all)$/;
return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/;
return 0;
}