diff options
Diffstat (limited to 'gnu/egcs/gcc')
-rw-r--r-- | gnu/egcs/gcc/flags.h | 5 | ||||
-rw-r--r-- | gnu/egcs/gcc/stmt.c | 3 | ||||
-rw-r--r-- | gnu/egcs/gcc/toplev.c | 10 |
3 files changed, 17 insertions, 1 deletions
diff --git a/gnu/egcs/gcc/flags.h b/gnu/egcs/gcc/flags.h index a63a4e5ab14..c2e0369ab6b 100644 --- a/gnu/egcs/gcc/flags.h +++ b/gnu/egcs/gcc/flags.h @@ -143,6 +143,11 @@ extern unsigned stack_larger_than_size; extern int warn_aggregate_return; +/* Nonzero means warn about any automatic declaration whose size is not + constant. */ + +extern int warn_variable_decl; + /* Nonzero if generating code to do profiling. */ extern int profile_flag; diff --git a/gnu/egcs/gcc/stmt.c b/gnu/egcs/gcc/stmt.c index 7f8a571c4d1..26950fbafd4 100644 --- a/gnu/egcs/gcc/stmt.c +++ b/gnu/egcs/gcc/stmt.c @@ -3598,6 +3598,9 @@ expand_decl (decl) { rtx address, size; + if (warn_variable_decl) + warning ("variable-sized declaration"); + /* Record the stack pointer on entry to block, if have not already done so. */ if (thisblock->data.block.stack_level == 0) diff --git a/gnu/egcs/gcc/toplev.c b/gnu/egcs/gcc/toplev.c index f8f616fb300..3757bb9ac3f 100644 --- a/gnu/egcs/gcc/toplev.c +++ b/gnu/egcs/gcc/toplev.c @@ -1272,6 +1272,12 @@ int warn_inline; int warn_aggregate_return; +/* Nonzero means warn about any automatic declaration whose size is not + constant. */ + +int warn_variable_decl; + + /* Likewise for -W. */ lang_independent_options W_options[] = @@ -1292,7 +1298,9 @@ lang_independent_options W_options[] = {"stack-protector", &warn_stack_protector, 1, "Warn when disabling stack protector for some reason"}, {"trampolines", &warn_trampolines, 1, - "Warn when trampolines are emitted"} + "Warn when trampolines are emitted"}, + {"variable-decl", &warn_variable_decl, 1, + "Warn about variable-sized declarations"} }; /* Output files for assembler code (real compiler output) |