decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 9 Oct 2019 17:17:19 +0000 (17:17 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 9 Oct 2019 17:17:19 +0000 (17:17 +0000)
/cp
2019-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

* 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  <paolo.carlini@oracle.com>

* 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

24 files changed:
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Waddress-1.c
gcc/testsuite/c-c++-common/Wpointer-compare-1.c
gcc/testsuite/c-c++-common/Wshift-count-negative-1.c
gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c
gcc/testsuite/c-c++-common/Wshift-negative-value-1.c
gcc/testsuite/c-c++-common/Wshift-negative-value-2.c
gcc/testsuite/c-c++-common/Wshift-negative-value-5.c
gcc/testsuite/c-c++-common/pr48418.c
gcc/testsuite/c-c++-common/pr65830.c
gcc/testsuite/c-c++-common/pr69764.c
gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C
gcc/testsuite/g++.dg/cpp0x/nullptr37.C
gcc/testsuite/g++.dg/template/crash126.C
gcc/testsuite/g++.dg/template/crash129.C
gcc/testsuite/g++.dg/warn/Wextra-3.C
gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C
gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C
gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C
gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C
gcc/testsuite/g++.old-deja/g++.jason/crash8.C

index 0e8d930..d75ea5d 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * 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  <msebor@redhat.com>
 
        PR c++/92001
index e405367..72c02af 100644 (file)
@@ -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;
     }
index d549450..1d9e9b8 100644 (file)
@@ -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;
        }
 
index 4c7dfe7..26a3fcc 100644 (file)
@@ -1,3 +1,26 @@
+2019-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * 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  <rguenther@suse.de>
 
        * gcc.dg/vect/vect-outer-call-1.c: New testcase.
index 8df5d2f..9790a31 100644 (file)
@@ -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" } */
 }
index 440341e..808a0fd 100644 (file)
@@ -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;
 }
index d883393..6807b98 100644 (file)
@@ -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" } */
 }
index 4d29d57..47225e4 100644 (file)
@@ -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" } */
 }
index 7df1804..d58d8b9 100644 (file)
@@ -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;
 }
index 3a60ed7..9f435e8 100644 (file)
@@ -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;
 }
index 74ecd1e..3c3e74c 100644 (file)
@@ -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;
 }
index 95ff855..1732854 100644 (file)
@@ -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;
 }
index e115f18..73eb97c 100644 (file)
@@ -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;
 }
index 79623ec..146f258 100644 (file)
@@ -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" } */
 }
index 2ff7c4d..b1d47cf 100644 (file)
@@ -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" }
 
 }
 
index e746a28..6bcc8e8 100644 (file)
@@ -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;
 }
index 903cab8..892bc45 100644 (file)
@@ -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 () 
index 9f56b80..3bb9e57 100644 (file)
@@ -1,5 +1,5 @@
 // PR c++/79626
 
 template <class a, class> 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 "" }
index 04fdbba..1bf2a6e 100644 (file)
@@ -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" }
index 1b23611..1da0488 100644 (file)
@@ -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" } */
index 97e3176..8663642 100644 (file)
@@ -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()
index 3eb91ee..fed4c5a 100644 (file)
@@ -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()
index c6b75a7..a0683ca 100644 (file)
@@ -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;
 }
index 061652d..317627a 100644 (file)
@@ -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()
 {