+2015-03-27 Tobias Burnus <burnus@net-b.de>
+
+ PR c/65586
+ * c-parser.c (c_parser_skip_to_pragma_eol): Optionally, don't
+ error out.
+ (c_parser_omp_for, c_parser_omp_parallel, c_parser_omp_distribute,
+ c_parser_omp_teams, c_parser_omp_target, c_parser_omp_declare):
+ Update calls to not error for skipped omp pragmas with -fopenmp-simd.
+
2015-03-19 Jakub Jelinek <jakub@redhat.com>
* c-decl.c (c_decl_attributes): Also add "omp declare target"
end of line marker. */
static void
-c_parser_skip_to_pragma_eol (c_parser *parser)
+c_parser_skip_to_pragma_eol (c_parser *parser, bool error_if_not_eol = true)
{
gcc_assert (parser->in_pragma);
parser->in_pragma = false;
- if (!c_parser_require (parser, CPP_PRAGMA_EOL, "expected end of line"))
- while (true)
- {
- c_token *token = c_parser_peek_token (parser);
- if (token->type == CPP_EOF)
- break;
- if (token->type == CPP_PRAGMA_EOL)
- {
- c_parser_consume_token (parser);
- break;
- }
- c_parser_consume_token (parser);
- }
+ if (error_if_not_eol && c_parser_peek_token (parser)->type != CPP_PRAGMA_EOL)
+ c_parser_error (parser, "expected end of line");
+
+ cpp_ttype token_type;
+ do
+ {
+ c_token *token = c_parser_peek_token (parser);
+ token_type = token->type;
+ if (token_type == CPP_EOF)
+ break;
+ c_parser_consume_token (parser);
+ }
+ while (token_type != CPP_PRAGMA_EOL);
parser->error = false;
}
}
if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return NULL_TREE;
}
}
else if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return NULL_TREE;
}
else if (c_parser_next_token_is (parser, CPP_NAME))
}
if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return NULL_TREE;
}
}
if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return NULL_TREE;
}
}
else if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return false;
}
else if (strcmp (p, "data") == 0)
}
if (!flag_openmp) /* flag_openmp_simd */
{
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
return;
}
if (strcmp (p, "target") == 0)
+2015-03-27 Tobias Burnus <burnus@net-b.de>
+
+ PR c/65586
+ * parser.c (cp_parser_omp_for, cp_parser_omp_parallel,
+ cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target,
+ cp_parser_omp_declare): Don't show error for skipped omp pragmas with
+ -fopenmp-simd.
+
2015-03-27 Marek Polacek <polacek@redhat.com>
PR c++/65556
}
if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return NULL_TREE;
}
}
else if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return NULL_TREE;
}
else if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
}
if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return NULL_TREE;
}
}
if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return NULL_TREE;
}
}
else if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return false;
}
else if (strcmp (p, "data") == 0)
}
if (!flag_openmp) /* flag_openmp_simd */
{
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return;
}
if (strcmp (p, "target") == 0)
+2015-03-27 Tobias Burnus <burnus@net-b.de>
+
+ PR c/65586
+ * g++.dg/gomp/openmp-simd-3.C: New.
+ * gcc.dg/gomp/openmp-simd-3.c: New.
+
2015-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/65248
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp-simd -fdump-tree-original" } */
+
+/* PR c/65586 */
+
+void foo() { }
+
+int main() {
+#pragma omp for collapse(1)
+ for (int i = 1; i <= 151; i+=31)
+ foo();
+}
+
+/* { dg-final { scan-tree-dump-not "omp" "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp-simd -fdump-tree-original" } */
+
+/* PR c/65586 */
+
+void foo() { }
+
+int main() {
+#pragma omp for collapse(1)
+ for (int i = 1; i <= 151; i+=31)
+ foo();
+}
+
+/* { dg-final { scan-tree-dump-not "omp" "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */