aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorJosh Triplett <josh@freedesktop.org>2007-05-22 13:30:58 -0700
committerJosh Triplett <josh@freedesktop.org>2007-05-22 13:30:58 -0700
commit63eaf03c8323ce027dc3cd16ae050c57daec6eed (patch)
tree251b67fc51714ee46241717b007c7736207cda28
parent1cc42170efe8cdb5f3b1e41e26d796e04c31dc95 (diff)
downloadsparse-dev-63eaf03c8323ce027dc3cd16ae050c57daec6eed.tar.gz
Add -Wno-old-initializer to turn off warnings about non-C99 struct initializers
Signed-off-by: Josh Triplett <josh@freedesktop.org>
-rwxr-xr-xcgcc2
-rw-r--r--lib.c2
-rw-r--r--lib.h1
-rw-r--r--parse.c3
4 files changed, 6 insertions, 2 deletions
diff --git a/cgcc b/cgcc
index e56226ef..a364c0ac 100755
--- a/cgcc
+++ b/cgcc
@@ -66,7 +66,7 @@ exit 0;
sub check_only_option {
my ($arg) = @_;
- return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sig|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undefined-preprocessor|ptr-subtraction-blows|cast-to-address-space|decl|transparent-union|address-space|enum-mismatch|do-while)$/;
+ return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sig|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undefined-preprocessor|ptr-subtraction-blows|cast-to-address-space|decl|transparent-union|address-space|enum-mismatch|do-while|old-initializer)$/;
return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/;
return 0;
}
diff --git a/lib.c b/lib.c
index b678990c..8ffb2575 100644
--- a/lib.c
+++ b/lib.c
@@ -204,6 +204,7 @@ int Waddress_space = 1;
int Wenum_mismatch = 1;
int Wdo_while = 1;
int Wuninitialized = 1;
+int Wold_initializer = 1;
int dbg_entry = 0;
int dbg_dead = 0;
@@ -352,6 +353,7 @@ static const struct warning {
{ "enum-mismatch", &Wenum_mismatch },
{ "do-while", &Wdo_while },
{ "uninitialized", &Wuninitialized },
+ { "old-initializer", &Wold_initializer },
};
enum {
diff --git a/lib.h b/lib.h
index df9cfc43..7f33d75c 100644
--- a/lib.h
+++ b/lib.h
@@ -101,6 +101,7 @@ extern int Wshadow;
extern int Wcast_truncate;
extern int Wdo_while;
extern int Wuninitialized;
+extern int Wold_initializer;
extern int dbg_entry;
extern int dbg_dead;
diff --git a/parse.c b/parse.c
index eb86bf61..dc4e2d75 100644
--- a/parse.c
+++ b/parse.c
@@ -1830,7 +1830,8 @@ static struct token *single_initializer(struct expression **ep, struct token *to
if ((token_type(token) == TOKEN_IDENT) && match_op(next, ':')) {
struct expression *expr = identifier_expression(token);
- warning(token->pos, "obsolete struct initializer, use C99 syntax");
+ if (Wold_initializer)
+ warning(token->pos, "obsolete struct initializer, use C99 syntax");
token = initializer(&expr->ident_expression, next->next);
if (expr->ident_expression)
*ep = expr;