ctx = c_parser_omp_context_selector_specification (parser, parms);
if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, false);
+ ctx = omp_check_context_selector (match_loc, ctx,
+ OMP_CTX_DECLARE_VARIANT);
if (ctx != error_mark_node && variant != error_mark_node)
{
if (TREE_CODE (variant) != FUNCTION_DECL)
NULL_TREE);
if (ctx == error_mark_node)
goto error;
- ctx = omp_check_context_selector (match_loc, ctx, true);
+ ctx = omp_check_context_selector (match_loc, ctx,
+ OMP_CTX_METADIRECTIVE);
if (ctx == error_mark_node)
goto error;
ctx = cp_parser_omp_context_selector_specification (parser, true);
if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, false);
+ ctx = omp_check_context_selector (match_loc, ctx,
+ OMP_CTX_DECLARE_VARIANT);
if (ctx != error_mark_node && variant != error_mark_node)
{
tree match_loc_node
ctx = cp_parser_omp_context_selector_specification (parser, false);
if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, true);
+ ctx = omp_check_context_selector (match_loc, ctx,
+ OMP_CTX_METADIRECTIVE);
if (ctx == error_mark_node)
goto fail;
continue;
}
set_selectors = omp_check_context_selector
- (gfc_get_location (&odv->where), set_selectors, false);
+ (gfc_get_location (&odv->where), set_selectors,
+ OMP_CTX_DECLARE_VARIANT);
if (set_selectors != error_mark_node)
{
if (!variant_proc_sym->attr.implicit_type
tree ctx = gfc_trans_omp_set_selector (variant->selectors,
variant->where);
ctx = omp_check_context_selector (gfc_get_location (&variant->where),
- ctx, true);
+ ctx, OMP_CTX_METADIRECTIVE);
if (ctx == error_mark_node)
return error_mark_node;
it is correct or error_mark_node otherwise. */
tree
-omp_check_context_selector (location_t loc, tree ctx, bool metadirective_p)
+omp_check_context_selector (location_t loc, tree ctx,
+ enum omp_ctx_directive directive)
{
bool tss_seen[OMP_TRAIT_SET_LAST], ts_seen[OMP_TRAIT_LAST];
/* This restriction is documented in the spec in the section
for the metadirective "when" clause (7.4.1 in the 5.2 spec). */
- if (metadirective_p
+ if (directive == OMP_CTX_METADIRECTIVE
&& ts_code == OMP_TRAIT_CONSTRUCT_SIMD
&& OMP_TS_PROPERTIES (ts))
{
return error_mark_node;
}
+ /* "simd" is not allowed at all in "begin declare variant"
+ selectors. */
+ if (directive == OMP_CTX_BEGIN_DECLARE_VARIANT
+ && ts_code == OMP_TRAIT_CONSTRUCT_SIMD)
+ {
+ error_at (loc,
+ "the %<simd%> selector is not permitted in a "
+ "%<begin declare variant%> context selector");
+ return error_mark_node;
+ }
+
/* Reject expressions that reference parameter variables in
"declare variant", as this is not yet implemented. FIXME;
see PR middle-end/113904. */
- if (!metadirective_p
+ if (directive != OMP_CTX_METADIRECTIVE
&& (ts_code == OMP_TRAIT_DEVICE_NUM
|| ts_code == OMP_TRAIT_USER_CONDITION))
{
extern poly_uint64 omp_max_vf (bool);
extern int omp_max_simt_vf (void);
extern const char *omp_context_name_list_prop (tree);
+enum omp_ctx_directive
+ { OMP_CTX_DECLARE_VARIANT,
+ OMP_CTX_BEGIN_DECLARE_VARIANT,
+ OMP_CTX_METADIRECTIVE };
extern tree omp_check_context_selector (location_t loc, tree ctx,
- bool metadirective_p);
+ enum omp_ctx_directive directive);
extern void omp_mark_declare_variant (location_t loc, tree variant,
tree construct);
extern int omp_context_selector_matches (tree, tree, bool);