diff options
author | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-30 11:43:57 +0000 |
---|---|---|
committer | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-30 11:43:57 +0000 |
commit | 7edb10625104be0ca3dcce2ff1a29bf1e11bf047 (patch) | |
tree | e79bab429f035c8a49182501433c80c03c767993 /gcc/builtins.c | |
parent | 611f1003dbf4ebb341c2eda0fcc0e058c421eb6b (diff) | |
download | gcc-7edb10625104be0ca3dcce2ff1a29bf1e11bf047.tar.gz |
Add -Wvarargs option
Several warnings related to questionable usage cases of variadic
function related macros (like va_start) could not be controlled by any
warning-related macro. Fixed thus, by introducing the -Wvarargs
option.
Tested on x86_64-unknown-linux-gnu against trunk.
gcc/c-family/
* c.opt (Wvarargs): Define new option.
gcc/
* builtins.c (fold_builtin_next_arg): Use OPT_Wvarargs as an
argument for the various warning_at calls.
gcc/doc/
* invoke.texi: Update the documentation.
gcc/testsuite/
* c-c++-common/Wvarargs.c: New test case.
* c-c++-common/Wvarargs-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186978 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 5ddc47bd7ea..41a052b1d8f 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -12127,8 +12127,8 @@ fold_builtin_next_arg (tree exp, bool va_start_p) /* Evidently an out of date version of <stdarg.h>; can't validate va_start's second argument, but can still work as intended. */ warning_at (current_location, - 0, - "%<__builtin_next_arg%> called without an argument"); + OPT_Wvarargs, + "%<__builtin_next_arg%> called without an argument"); return true; } else if (nargs > 1) @@ -12164,7 +12164,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) argument so that we will get wrong-code because of it. */ warning_at (current_location, - 0, + OPT_Wvarargs, "second parameter of %<va_start%> not last named argument"); } @@ -12177,7 +12177,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) else if (DECL_REGISTER (arg)) { warning_at (current_location, - 0, + OPT_Wvarargs, "undefined behaviour when second parameter of " "%<va_start%> is declared with %<register%> storage"); } |