From 64d6d39969e4621e0b88f695e9b2fc6486d13e8f Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 5 Aug 2016 18:27:46 +0000 Subject: [PATCH] constexpr.c (cxx_eval_store_expression): Remove hyphen from the spelling of "constant-expression" in diagnostic messages... gcc/cp/ChangeLog: * constexpr.c (cxx_eval_store_expression): Remove hyphen from the spelling of "constant-expression" in diagnostic messages for consistency. (cxx_eval_constant_expression): Same. (cxx_eval_outermost_constant_expr): Same. (potential_constant_expression_1): Same. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-cast.C: Avoid assuming (void*)1 is spelled 1ul in diagnostics. Remove hyphen from "constant-expression." * g++.dg/cpp0x/constexpr-50060.C: Adjust. * g++.dg/cpp0x/static_assert3.C: Same. * g++.dg/cpp1y/constexpr-throw.C: Same. * g++.dg/template/nontype3.C: Same. * g++.dg/warn/overflow-warn-1.C: Same. * g++.dg/warn/overflow-warn-3.C: Same. * g++.dg/warn/overflow-warn-4.C: Same. From-SVN: r239176 --- gcc/cp/ChangeLog | 9 ++++++++ gcc/cp/constexpr.c | 22 ++++++++++---------- gcc/testsuite/ChangeLog | 12 +++++++++++ gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C | 2 +- gcc/testsuite/g++.dg/cpp0x/static_assert3.C | 2 +- gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C | 8 +++---- gcc/testsuite/g++.dg/template/nontype3.C | 4 ++-- gcc/testsuite/g++.dg/warn/overflow-warn-1.C | 2 +- gcc/testsuite/g++.dg/warn/overflow-warn-3.C | 4 ++-- gcc/testsuite/g++.dg/warn/overflow-warn-4.C | 4 ++-- 11 files changed, 46 insertions(+), 25 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ddafa93cae5..b2307e928f3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2016-08-05 Martin Sebor + + * constexpr.c (cxx_eval_store_expression): Remove hyphen from + the spelling of "constant-expression" in diagnostic messages + for consistency. + (cxx_eval_constant_expression): Same. + (cxx_eval_outermost_constant_expr): Same. + (potential_constant_expression_1): Same. + 2016-08-05 Nathan Sidwell PR c++/68724 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 41665c5a36e..e7b08c8a9be 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3171,7 +3171,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, /* A constant-expression cannot modify objects from outside the constant-expression. */ if (!ctx->quiet) - error ("modification of %qE is not a constant-expression", object); + error ("modification of %qE is not a constant expression", object); *non_constant_p = true; return t; } @@ -4098,7 +4098,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, { if (!ctx->quiet) error_at (EXPR_LOC_OR_LOC (t, input_location), - "a reinterpret_cast is not a constant-expression"); + "a reinterpret_cast is not a constant expression"); *non_constant_p = true; return t; } @@ -4140,7 +4140,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, if (!ctx->quiet) error_at (EXPR_LOC_OR_LOC (t, input_location), "%(%E)%> is not " - "a constant-expression", + "a constant expression", type, op); *non_constant_p = true; return t; @@ -4202,7 +4202,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, case OFFSET_REF: if (!ctx->quiet) error_at (EXPR_LOC_OR_LOC (t, input_location), - "expression %qE is not a constant-expression", t); + "expression %qE is not a constant expression", t); *non_constant_p = true; break; @@ -4283,7 +4283,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, so for now just fail. */ if (!ctx->quiet) error_at (EXPR_LOCATION (t), - "statement is not a constant-expression"); + "statement is not a constant expression"); } else internal_error ("unexpected expression %qE of kind %s", t, @@ -4370,7 +4370,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant, { if (!allow_non_constant) error ("conversion from pointer type %qT " - "to arithmetic type %qT in a constant-expression", + "to arithmetic type %qT in a constant expression", TREE_TYPE (TREE_OPERAND (r, 0)), TREE_TYPE (r)); non_constant_p = true; } @@ -5068,7 +5068,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, case AT_ENCODE_EXPR: fail: if (flags & tf_error) - error ("expression %qE is not a constant-expression", t); + error ("expression %qE is not a constant expression", t); return false; case TYPEID_EXPR: @@ -5229,7 +5229,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, if (integer_zerop (denom)) { if (flags & tf_error) - error ("division by zero is not a constant-expression"); + error ("division by zero is not a constant expression"); return false; } else @@ -5334,7 +5334,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, { if (flags & tf_error) error_at (location_of (t), - "% is not a constant-expression"); + "% is not a constant expression"); return false; } /* Fall through. */ @@ -5357,7 +5357,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, want_rval, strict, tf_none)) return true; if (flags & tf_error) - error ("expression %qE is not a constant-expression", t); + error ("expression %qE is not a constant expression", t); return false; case VEC_INIT_EXPR: @@ -5385,7 +5385,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, if (breaks (target) || continues (target)) return true; if (flags & tf_error) - error ("% is not a constant-expression"); + error ("% is not a constant expression"); return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 997efac8af0..3c1fbf012cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2016-08-05 Martin Sebor + + * g++.dg/cpp0x/constexpr-cast.C: Avoid assuming (void*)1 is spelled + 1ul in diagnostics. Remove hyphen from "constant-expression." + * g++.dg/cpp0x/constexpr-50060.C: Adjust. + * g++.dg/cpp0x/static_assert3.C: Same. + * g++.dg/cpp1y/constexpr-throw.C: Same. + * g++.dg/template/nontype3.C: Same. + * g++.dg/warn/overflow-warn-1.C: Same. + * g++.dg/warn/overflow-warn-3.C: Same. + * g++.dg/warn/overflow-warn-4.C: Same. + 2016-08-05 David Malcolm * gcc.dg/plugin/diagnostic-test-string-literals-1.c: New file. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C index ee1c221b6a6..d2df08e7ca9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C @@ -12,7 +12,7 @@ struct S struct T { - constexpr T (double a) : y {}, x ((y = 1, 0.8125)) {} // { dg-error "is not a constant-expression" "T" { target { ! c++14 } } } + constexpr T (double a) : y {}, x ((y = 1, 0.8125)) {} // { dg-error "is not a constant expression" "T" { target { ! c++14 } } } double x; int y; }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C index 8e11193be53..bab6ec3ee45 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C @@ -8,7 +8,7 @@ int i; constexpr void *q = reinterpret_cast(&i); // { dg-error "" "bug c++/49171" { xfail *-*-*-* } } constexpr void *r0 = reinterpret_cast(1); // { dg-error "not a constant expression" } -constexpr void *r1 = reinterpret_cast(sizeof 'x'); // { dg-error ".reinterpret_cast\\(1ul\\). is not a constant-expression" } +constexpr void *r1 = reinterpret_cast(sizeof 'x'); // { dg-error ".reinterpret_cast\\(1\[ul\]\*\\). is not a constant expression" } template constexpr bool f () diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert3.C b/gcc/testsuite/g++.dg/cpp0x/static_assert3.C index addde13c114..91ed9ca990b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert3.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert3.C @@ -1,4 +1,4 @@ // { dg-do compile { target c++11 } } static_assert(7 / 0, "X"); // { dg-error "non-constant condition" "non-constant" } // { dg-warning "division by zero" "zero" { target *-*-* } 2 } -// { dg-error "division by zero is not a constant-expression" "not a constant" { target *-*-* } 2 } +// { dg-error "division by zero is not a constant expression" "not a constant" { target *-*-* } 2 } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C index ac90051d5e9..eed07205efb 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C @@ -8,25 +8,25 @@ constexpr void f1() { constexpr void f2() { if (true) throw; -} // { dg-error "not a constant-expression" } +} // { dg-error "not a constant expression" } constexpr void f3() { if (false) ; else throw; -}// { dg-error "not a constant-expression" } +}// { dg-error "not a constant expression" } constexpr void f4() { throw; -}// { dg-error "not a constant-expression" } +}// { dg-error "not a constant expression" } constexpr int fun(int n) { switch (n) { case 0: return 1; default: - throw; // { dg-error "not a constant-expression" } + throw; // { dg-error "not a constant expression" } } } diff --git a/gcc/testsuite/g++.dg/template/nontype3.C b/gcc/testsuite/g++.dg/template/nontype3.C index d0c6b72a1d3..1899ed05cb5 100644 --- a/gcc/testsuite/g++.dg/template/nontype3.C +++ b/gcc/testsuite/g++.dg/template/nontype3.C @@ -31,8 +31,8 @@ template void dep10(foo< PI[0] > *); // { dg-error "" "integral or enumeration" } template -void dep11(foo< *&I > *); // { dg-error "" "constant-expression" } +void dep11(foo< *&I > *); // { dg-error "" "constant expression" } template -void dep12(foo< (&I)[4] > *); // { dg-error "" "constant-expression" } +void dep12(foo< (&I)[4] > *); // { dg-error "" "constant expression" } diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C index a10e15b9811..995e7dfd65d 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C @@ -130,7 +130,7 @@ h2i (int x) /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */ /* { dg-warning "invalid conversion from" "convert" { target *-*-* } 56 } */ /* { dg-warning "invalid conversion from" "convert" { target c++11 } 58 } */ +/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 65 } */ /* { dg-error "is not a constant expression" "const" { target *-*-* } 65 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 65 } */ /* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */ /* { dg-error "is not a constant expression" "division" { target c++ } 32 } */ diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C index c73a28c3277..62879590d04 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C @@ -65,7 +65,7 @@ g (int i) switch (i) { case 0 * (1/0): /* { dg-warning "division by zero" } */ - ; /* { dg-error "is not a constant expression" "const" { target *-*-* } 67 } */ + ; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 67 } */ case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 69 } */ ; @@ -131,6 +131,6 @@ h2i (int x) /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */ /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */ /* { dg-warning "invalid conversion from" "convert" { target c++11 } 60 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 67 } */ +/* { dg-error "not a constant expression" "constant" { target *-*-*-* } 67 } */ /* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */ /* { dg-error "is not a constant expression" "division" { target c++ } 32 } */ diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C index 23a2585e532..35f20b84b99 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C @@ -68,7 +68,7 @@ g (int i) switch (i) { case 0 * (1/0): /* { dg-warning "division by zero" } */ - ; /* { dg-error "is not a constant expression" "const" { target *-*-* } 70 } */ + ; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 70 } */ case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 72 } */ ; @@ -134,6 +134,6 @@ h2i (int x) /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */ /* { dg-error "invalid conversion from" "convert" { target c++11 } 63 } */ /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 34 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 70 } */ +/* { dg-error "is not a constant expression" "const" { target *-*-*-* } 70 } */ /* { dg-error "width not an integer constant" "bit.field" { target c++ } 34 } */ /* { dg-error "is not a constant expression" "division" { target c++ } 34 } */ -- 2.30.2