From 9a2116f91150cf872e7d4a66036a81ecd2526b48 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Sun, 9 Feb 2025 21:34:35 +0000 Subject: OpenMP: Pass a 3-way flag to omp_check_context_selector instead of a bool. The OpenMP "begin declare variant" directive has slightly different requirements for context selectors than regular "declare variant", so something more than a bool is required to tell the error-checking routine what to check. gcc/ChangeLog * omp-general.cc (omp_check_context_selector): Change metadirective_p argument to a 3-way flag. Add extra check for OMP_CTX_BEGIN_DECLARE_VARIANT. * omp-general.h (enum omp_ctx_directive): New. (omp_check_context_selector): Adjust declaration. gcc/c/ChangeLog * c-parser.cc (c_finish_omp_declare_variant): Update call to omp_check_context_selector. (c_parser_omp_metadirective): Likewise. gcc/cp/ChangeLog * parser.cc (cp_finish_omp_declare_variant): Update call to omp_check_context_selector. (cp_parser_omp_metadirective): Likewise. gcc/fortran/ChangeLog * trans-openmp.cc (gfc_trans_omp_declare_variant): Update call to omp_check_context_selector. (gfc_trans_omp_metadirective): Likewise. --- gcc/c/c-parser.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 106a5b4..62c6bc0 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -26982,7 +26982,8 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) 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) @@ -29099,7 +29100,8 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p) 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; -- cgit v1.1