re PR c/34506 (gcc disallows comma between C/C++ OpenMP clauses)

PR c/34506
	* c-parser.c (c_parser_omp_all_clauses): Accept optional comma
	in between clauses.

	* parser.c (cp_parser_omp_all_clauses): Accept optional comma
	in between clauses.

	* gcc.dg/gomp/clause-2.c: New test.
	* g++.dg/gomp/clause-4.C: New test.

From-SVN: r131008
This commit is contained in:
Jakub Jelinek 2007-12-17 15:16:42 +01:00 committed by Jakub Jelinek
parent 7f59aaba14
commit 8085ca151e
7 changed files with 82 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2007-12-17 Jakub Jelinek <jakub@redhat.com>
PR c/34506
* c-parser.c (c_parser_omp_all_clauses): Accept optional comma
in between clauses.
2007-12-17 Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/34445

View File

@ -7262,14 +7262,22 @@ c_parser_omp_all_clauses (c_parser *parser, unsigned int mask,
const char *where)
{
tree clauses = NULL;
bool first = true;
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
location_t here = c_parser_peek_token (parser)->location;
const pragma_omp_clause c_kind = c_parser_omp_clause_name (parser);
location_t here;
pragma_omp_clause c_kind;
const char *c_name;
tree prev = clauses;
if (!first && c_parser_next_token_is (parser, CPP_COMMA))
c_parser_consume_token (parser);
first = false;
here = c_parser_peek_token (parser)->location;
c_kind = c_parser_omp_clause_name (parser);
switch (c_kind)
{
case PRAGMA_OMP_CLAUSE_COPYIN:

View File

@ -1,3 +1,9 @@
2007-12-17 Jakub Jelinek <jakub@redhat.com>
PR c/34506
* parser.c (cp_parser_omp_all_clauses): Accept optional comma
in between clauses.
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
PR debug/7081

View File

@ -19671,13 +19671,20 @@ cp_parser_omp_all_clauses (cp_parser *parser, unsigned int mask,
const char *where, cp_token *pragma_tok)
{
tree clauses = NULL;
bool first = true;
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
pragma_omp_clause c_kind = cp_parser_omp_clause_name (parser);
pragma_omp_clause c_kind;
const char *c_name;
tree prev = clauses;
if (!first && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
c_kind = cp_parser_omp_clause_name (parser);
first = false;
switch (c_kind)
{
case PRAGMA_OMP_CLAUSE_COPYIN:

View File

@ -1,3 +1,9 @@
2007-12-17 Jakub Jelinek <jakub@redhat.com>
PR c/34506
* gcc.dg/gomp/clause-2.c: New test.
* g++.dg/gomp/clause-4.C: New test.
2007-12-17 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/initialization_16.f90: Update as FLOAT/SNGL are

View File

@ -0,0 +1,23 @@
// PR c/34506
// { dg-do compile }
#define p parallel
void
foo (int x)
{
#pragma omp p num_threads (4) if (1) private (x)
;
#pragma omp p num_threads(4)if(1)private(x)
;
#pragma omp p num_threads (4), if (1) , private (x)
;
#pragma omp p num_threads(4),if(1),private(x)
;
#pragma omp p, num_threads (4), if (1), private (x) // { dg-error "clause before" }
;
#pragma omp p num_threads (4), if (1), private (x), // { dg-error "clause before" }
;
#pragma omp p num_threads (4), , if (1), private (x) // { dg-error "clause before" }
;
}

View File

@ -0,0 +1,23 @@
/* PR c/34506 */
/* { dg-do compile } */
#define p parallel
void
foo (int x)
{
#pragma omp p num_threads (4) if (1) private (x)
;
#pragma omp p num_threads(4)if(1)private(x)
;
#pragma omp p num_threads (4), if (1) , private (x)
;
#pragma omp p num_threads(4),if(1),private(x)
;
#pragma omp p, num_threads (4), if (1), private (x) /* { dg-error "clause before" } */
;
#pragma omp p num_threads (4), if (1), private (x), /* { dg-error "clause before" } */
;
#pragma omp p num_threads (4), , if (1), private (x) /* { dg-error "clause before" } */
;
}