From 7edb10625104be0ca3dcce2ff1a29bf1e11bf047 Mon Sep 17 00:00:00 2001 From: dodji Date: Mon, 30 Apr 2012 11:43:57 +0000 Subject: 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 --- gcc/builtins.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/builtins.c') 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 ; 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 % 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 " "% is declared with % storage"); } -- cgit v1.2.1