diff options
author | Tristan Gingold <gingold@adacore.com> | 2011-10-11 07:13:59 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@gcc.gnu.org> | 2011-10-11 07:13:59 +0000 |
commit | 6637388fdc4b4c82c906966024f9012fc0c71df5 (patch) | |
tree | 42265edef2e5b8b22a409439cc87ddca221acd00 /gcc/c-parser.c | |
parent | 10d1dc24ff815c3ed2b9c66493f05e44d5d7bafe (diff) | |
download | gcc-6637388fdc4b4c82c906966024f9012fc0c71df5.tar.gz |
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
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index c948b802ca5..af6cc149efc 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -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)) { |