c.opt: (fallow-parameterless-variadic-functions): New.

c-family/ChangeLog
2011-10-11  Tristan Gingold  <gingold@adacore.com>

        * c.opt: (fallow-parameterless-variadic-functions): New.

ChangeLog
2011-10-11  Tristan Gingold  <gingold@adacore.com>

        * doc/invoke.texi (C Dialect Options): Document
        -fallow-parameterless-variadic-functions.
        * c-parser.c (c_parser_parms_list_declarator): Handle it.

testsuite/ChangeLog
2011-10-11  Tristan Gingold  <gingold@adacore.com>

        * gcc.dg/va-arg-4.c: New test.
        * gcc.dg/va-arg-5.c: Ditto.

From-SVN: r179786
This commit is contained in:
Tristan Gingold 2011-10-11 07:13:59 +00:00 committed by Tristan Gingold
parent 10d1dc24ff
commit 6637388fdc
8 changed files with 47 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2011-10-11 Tristan Gingold <gingold@adacore.com>
* doc/invoke.texi (C Dialect Options): Document
-fallow-parameterless-variadic-functions.
* c-parser.c (c_parser_parms_list_declarator): Handle it.
2011-10-10 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.c (avr_option_override): Set

View File

@ -1,3 +1,7 @@
2011-10-11 Tristan Gingold <gingold@adacore.com>
* c.opt: (fallow-parameterless-variadic-functions): New.
2011-09-08 Dodji Seketeli <dodji@redhat.com>
PR c++/33255 - Support -Wunused-local-typedefs warning

View File

@ -700,6 +700,10 @@ Enforce class member access control semantics
fall-virtual
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
fallow-parameterless-variadic-functions
C ObjC Var(flag_allow_parameterless_variadic_functions)
Allow variadic functions without named parameter
falt-external-templates
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
No longer supported

View File

@ -3159,10 +3159,19 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs, tree expr)
if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
{
struct c_arg_info *ret = build_arg_info ();
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node;
error_at (c_parser_peek_token (parser)->location,
"ISO C requires a named argument before %<...%>");
if (flag_allow_parameterless_variadic_functions)
{
/* F (...) is allowed. */
ret->types = NULL_TREE;
}
else
{
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node;
error_at (c_parser_peek_token (parser)->location,
"ISO C requires a named argument before %<...%>");
}
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{

View File

@ -170,7 +170,7 @@ in the following sections.
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
-aux-info @var{filename} @gol
-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
@ -1622,6 +1622,13 @@ character). In the case of function definitions, a K&R-style list of
arguments followed by their declarations is also provided, inside
comments, after the declaration.
@item -fallow-parameterless-variadic-functions
Accept variadic functions without named parameters.
Although it is possible to define such a function, this is not very
useful as it is not possible to read the arguments. This is only
supported for C as this construct is allowed by C++.
@item -fno-asm
@opindex fno-asm
Do not recognize @code{asm}, @code{inline} or @code{typeof} as a

View File

@ -1,3 +1,8 @@
2011-10-11 Tristan Gingold <gingold@adacore.com>
* gcc.dg/va-arg-4.c: New test.
* gcc.dg/va-arg-5.c: Ditto.
2011-10-11 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_effective_target_fd_truncate):

View File

@ -0,0 +1,3 @@
/* { dg-do compile } */
#include <stdarg.h>
extern void baz(...); /* { dg-error "requires a named argument" } */

View File

@ -0,0 +1,4 @@
/* { dg-do compile } */
/* { dg-options "-fallow-parameterless-variadic-functions" } */
#include <stdarg.h>
extern void baz(...);