Commit 6637388f by Tristan Gingold Committed by Tristan Gingold

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
parent 10d1dc24
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> 2011-10-10 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.c (avr_option_override): Set * config/avr/avr.c (avr_option_override): Set
2011-10-11 Tristan Gingold <gingold@adacore.com>
* c.opt: (fallow-parameterless-variadic-functions): New.
2011-09-08 Dodji Seketeli <dodji@redhat.com> 2011-09-08 Dodji Seketeli <dodji@redhat.com>
PR c++/33255 - Support -Wunused-local-typedefs warning PR c++/33255 - Support -Wunused-local-typedefs warning
......
...@@ -700,6 +700,10 @@ Enforce class member access control semantics ...@@ -700,6 +700,10 @@ Enforce class member access control semantics
fall-virtual fall-virtual
C++ ObjC++ Ignore Warn(switch %qs is no longer supported) 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 falt-external-templates
C++ ObjC++ Ignore Warn(switch %qs is no longer supported) C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
No longer supported No longer supported
......
...@@ -3159,10 +3159,19 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs, tree expr) ...@@ -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)) if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
{ {
struct c_arg_info *ret = build_arg_info (); struct c_arg_info *ret = build_arg_info ();
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node; if (flag_allow_parameterless_variadic_functions)
error_at (c_parser_peek_token (parser)->location, {
"ISO C requires a named argument before %<...%>"); /* 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); c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{ {
......
...@@ -170,7 +170,7 @@ in the following sections. ...@@ -170,7 +170,7 @@ in the following sections.
@item C Language Options @item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}. @xref{C Dialect Options,,Options Controlling C Dialect}.
@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol @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 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol -fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
-trigraphs -no-integrated-cpp -traditional -traditional-cpp @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 ...@@ -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 arguments followed by their declarations is also provided, inside
comments, after the declaration. 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 @item -fno-asm
@opindex fno-asm @opindex fno-asm
Do not recognize @code{asm}, @code{inline} or @code{typeof} as a Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
......
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> 2011-10-11 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_effective_target_fd_truncate): * lib/target-supports.exp (check_effective_target_fd_truncate):
......
/* { dg-do compile } */
#include <stdarg.h>
extern void baz(...); /* { dg-error "requires a named argument" } */
/* { dg-do compile } */
/* { dg-options "-fallow-parameterless-variadic-functions" } */
#include <stdarg.h>
extern void baz(...);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment