aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/Make-lang.in6
-rw-r--r--gcc/cp/constexpr.cc5
-rw-r--r--gcc/cp/contracts.h15
4 files changed, 33 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 98b48ff..ab3878b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+2025-10-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * constexpr.cc (cxx_eval_constant_expression): Use revised
+ interfaces to determine if contracts are ignored and, if not,
+ whether they are evaluated.
+ * contracts.h (contract_ignored_p, contract_evaluated_p): New.
+
+2025-10-01 Jan Hubicka <hubicka@ucw.cz>
+
+ * Make-lang.in: Add c++_FDAS
+ (create_fdas_for_cc1plus): Be sure that build fails if create_gcov fails.
+
2025-09-27 Jason Merrill <jason@redhat.com>
PR c++/112632
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index dae3c68..70cfe2b 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -123,6 +123,8 @@ CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS)
c++_OBJS = $(CXX_OBJS) cc1plus-checksum.o cp/g++spec.o
+c++_FDAS = cc1plus.fda
+
# Use strict warnings for this front end.
cp-warn = $(STRICT_WARN)
@@ -199,7 +201,7 @@ create_fdas_for_cc1plus: ../stage1-gcc/cc1plus$(exeext) ../prev-gcc/$(PERF_DATA)
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1plus_$$component_in_prev.fda; \
- $(CREATE_GCOV) -binary ../stage1-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2; \
+ $(CREATE_GCOV) -binary ../stage1-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
fi; \
done;
@@ -209,7 +211,7 @@ create_fdas_for_cc1plus: ../stage1-gcc/cc1plus$(exeext) ../prev-gcc/$(PERF_DATA)
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1plus_$$component_in_prev_target.fda; \
- $(CREATE_GCOV) -binary ../prev-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2; \
+ $(CREATE_GCOV) -binary ../prev-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
fi; \
done;
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 6ebe6eb..558ef6e 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -10162,14 +10162,13 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case PRECONDITION_STMT:
case POSTCONDITION_STMT:
{
- contract_semantic semantic = get_contract_semantic (t);
- if (semantic == CCS_IGNORE)
+ if (contract_ignored_p (t))
break;
if (!cxx_eval_assert (ctx, CONTRACT_CONDITION (t),
G_("contract predicate is false in "
"constant expression"),
- EXPR_LOCATION (t), checked_contract_p (semantic),
+ EXPR_LOCATION (t), contract_evaluated_p (t),
non_constant_p, overflow_p))
*non_constant_p = true;
r = void_node;
diff --git a/gcc/cp/contracts.h b/gcc/cp/contracts.h
index ead07d1..54eacd9 100644
--- a/gcc/cp/contracts.h
+++ b/gcc/cp/contracts.h
@@ -334,4 +334,19 @@ set_contract_semantic (tree t, contract_semantic semantic)
}
+/* Will this contract be ignored. */
+
+inline bool
+contract_ignored_p (const_tree contract)
+{
+ return (get_contract_semantic (contract) <= CCS_IGNORE);
+}
+
+/* Will this contract be evaluated? */
+
+inline bool
+contract_evaluated_p (const_tree contract)
+{
+ return (get_contract_semantic (contract) >= CCS_NEVER);
+}
#endif /* ! GCC_CP_CONTRACT_H */