From 8cb6a77590957942e124b34e0bb0827d1404f341 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 9 Oct 2019 17:17:19 +0000 Subject: [PATCH] decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION. /cp 2019-10-09 Paolo Carlini * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION. * typeck.c (cp_build_binary_op): Use the op_location_t argument in many error messages. /testsuite 2019-10-09 Paolo Carlini * c-c++-common/Waddress-1.c: Test locations too. * c-c++-common/Wpointer-compare-1.c: Likewise. * c-c++-common/Wshift-count-negative-1.c: Likewise. * c-c++-common/Wshift-count-overflow-1.c: Likewise. * c-c++-common/Wshift-negative-value-1.c: Likewise. * c-c++-common/Wshift-negative-value-2.c: Likewise. * c-c++-common/Wshift-negative-value-5.c: Likewise. * c-c++-common/pr48418.c: Likewise. * c-c++-common/pr65830.c: Likewise. * c-c++-common/pr69764.c: Likewise. * g++.dg/cpp0x/constexpr-array-ptr10.C: Likewise. * g++.dg/cpp0x/nullptr37.C: Likewise. * g++.dg/template/crash126.C: Likewise. * g++.dg/template/crash129.C: Likewise. * g++.dg/warn/Wextra-3.C: Likewise. * g++.dg/warn/Wfloat-equal-1.C: Likewise. * g++.dg/warn/Wstring-literal-comparison-1.C: Likewise. * g++.dg/warn/Wstring-literal-comparison-2.C: Likewise. * g++.dg/warn/pointer-integer-comparison.C: Likewise. * g++.old-deja/g++.jason/crash8.C: Likewise. From-SVN: r276763 --- gcc/cp/ChangeLog | 6 ++ gcc/cp/decl.c | 3 +- gcc/cp/typeck.c | 81 ++++++++++--------- gcc/testsuite/ChangeLog | 23 ++++++ gcc/testsuite/c-c++-common/Waddress-1.c | 8 +- .../c-c++-common/Wpointer-compare-1.c | 40 ++++----- .../c-c++-common/Wshift-count-negative-1.c | 4 +- .../c-c++-common/Wshift-count-overflow-1.c | 4 +- .../c-c++-common/Wshift-negative-value-1.c | 6 +- .../c-c++-common/Wshift-negative-value-2.c | 6 +- .../c-c++-common/Wshift-negative-value-5.c | 6 +- gcc/testsuite/c-c++-common/pr48418.c | 16 ++-- gcc/testsuite/c-c++-common/pr65830.c | 8 +- gcc/testsuite/c-c++-common/pr69764.c | 12 +-- .../g++.dg/cpp0x/constexpr-array-ptr10.C | 16 ++-- gcc/testsuite/g++.dg/cpp0x/nullptr37.C | 72 ++++++++--------- gcc/testsuite/g++.dg/template/crash126.C | 2 +- gcc/testsuite/g++.dg/template/crash129.C | 2 +- gcc/testsuite/g++.dg/warn/Wextra-3.C | 8 +- gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C | 8 +- .../warn/Wstring-literal-comparison-1.C | 2 +- .../warn/Wstring-literal-comparison-2.C | 2 +- .../g++.dg/warn/pointer-integer-comparison.C | 12 +-- gcc/testsuite/g++.old-deja/g++.jason/crash8.C | 2 +- 24 files changed, 194 insertions(+), 155 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0e8d9301bfd..d75ea5dc443 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-10-09 Paolo Carlini + + * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION. + * typeck.c (cp_build_binary_op): Use the op_location_t argument + in many error messages. + 2019-10-08 Martin Sebor PR c++/92001 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e4053679362..72c02afa105 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13738,7 +13738,8 @@ grok_ctor_properties (const_tree ctype, const_tree decl) or implicitly defined), there's no need to worry about their existence. Theoretically, they should never even be instantiated, but that's hard to forestall. */ - error ("invalid constructor; you probably meant %<%T (const %T&)%>", + error_at (DECL_SOURCE_LOCATION (decl), + "invalid constructor; you probably meant %<%T (const %T&)%>", ctype, ctype); return false; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d549450a605..1d9e9b8d05d 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4475,7 +4475,8 @@ cp_build_binary_op (const op_location_t &location, if (t != error_mark_node) { if (complain & tf_error) - permerror (input_location, "assuming cast to type %qT from overloaded function", + permerror (location, + "assuming cast to type %qT from overloaded function", TREE_TYPE (t)); op0 = t; } @@ -4486,7 +4487,8 @@ cp_build_binary_op (const op_location_t &location, if (t != error_mark_node) { if (complain & tf_error) - permerror (input_location, "assuming cast to type %qT from overloaded function", + permerror (location, + "assuming cast to type %qT from overloaded function", TREE_TYPE (t)); op1 = t; } @@ -4809,16 +4811,16 @@ cp_build_binary_op (const op_location_t &location, { if ((complain & tf_warning) && c_inhibit_evaluation_warnings == 0) - warning (OPT_Wshift_count_negative, - "right shift count is negative"); + warning_at (location, OPT_Wshift_count_negative, + "right shift count is negative"); } else { if (compare_tree_int (const_op1, TYPE_PRECISION (type0)) >= 0 && (complain & tf_warning) && c_inhibit_evaluation_warnings == 0) - warning (OPT_Wshift_count_overflow, - "right shift count >= width of type"); + warning_at (location, OPT_Wshift_count_overflow, + "right shift count >= width of type"); } } /* Avoid converting op1 to result_type later. */ @@ -4856,24 +4858,24 @@ cp_build_binary_op (const op_location_t &location, && tree_int_cst_sgn (const_op0) < 0 && (complain & tf_warning) && c_inhibit_evaluation_warnings == 0) - warning (OPT_Wshift_negative_value, - "left shift of negative value"); + warning_at (location, OPT_Wshift_negative_value, + "left shift of negative value"); if (TREE_CODE (const_op1) == INTEGER_CST) { if (tree_int_cst_lt (const_op1, integer_zero_node)) { if ((complain & tf_warning) && c_inhibit_evaluation_warnings == 0) - warning (OPT_Wshift_count_negative, - "left shift count is negative"); + warning_at (location, OPT_Wshift_count_negative, + "left shift count is negative"); } else if (compare_tree_int (const_op1, TYPE_PRECISION (type0)) >= 0) { if ((complain & tf_warning) && c_inhibit_evaluation_warnings == 0) - warning (OPT_Wshift_count_overflow, - "left shift count >= width of type"); + warning_at (location, OPT_Wshift_count_overflow, + "left shift count >= width of type"); } else if (TREE_CODE (const_op0) == INTEGER_CST && (complain & tf_warning)) @@ -4920,8 +4922,9 @@ cp_build_binary_op (const op_location_t &location, if ((complain & tf_warning) && c_inhibit_evaluation_warnings == 0 && (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))) - warning (OPT_Wfloat_equal, - "comparing floating-point with %<==%> or % is unsafe"); + warning_at (location, OPT_Wfloat_equal, + "comparing floating-point with %<==%> " + "or % is unsafe"); if (complain & tf_warning) { tree stripped_orig_op0 = tree_strip_any_location_wrapper (orig_op0); @@ -4930,8 +4933,9 @@ cp_build_binary_op (const op_location_t &location, && !integer_zerop (cp_fully_fold (op1))) || (TREE_CODE (stripped_orig_op1) == STRING_CST && !integer_zerop (cp_fully_fold (op0)))) - warning (OPT_Waddress, "comparison with string literal results " - "in unspecified behavior"); + warning_at (location, OPT_Waddress, + "comparison with string literal results in " + "unspecified behavior"); } build_type = boolean_type_node; @@ -4955,11 +4959,11 @@ cp_build_binary_op (const op_location_t &location, if (char_type_p (TREE_TYPE (orig_op1))) { auto_diagnostic_group d; - if (warning (OPT_Wpointer_compare, - "comparison between pointer and zero character " - "constant")) - inform (input_location, - "did you mean to dereference the pointer?"); + if (warning_at (location, OPT_Wpointer_compare, + "comparison between pointer and zero character " + "constant")) + inform (location, + "did you mean to dereference the pointer?"); } warn_for_null_address (location, op0, complain); } @@ -4978,10 +4982,10 @@ cp_build_binary_op (const op_location_t &location, if (char_type_p (TREE_TYPE (orig_op0))) { auto_diagnostic_group d; - if (warning (OPT_Wpointer_compare, + if (warning_at (location, OPT_Wpointer_compare, "comparison between pointer and zero character " "constant")) - inform (input_location, + inform (location, "did you mean to dereference the pointer?"); } warn_for_null_address (location, op1, complain); @@ -4996,8 +5000,9 @@ cp_build_binary_op (const op_location_t &location, else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) { result_type = type0; - if (complain & tf_error) - permerror (input_location, "ISO C++ forbids comparison between pointer and integer"); + if (complain & tf_error) + permerror (location, "ISO C++ forbids comparison between " + "pointer and integer"); else return error_mark_node; } @@ -5005,7 +5010,8 @@ cp_build_binary_op (const op_location_t &location, { result_type = type1; if (complain & tf_error) - permerror (input_location, "ISO C++ forbids comparison between pointer and integer"); + permerror (location, "ISO C++ forbids comparison between " + "pointer and integer"); else return error_mark_node; } @@ -5191,8 +5197,9 @@ cp_build_binary_op (const op_location_t &location, || TREE_CODE (orig_op1) == STRING_CST) { if (complain & tf_warning) - warning (OPT_Waddress, "comparison with string literal results " - "in unspecified behavior"); + warning_at (location, OPT_Waddress, + "comparison with string literal results " + "in unspecified behavior"); } if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE) @@ -5267,15 +5274,15 @@ cp_build_binary_op (const op_location_t &location, { result_type = type0; if (extra_warnings && (complain & tf_warning)) - warning (OPT_Wextra, - "ordered comparison of pointer with integer zero"); + warning_at (location, OPT_Wextra, + "ordered comparison of pointer with integer zero"); } else if (code1 == POINTER_TYPE && null_ptr_cst_p (orig_op0)) { result_type = type1; if (extra_warnings && (complain & tf_warning)) - warning (OPT_Wextra, - "ordered comparison of pointer with integer zero"); + warning_at (location, OPT_Wextra, + "ordered comparison of pointer with integer zero"); } else if (null_ptr_cst_p (orig_op0) && null_ptr_cst_p (orig_op1)) /* One of the operands must be of nullptr_t type. */ @@ -5284,16 +5291,18 @@ cp_build_binary_op (const op_location_t &location, { result_type = type0; if (complain & tf_error) - permerror (input_location, "ISO C++ forbids comparison between pointer and integer"); - else + permerror (location, "ISO C++ forbids comparison between " + "pointer and integer"); + else return error_mark_node; } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) { result_type = type1; if (complain & tf_error) - permerror (input_location, "ISO C++ forbids comparison between pointer and integer"); - else + permerror (location, "ISO C++ forbids comparison between " + "pointer and integer"); + else return error_mark_node; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c7dfe71a47..26a3fcce243 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,26 @@ +2019-10-09 Paolo Carlini + + * c-c++-common/Waddress-1.c: Test locations too. + * c-c++-common/Wpointer-compare-1.c: Likewise. + * c-c++-common/Wshift-count-negative-1.c: Likewise. + * c-c++-common/Wshift-count-overflow-1.c: Likewise. + * c-c++-common/Wshift-negative-value-1.c: Likewise. + * c-c++-common/Wshift-negative-value-2.c: Likewise. + * c-c++-common/Wshift-negative-value-5.c: Likewise. + * c-c++-common/pr48418.c: Likewise. + * c-c++-common/pr65830.c: Likewise. + * c-c++-common/pr69764.c: Likewise. + * g++.dg/cpp0x/constexpr-array-ptr10.C: Likewise. + * g++.dg/cpp0x/nullptr37.C: Likewise. + * g++.dg/template/crash126.C: Likewise. + * g++.dg/template/crash129.C: Likewise. + * g++.dg/warn/Wextra-3.C: Likewise. + * g++.dg/warn/Wfloat-equal-1.C: Likewise. + * g++.dg/warn/Wstring-literal-comparison-1.C: Likewise. + * g++.dg/warn/Wstring-literal-comparison-2.C: Likewise. + * g++.dg/warn/pointer-integer-comparison.C: Likewise. + * g++.old-deja/g++.jason/crash8.C: Likewise. + 2019-10-09 Richard Biener * gcc.dg/vect/vect-outer-call-1.c: New testcase. diff --git a/gcc/testsuite/c-c++-common/Waddress-1.c b/gcc/testsuite/c-c++-common/Waddress-1.c index 8df5d2f6fec..9790a319881 100644 --- a/gcc/testsuite/c-c++-common/Waddress-1.c +++ b/gcc/testsuite/c-c++-common/Waddress-1.c @@ -8,8 +8,8 @@ int foo () { return "foo1" != (void *) 0 /* { dg-bogus "comparison with string literal results in unspecified behavior" } */ - && "foo2" != (const char *) ((void *) 0) /* { dg-bogus "comparison with string literal results in unspecified behavior" } */ - && "foo3" != (const char *) ((void *) (10 - 10)) /* { dg-bogus "comparison with string literal results in unspecified behavior" } */ - && "foo4" != (const char *) ((void *) (&e - &e)) /* { dg-warning "comparison with string literal results in unspecified behavior" "" { target c } } */ - && "foo5" != "foo6"; /* { dg-warning "comparison with string literal results in unspecified behavior" } */ + && "foo2" != (const char *) ((void *) 0) /* { dg-bogus "comparison with string literal results in unspecified behavior" } */ + && "foo3" != (const char *) ((void *) (10 - 10)) /* { dg-bogus "comparison with string literal results in unspecified behavior" } */ + && "foo4" != (const char *) ((void *) (&e - &e)) /* { dg-warning "15:comparison with string literal results in unspecified behavior" "" { target c } } */ + && "foo5" != "foo6"; /* { dg-warning "15:comparison with string literal results in unspecified behavior" } */ } diff --git a/gcc/testsuite/c-c++-common/Wpointer-compare-1.c b/gcc/testsuite/c-c++-common/Wpointer-compare-1.c index 440341ed9ed..808a0fd51a7 100644 --- a/gcc/testsuite/c-c++-common/Wpointer-compare-1.c +++ b/gcc/testsuite/c-c++-common/Wpointer-compare-1.c @@ -8,25 +8,25 @@ f1 (int *p, int **q) { int r = 0; - r += p == '\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += p == L'\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += p != '\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += p != L'\0'; /* { dg-warning "comparison between pointer and zero character" } */ + r += p == '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += p == L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += p != '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += p != L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ - r += '\0' == p; /* { dg-warning "comparison between pointer and zero character" } */ - r += L'\0' == p; /* { dg-warning "comparison between pointer and zero character" } */ - r += '\0' != p; /* { dg-warning "comparison between pointer and zero character" } */ - r += L'\0' != p; /* { dg-warning "comparison between pointer and zero character" } */ + r += '\0' == p; /* { dg-warning "13:comparison between pointer and zero character" } */ + r += L'\0' == p; /* { dg-warning "14:comparison between pointer and zero character" } */ + r += '\0' != p; /* { dg-warning "13:comparison between pointer and zero character" } */ + r += L'\0' != p; /* { dg-warning "14:comparison between pointer and zero character" } */ - r += q == '\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += q == L'\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += q != '\0'; /* { dg-warning "comparison between pointer and zero character" } */ - r += q != L'\0'; /* { dg-warning "comparison between pointer and zero character" } */ + r += q == '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += q == L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += q != '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += q != L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */ - r += '\0' == q; /* { dg-warning "comparison between pointer and zero character" } */ - r += L'\0' == q; /* { dg-warning "comparison between pointer and zero character" } */ - r += '\0' != q; /* { dg-warning "comparison between pointer and zero character" } */ - r += L'\0' != q; /* { dg-warning "comparison between pointer and zero character" } */ + r += '\0' == q; /* { dg-warning "13:comparison between pointer and zero character" } */ + r += L'\0' == q; /* { dg-warning "14:comparison between pointer and zero character" } */ + r += '\0' != q; /* { dg-warning "13:comparison between pointer and zero character" } */ + r += L'\0' != q; /* { dg-warning "14:comparison between pointer and zero character" } */ return r; } @@ -55,11 +55,11 @@ f3 (int *p) { int r = 0; - r += p == (char) 0; /* { dg-warning "comparison between pointer and zero character" } */ - r += p != (char) 0; /* { dg-warning "comparison between pointer and zero character" } */ + r += p == (char) 0; /* { dg-warning "10:comparison between pointer and zero character" } */ + r += p != (char) 0; /* { dg-warning "10:comparison between pointer and zero character" } */ - r += (char) 0 == p; /* { dg-warning "comparison between pointer and zero character" } */ - r += (char) 0 != p; /* { dg-warning "comparison between pointer and zero character" } */ + r += (char) 0 == p; /* { dg-warning "17:comparison between pointer and zero character" } */ + r += (char) 0 != p; /* { dg-warning "17:comparison between pointer and zero character" } */ return r; } diff --git a/gcc/testsuite/c-c++-common/Wshift-count-negative-1.c b/gcc/testsuite/c-c++-common/Wshift-count-negative-1.c index d8833936a2b..6807b985339 100644 --- a/gcc/testsuite/c-c++-common/Wshift-count-negative-1.c +++ b/gcc/testsuite/c-c++-common/Wshift-count-negative-1.c @@ -3,6 +3,6 @@ void foo() { - unsigned i1 = 1U << -1; /* { dg-warning "left shift count is negative" } */ - unsigned i2 = 1U >> -1; /* { dg-warning "right shift count is negative" } */ + unsigned i1 = 1U << -1; /* { dg-warning "20:left shift count is negative" } */ + unsigned i2 = 1U >> -1; /* { dg-warning "20:right shift count is negative" } */ } diff --git a/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c b/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c index 4d29d578625..47225e4aacb 100644 --- a/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c +++ b/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c @@ -3,6 +3,6 @@ void foo() { - unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */ - unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */ + unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:left shift count >= width of type" } */ + unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:right shift count >= width of type" } */ } diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c index 7df1804615d..d58d8b9b002 100644 --- a/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c +++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c @@ -6,7 +6,7 @@ enum E { A = 0 << 1, B = 1 << 1, - C = -1 << 1, /* { dg-warning "left shift of negative value|not an integer constant" } */ + C = -1 << 1, /* { dg-warning "10:left shift of negative value|not an integer constant" } */ /* { dg-error "left operand of shift expression" "shift" { target c++ } .-1 } */ D = 0 >> 1, E = 1 >> 1, @@ -23,10 +23,10 @@ left (int x) int r = 0; r += z << x; r += o << x; - r += m << x; /* { dg-warning "left shift of negative value" } */ + r += m << x; /* { dg-warning "10:left shift of negative value" } */ r += 0 << x; r += 1 << x; - r += -1 << x; /* { dg-warning "left shift of negative value" } */ + r += -1 << x; /* { dg-warning "11:left shift of negative value" } */ r += -1U << x; return r; } diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c index 3a60ed7e1b8..9f435e8958d 100644 --- a/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c +++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c @@ -6,7 +6,7 @@ enum E { A = 0 << 1, B = 1 << 1, - C = -1 << 1, /* { dg-warning "left shift of negative value" } */ + C = -1 << 1, /* { dg-warning "10:left shift of negative value" } */ /* { dg-error "not an integer constant" "no constant" { target c++ } .-1 } */ /* { dg-error "left operand of shift expression" "shift" { target c++ } .-2 } */ D = 0 >> 1, @@ -24,10 +24,10 @@ left (int x) int r = 0; r += z << x; r += o << x; - r += m << x; /* { dg-warning "left shift of negative value" } */ + r += m << x; /* { dg-warning "10:left shift of negative value" } */ r += 0 << x; r += 1 << x; - r += -1 << x; /* { dg-warning "left shift of negative value" } */ + r += -1 << x; /* { dg-warning "11:left shift of negative value" } */ r += -1U << x; return r; } diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-5.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-5.c index 74ecd1e2867..3c3e74cf89a 100644 --- a/gcc/testsuite/c-c++-common/Wshift-negative-value-5.c +++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-5.c @@ -7,7 +7,7 @@ enum E { A = 0 << 1, B = 1 << 1, - C = -1 << 1, /* { dg-warning "left shift of negative value" } */ + C = -1 << 1, /* { dg-warning "10:left shift of negative value" } */ D = 0 >> 1, E = 1 >> 1, F = -1 >> 1 @@ -23,10 +23,10 @@ left (int x) int r = 0; r += z << x; r += o << x; - r += m << x; /* { dg-warning "left shift of negative value" } */ + r += m << x; /* { dg-warning "10:left shift of negative value" } */ r += 0 << x; r += 1 << x; - r += -1 << x; /* { dg-warning "left shift of negative value" } */ + r += -1 << x; /* { dg-warning "11:left shift of negative value" } */ r += -1U << x; return r; } diff --git a/gcc/testsuite/c-c++-common/pr48418.c b/gcc/testsuite/c-c++-common/pr48418.c index 95ff855b89c..173285449bf 100644 --- a/gcc/testsuite/c-c++-common/pr48418.c +++ b/gcc/testsuite/c-c++-common/pr48418.c @@ -8,13 +8,13 @@ foo (int x) const int a = sizeof (int) * __CHAR_BIT__; const int b = -7; int c = 0; - c += x << a; /* { dg-warning "left shift count >= width of type" } */ - c += x << b; /* { dg-warning "left shift count is negative" } */ - c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */ - c += x << -7; /* { dg-warning "left shift count is negative" } */ - c += x >> a; /* { dg-warning "right shift count >= width of type" } */ - c += x >> b; /* { dg-warning "right shift count is negative" } */ - c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */ - c += x >> -7; /* { dg-warning "right shift count is negative" } */ + c += x << a; /* { dg-warning "10:left shift count >= width of type" } */ + c += x << b; /* { dg-warning "10:left shift count is negative" } */ + c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:left shift count >= width of type" } */ + c += x << -7; /* { dg-warning "10:left shift count is negative" } */ + c += x >> a; /* { dg-warning "10:right shift count >= width of type" } */ + c += x >> b; /* { dg-warning "10:right shift count is negative" } */ + c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:right shift count >= width of type" } */ + c += x >> -7; /* { dg-warning "10:right shift count is negative" } */ return c; } diff --git a/gcc/testsuite/c-c++-common/pr65830.c b/gcc/testsuite/c-c++-common/pr65830.c index e115f181275..73eb97cff9e 100644 --- a/gcc/testsuite/c-c++-common/pr65830.c +++ b/gcc/testsuite/c-c++-common/pr65830.c @@ -8,9 +8,9 @@ foo (int x) const int a = sizeof (int) * __CHAR_BIT__; const int b = -7; int c = 0; - c += x << a; /* { dg-bogus "left shift count >= width of type" } */ - c += x << b; /* { dg-bogus "left shift count is negative" } */ - c += x >> a; /* { dg-bogus "right shift count >= width of type" } */ - c += x >> b; /* { dg-bogus "right shift count is negative" } */ + c += x << a; /* { dg-bogus "10:left shift count >= width of type" } */ + c += x << b; /* { dg-bogus "10:left shift count is negative" } */ + c += x >> a; /* { dg-bogus "10:right shift count >= width of type" } */ + c += x >> b; /* { dg-bogus "10:right shift count is negative" } */ return c; } diff --git a/gcc/testsuite/c-c++-common/pr69764.c b/gcc/testsuite/c-c++-common/pr69764.c index 79623ec7373..146f2585850 100644 --- a/gcc/testsuite/c-c++-common/pr69764.c +++ b/gcc/testsuite/c-c++-common/pr69764.c @@ -4,35 +4,35 @@ unsigned char fn1 (unsigned char a) { - return a >> ~6; /* { dg-warning "right shift count is negative" } */ + return a >> ~6; /* { dg-warning "12:right shift count is negative" } */ } unsigned short fn2 (unsigned short a) { - return a >> ~6; /* { dg-warning "right shift count is negative" } */ + return a >> ~6; /* { dg-warning "12:right shift count is negative" } */ } unsigned int fn3 (unsigned int a) { - return a >> ~6; /* { dg-warning "right shift count is negative" } */ + return a >> ~6; /* { dg-warning "12:right shift count is negative" } */ } unsigned char fn4 (unsigned char a) { - return a >> 0xff03; /* { dg-warning "right shift count >= width of type" } */ + return a >> 0xff03; /* { dg-warning "12:right shift count >= width of type" } */ } unsigned short fn5 (unsigned short a) { - return a >> 0xff03; /* { dg-warning "right shift count >= width of type" } */ + return a >> 0xff03; /* { dg-warning "12:right shift count >= width of type" } */ } unsigned int fn6 (unsigned int a) { - return a >> 0xff03; /* { dg-warning "right shift count >= width of type" } */ + return a >> 0xff03; /* { dg-warning "12:right shift count >= width of type" } */ } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C index 2ff7c4d3920..b1d47cf2cbd 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C @@ -19,18 +19,18 @@ constexpr int *p0 = &i; constexpr bool b0 = p0; // { dg-warning "address of .A::i." } constexpr bool b1 = p0 == 0; // { dg-warning "address of .A::i." } constexpr bool b2 = p0 != 0; // { dg-warning "address of .A::i." } -constexpr bool b3 = p0 < 0; // { dg-warning "ordered comparison" } -constexpr bool b4 = p0 <= 0; // { dg-warning "ordered comparison" } -constexpr bool b5 = p0 > 0; // { dg-warning "ordered comparison" } -constexpr bool b6 = p0 >= 0; // { dg-warning "ordered comparison" } +constexpr bool b3 = p0 < 0; // { dg-warning "25:ordered comparison" } +constexpr bool b4 = p0 <= 0; // { dg-warning "25:ordered comparison" } +constexpr bool b5 = p0 > 0; // { dg-warning "25:ordered comparison" } +constexpr bool b6 = p0 >= 0; // { dg-warning "25:ordered comparison" } constexpr bool b7 = !p0; // { dg-warning "address of .A::i." } constexpr bool b8 = 0 == p0; // { dg-warning "address of .A::i." } constexpr bool b9 = 0 != p0; // { dg-warning "address of .A::i." } -constexpr bool b10 = 0 < p0; // { dg-warning "ordered comparison" } -constexpr bool b11 = 0 <= p0; // { dg-warning "ordered comparison" } -constexpr bool b12 = 0 > p0; // { dg-warning "ordered comparison" } -constexpr bool b13 = 0 >= p0; // { dg-warning "ordered comparison" } +constexpr bool b10 = 0 < p0; // { dg-warning "24:ordered comparison" } +constexpr bool b11 = 0 <= p0; // { dg-warning "24:ordered comparison" } +constexpr bool b12 = 0 > p0; // { dg-warning "24:ordered comparison" } +constexpr bool b13 = 0 >= p0; // { dg-warning "24:ordered comparison" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr37.C b/gcc/testsuite/g++.dg/cpp0x/nullptr37.C index e746a285404..6bcc8e81e20 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nullptr37.C +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr37.C @@ -6,41 +6,41 @@ f1 (int *p, int **q) { int r = 0; - r += p == '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p == L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p == u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p == U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p != '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p != L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p != u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p != U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p == '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p == L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p == u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p == U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p != '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p != L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p != u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p != U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } - r += '\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += L'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += u'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += U'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += '\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += L'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += u'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += U'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += '\0' == p; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += L'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += u'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += U'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += '\0' != p; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += L'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += u'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += U'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q == '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q == L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q == u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q == U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q != '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q != L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q != u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += q != U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q == '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q == L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q == u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q == U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q != '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q != L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q != u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += q != U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } - r += '\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += L'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += u'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += U'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += '\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += L'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += u'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += U'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += '\0' == q; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += L'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += u'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += U'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += '\0' != q; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += L'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += u'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += U'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" } return r; } @@ -68,11 +68,11 @@ f3 (int *p) { int r = 0; - r += p == (char) 0; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += p != (char) 0; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p == (char) 0; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += p != (char) 0; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" } - r += (char) 0 == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } - r += (char) 0 != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" } + r += (char) 0 == p; // { dg-error "17:ISO C\\+\\+ forbids comparison between pointer and integer" } + r += (char) 0 != p; // { dg-error "17:ISO C\\+\\+ forbids comparison between pointer and integer" } return r; } diff --git a/gcc/testsuite/g++.dg/template/crash126.C b/gcc/testsuite/g++.dg/template/crash126.C index 903cab85cd2..892bc45353e 100644 --- a/gcc/testsuite/g++.dg/template/crash126.C +++ b/gcc/testsuite/g++.dg/template/crash126.C @@ -4,7 +4,7 @@ template < class T, class > struct A { A (); A (A &); - A (A < T, T >); // { dg-error "invalid constructor" } + A (A < T, T >); // { dg-error "3:invalid constructor" } }; void f () diff --git a/gcc/testsuite/g++.dg/template/crash129.C b/gcc/testsuite/g++.dg/template/crash129.C index 9f56b809b26..3bb9e573fed 100644 --- a/gcc/testsuite/g++.dg/template/crash129.C +++ b/gcc/testsuite/g++.dg/template/crash129.C @@ -1,5 +1,5 @@ // PR c++/79626 template struct b -{ b(); b(b &); b(b< a, a >); }; // { dg-error "invalid constructor" } +{ b(); b(b &); b(b< a, a >); }; // { dg-error "16:invalid constructor" } int c(b< int, int >(b< int, int >()); // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/warn/Wextra-3.C b/gcc/testsuite/g++.dg/warn/Wextra-3.C index 04fdbba9076..1bf2a6e4977 100644 --- a/gcc/testsuite/g++.dg/warn/Wextra-3.C +++ b/gcc/testsuite/g++.dg/warn/Wextra-3.C @@ -3,7 +3,7 @@ extern void* p; -int f1() { return ( p < 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" } -int f2() { return ( p <= 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" } -int f3() { return ( p > 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" } -int f4() { return ( p >= 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" } +int f1() { return ( p < 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" } +int f2() { return ( p <= 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" } +int f3() { return ( p > 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" } +int f4() { return ( p >= 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" } diff --git a/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C b/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C index 1b23611bdc0..1da04886665 100644 --- a/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C +++ b/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C @@ -4,7 +4,7 @@ double a, b; _Complex double c, d; -int f(void) { return a == b; } /* { dg-warning "comparing floating-point" } */ -int g(void) { return c == d; } /* { dg-warning "comparing floating-point" } */ -int h(void) { return a != b; } /* { dg-warning "comparing floating-point" } */ -int i(void) { return c != d; } /* { dg-warning "comparing floating-point" } */ +int f(void) { return a == b; } /* { dg-warning "24:comparing floating-point" } */ +int g(void) { return c == d; } /* { dg-warning "24:comparing floating-point" } */ +int h(void) { return a != b; } /* { dg-warning "24:comparing floating-point" } */ +int i(void) { return c != d; } /* { dg-warning "24:comparing floating-point" } */ diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C index 97e317644d5..866364277ac 100644 --- a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C @@ -4,7 +4,7 @@ int test1(char *ptr) { - return ptr == "foo"; /* { dg-warning "comparison with string" } */ + return ptr == "foo"; /* { dg-warning "14:comparison with string" } */ } int test2() diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C index 3eb91eeca49..fed4c5a37e8 100644 --- a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C @@ -4,7 +4,7 @@ int test1(char *ptr) { - return ptr == "foo"; /* { dg-warning "comparison with string" } */ + return ptr == "foo"; /* { dg-warning "14:comparison with string" } */ } int test2() diff --git a/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C b/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C index c6b75a7fc12..a0683ca3746 100644 --- a/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C +++ b/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C @@ -3,24 +3,24 @@ int foo (int i, void *p) { - if (i == p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + if (i == p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" } return 0; - else if (i != p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + else if (i != p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" } return 1; } int bar (int i, void *p) { - if (i < p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + if (i < p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" } return 0; - else if (i >= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + else if (i >= p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" } return 1; } int baz (int i, void *p) { - if (i <= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + if (i <= p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" } return 0; - else if (i > p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } + else if (i > p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" } return 1; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash8.C b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C index 061652db225..317627a6941 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/crash8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C @@ -1,7 +1,7 @@ // { dg-do assemble } struct A { A(); - A(A); // { dg-error "" } copy ctor must take reference + A(A); // { dg-error "3:invalid constructor" } copy ctor must take reference }; int main() { -- 2.30.2