diff options
author | Sandra Loosemore <sloosemore@baylibre.com> | 2025-06-02 03:26:42 +0000 |
---|---|---|
committer | Sandra Loosemore <sloosemore@baylibre.com> | 2025-06-05 15:02:15 +0000 |
commit | 98f8571728647a8f650c85f7b5d3d31666ef902a (patch) | |
tree | 3469f1508805403933ba38447fb349eee2822861 /gcc/dwarf2ctf.cc | |
parent | de723918517e92278be34960fb9ef9bc3f65fda1 (diff) | |
download | gcc-98f8571728647a8f650c85f7b5d3d31666ef902a.zip gcc-98f8571728647a8f650c85f7b5d3d31666ef902a.tar.gz gcc-98f8571728647a8f650c85f7b5d3d31666ef902a.tar.bz2 |
OpenMP: Handle more cases in user/condition selector
Tobias had noted that the C front end was not treating C23 constexprs
as constant in the user/condition selector property, which led to
missed opportunities to resolve metadirectives at parse time.
Additionally neither C nor C++ was permitting the expression to have
pointer or floating-point type -- the former being a common idiom in
other C/C++ conditional expressions. By using the existing front-end
hooks for the implicit conversion to bool in conditional expressions,
we also get free support for using a C++ class object that has a bool
conversion operator in the user/condition selector.
gcc/c/ChangeLog
* c-parser.cc (c_parser_omp_context_selector): Call
convert_lvalue_to_rvalue and c_objc_common_truthvalue_conversion
on the expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.
gcc/cp/ChangeLog
* cp-tree.h (maybe_convert_cond): Declare.
* parser.cc (cp_parser_omp_context_selector): Call
maybe_convert_cond and fold_build_cleanup_point_expr on the
expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.
* pt.cc (tsubst_omp_context_selector): Likewise.
* semantics.cc (maybe_convert_cond): Remove static declaration.
gcc/testsuite/ChangeLog
* c-c++-common/gomp/declare-variant-2.c: Update expected output.
* c-c++-common/gomp/metadirective-condition-constexpr.c: New.
* c-c++-common/gomp/metadirective-condition.c: New.
* c-c++-common/gomp/metadirective-error-recovery.c: Update expected
output.
* g++.dg/gomp/metadirective-condition-class.C: New.
* g++.dg/gomp/metadirective-condition-template.C: New.
(cherry picked from commit 08c299a410b9314957e48a87f5bf50a4c034b744)
Diffstat (limited to 'gcc/dwarf2ctf.cc')
0 files changed, 0 insertions, 0 deletions