+2016-06-29 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-parser.c (c_parser_pragma) <PRAGMA_OMP_CANCELLATION_POINT>:
+ Move pragma context checking into...
+ (c_parser_omp_cancellation_point): ... here, and improve
+ diagnostic messages.
+ * c-typeck.c (c_finish_omp_cancel)
+ (c_finish_omp_cancellation_point): Improve diagnostic messages.
+
2016-06-29 Jakub Jelinek <jakub@redhat.com>
PR c/71685
static void c_parser_omp_taskwait (c_parser *);
static void c_parser_omp_taskyield (c_parser *);
static void c_parser_omp_cancel (c_parser *);
-static void c_parser_omp_cancellation_point (c_parser *);
enum pragma_context { pragma_external, pragma_struct, pragma_param,
pragma_stmt, pragma_compound };
static bool c_parser_pragma (c_parser *, enum pragma_context, bool *);
+static void c_parser_omp_cancellation_point (c_parser *, enum pragma_context);
static bool c_parser_omp_target (c_parser *, enum pragma_context, bool *);
static void c_parser_omp_end_declare_target (c_parser *);
static void c_parser_omp_declare (c_parser *, enum pragma_context);
return false;
case PRAGMA_OMP_CANCELLATION_POINT:
- if (context != pragma_compound)
- {
- if (context == pragma_stmt)
- c_parser_error (parser, "%<#pragma omp cancellation point%> may "
- "only be used in compound statements");
- goto bad_stmt;
- }
- c_parser_omp_cancellation_point (parser);
+ c_parser_omp_cancellation_point (parser, context);
return false;
case PRAGMA_OMP_THREADPRIVATE:
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASKGROUP))
static void
-c_parser_omp_cancellation_point (c_parser *parser)
+c_parser_omp_cancellation_point (c_parser *parser, enum pragma_context context)
{
location_t loc = c_parser_peek_token (parser)->location;
tree clauses;
return;
}
+ if (context != pragma_compound)
+ {
+ if (context == pragma_stmt)
+ error_at (loc, "%<#pragma omp cancellation point%> may only be used in"
+ " compound statements");
+ else
+ c_parser_error (parser, "expected declaration specifiers");
+ c_parser_skip_to_pragma_eol (parser, false);
+ return;
+ }
+
clauses
= c_parser_omp_all_clauses (parser, OMP_CANCELLATION_POINT_CLAUSE_MASK,
"#pragma omp cancellation point");
mask = 8;
else
{
- error_at (loc, "%<#pragma omp cancel must specify one of "
+ error_at (loc, "%<#pragma omp cancel%> must specify one of "
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> "
"clauses");
return;
mask = 8;
else
{
- error_at (loc, "%<#pragma omp cancellation point must specify one of "
+ error_at (loc, "%<#pragma omp cancellation point%> must specify one of "
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> "
"clauses");
return;
+2016-06-29 Thomas Schwinge <thomas@codesourcery.com>
+
+ * parser.c (cp_parser_pragma) <PRAGMA_OMP_CANCELLATION_POINT>:
+ Move pragma context checking into...
+ (cp_parser_omp_cancellation_point): ... here, and improve
+ diagnostic messages.
+ * semantics.c (finish_omp_cancel, finish_omp_cancellation_point):
+ Improve diagnostic messages.
+
2016-06-28 Jakub Jelinek <jakub@redhat.com>
* Make-lang.in: Don't cat ../stage_current if it does not exist.
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASKGROUP))
static void
-cp_parser_omp_cancellation_point (cp_parser *parser, cp_token *pragma_tok)
+cp_parser_omp_cancellation_point (cp_parser *parser, cp_token *pragma_tok,
+ enum pragma_context context)
{
tree clauses;
bool point_seen = false;
if (!point_seen)
{
cp_parser_error (parser, "expected %<point%>");
- cp_parser_require_pragma_eol (parser, pragma_tok);
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
+ return;
+ }
+
+ if (context != pragma_compound)
+ {
+ if (context == pragma_stmt)
+ error_at (pragma_tok->location,
+ "%<#pragma omp cancellation point%> may only be used in"
+ " compound statements");
+ else
+ cp_parser_error (parser, "expected declaration specifiers");
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return;
}
break;
case PRAGMA_OMP_CANCELLATION_POINT:
- switch (context)
- {
- case pragma_compound:
- cp_parser_omp_cancellation_point (parser, pragma_tok);
- return false;
- case pragma_stmt:
- error_at (pragma_tok->location,
- "%<#pragma omp cancellation point%> may only be "
- "used in compound statements");
- break;
- default:
- goto bad_stmt;
- }
- break;
+ cp_parser_omp_cancellation_point (parser, pragma_tok, context);
+ return false;
case PRAGMA_OMP_THREADPRIVATE:
cp_parser_omp_threadprivate (parser, pragma_tok);
mask = 8;
else
{
- error ("%<#pragma omp cancel must specify one of "
+ error ("%<#pragma omp cancel%> must specify one of "
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> clauses");
return;
}
mask = 8;
else
{
- error ("%<#pragma omp cancellation point must specify one of "
+ error ("%<#pragma omp cancellation point%> must specify one of "
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> clauses");
return;
}
+2016-06-29 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/gomp/cancel-1.c: Extend.
+
2016-06-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/71625
}
}
}
+
+#pragma omp cancellation point /* { dg-error "expected declaration specifiers before end of line" } */
+
+void
+f4 (void)
+{
+ if (0)
+#pragma omp cancellation EKAHI /* { dg-error "expected .point. before .EKAHI." } */
+ ;
+#pragma omp cancellation HO OKAHI /* { dg-error "expected .point. before .HO." } */
+ if (0)
+#pragma omp cancellation point /* { dg-error ".pragma omp cancellation point. may only be used in compound statements" } */
+ ;
+#pragma omp cancellation point /* { dg-error ".pragma omp cancellation point. must specify one of" } */
+}