Patchwork [C] Handle #pragma before a parameter

login
register
mail settings
Submitter Tristan Gingold
Date March 14, 2012, 3:51 p.m.
Message ID <A15ECB67-ECEC-47E7-AA6D-6E4FBE36A223@adacore.com>
Download mbox | patch
Permalink /patch/146643/
State New
Headers show

Comments

Tristan Gingold - March 14, 2012, 3:51 p.m.
Hi,

it happens that some system headers on VMS have #pragma between parameters.  This is spotted by building the Ada runtime.

This patch simply handles them.

Manually tested by building for ia64-hp-openvms.
No regressions for c on x86_64-darwin.

Ok for trunk ?

Tristan.

2012-03-14  Tristan Gingold  <gingold@adacore.com>

	* c-parser.c (c_parser_parameter_declaration): Handle #pragma
	before a parameter.
Joseph S. Myers - March 14, 2012, 4:33 p.m.
On Wed, 14 Mar 2012, Tristan Gingold wrote:

> Hi,
> 
> it happens that some system headers on VMS have #pragma between parameters.  This is spotted by building the Ada runtime.
> 
> This patch simply handles them.
> 
> Manually tested by building for ia64-hp-openvms.
> No regressions for c on x86_64-darwin.
> 
> Ok for trunk ?

OK.
Tristan Gingold - March 15, 2012, 8:47 a.m.
Thanks, committed.

Tristan.

On Mar 14, 2012, at 5:33 PM, Joseph S. Myers wrote:

> On Wed, 14 Mar 2012, Tristan Gingold wrote:
> 
>> Hi,
>> 
>> it happens that some system headers on VMS have #pragma between parameters.  This is spotted by building the Ada runtime.
>> 
>> This patch simply handles them.
>> 
>> Manually tested by building for ia64-hp-openvms.
>> No regressions for c on x86_64-darwin.
>> 
>> Ok for trunk ?
> 
> OK.
> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com

Patch

diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 56134c2..0d6f7a4 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3305,6 +3305,11 @@  c_parser_parameter_declaration (c_parser *parser, tree at
   tree prefix_attrs;
   tree postfix_attrs = NULL_TREE;
   bool dummy = false;
+
+  /* Accept #pragmas between parameter declarations.  */
+  while (c_parser_next_token_is (parser, CPP_PRAGMA))
+    c_parser_pragma (parser, pragma_external);
+
   if (!c_parser_next_token_starts_declspecs (parser))
     {
       c_token *token = c_parser_peek_token (parser);