]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (grokdeclarator): Use declarator->id_loc in diagnostic about flexible array...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 30 Oct 2018 18:29:49 +0000 (18:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 30 Oct 2018 18:29:49 +0000 (18:29 +0000)
/cp
2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

* decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
about flexible array members.

/testsuite
2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/cpp1z/has-unique-obj-representations1.C: Test location too.
* g++.dg/ext/flexarray-mangle-2.C: Likewise.
* g++.dg/ext/flexarray-mangle.C: Likewise.
* g++.dg/ext/flexarray-subst.C: Likewise.
* g++.dg/ext/flexary10.C: Likewise.
* g++.dg/ext/flexary11.C: Likewise.
* g++.dg/ext/flexary14.C: Likewise.
* g++.dg/ext/flexary16.C: Likewise.
* g++.dg/ext/flexary26.C: Likewise.
* g++.dg/ext/flexary27.C: Likewise.
* g++.dg/ext/flexary7.C: Likewise.
* g++.dg/ext/pr71290.C: Likewise.

From-SVN: r265636

15 files changed:
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/has-unique-obj-representations1.C
gcc/testsuite/g++.dg/ext/flexarray-mangle-2.C
gcc/testsuite/g++.dg/ext/flexarray-mangle.C
gcc/testsuite/g++.dg/ext/flexarray-subst.C
gcc/testsuite/g++.dg/ext/flexary10.C
gcc/testsuite/g++.dg/ext/flexary11.C
gcc/testsuite/g++.dg/ext/flexary14.C
gcc/testsuite/g++.dg/ext/flexary16.C
gcc/testsuite/g++.dg/ext/flexary26.C
gcc/testsuite/g++.dg/ext/flexary27.C
gcc/testsuite/g++.dg/ext/flexary7.C
gcc/testsuite/g++.dg/ext/pr71290.C

index e1167761ffc8aff9fd032602acd95ea701718a11..75fcc8adc58d46168274acad0788bc671e4a2d86 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
+       about flexible array members.
+
 2018-10-29  David Malcolm  <dmalcolm@redhat.com>
 
        * cp-name-hint.h: New file.
index 00e75f0bc7909ffa6f23d58d83ce8219e024f314..496ed98d9a5a495e07841bd4acf1696db0202ca4 100644 (file)
@@ -12210,7 +12210,7 @@ grokdeclarator (const cp_declarator *declarator,
                  /* Do not warn on flexible array members in system
                     headers because glibc uses them.  */;
                else if (name)
-                 pedwarn (input_location, OPT_Wpedantic,
+                 pedwarn (declarator->id_loc, OPT_Wpedantic,
                           "ISO C++ forbids flexible array member %qs", name);
                else
                  pedwarn (input_location, OPT_Wpedantic,
index 62a966bab6f05e10d44fb4e88fc0d9f150ed3c6f..e3fa8007fd12bcad3b42f5dd3a69ad35caf5662c 100644 (file)
@@ -1,3 +1,18 @@
+2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/cpp1z/has-unique-obj-representations1.C: Test location too.
+       * g++.dg/ext/flexarray-mangle-2.C: Likewise.
+       * g++.dg/ext/flexarray-mangle.C: Likewise.
+       * g++.dg/ext/flexarray-subst.C: Likewise.
+       * g++.dg/ext/flexary10.C: Likewise.
+       * g++.dg/ext/flexary11.C: Likewise.
+       * g++.dg/ext/flexary14.C: Likewise.
+       * g++.dg/ext/flexary16.C: Likewise.
+       * g++.dg/ext/flexary26.C: Likewise.
+       * g++.dg/ext/flexary27.C: Likewise.
+       * g++.dg/ext/flexary7.C: Likewise.
+       * g++.dg/ext/pr71290.C: Likewise.
+
 2018-10-30  Paul Koning  <ni1d@arrl.net>
 
        * gcc.dg/tree-ssa/attr-alias.c: Skip if no weak support.
index bca03a16c41ac98230eb1ce72644b08ae12561a3..e50e535922f0b523a98b3c738802d54514321fee 100644 (file)
@@ -9,7 +9,7 @@ struct V { int i : INTB * 3 / 4; int j : INTB / 4 + 1; };
 struct W {};
 struct X : public W { int i; void bar (); };
 struct Y {
-  char a[3]; char b[];   // { dg-warning "forbids flexible array member" }
+  char a[3]; char b[];   // { dg-warning "19:ISO C\\+\\+ forbids flexible array member" }
 };
 struct Z { int a; float b; };
 struct A { int i : INTB * 2; int j; };                 // { dg-warning "exceeds its type" }
index 3abb407fab716bed8d6e906effe036575d3a3448..3d534e86c2e1344882ace35a68e5c04024b30a52 100644 (file)
@@ -4,7 +4,7 @@
 
 struct A {
   int n;
-  char a[];   // { dg-warning "forbids flexible array member" }
+  char a[];   // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
 };
 
 // Declare but do not define function templates.
index 658d9355a9c74899d3bcfac9746368e16318396d..9625459f9221bc8aa07c3239b1a4954cc7de685a 100644 (file)
@@ -4,7 +4,7 @@
 
 struct A {
   int n;
-  char a[];   // { dg-warning "forbids flexible array member" }
+  char a[];   // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
 };
 
 // Declare but do not define function templates.
index 6cf03a41af20da6c322748c61966ab1b80c6964a..8364a3e2922971a4dbd71797dc67d1df7feca0ed 100644 (file)
@@ -5,7 +5,7 @@
 
 struct A {
   int n;
-  char a[];   // { dg-warning "forbids flexible array member" }
+  char a[];   // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
 };
 
 template <class>
index 4d1ff56e49b90fa18173a5b0c73cafd2fe6bdac0..7d71630d46bfa3a68b8caab818f2ae28c1dd6513 100644 (file)
@@ -4,7 +4,7 @@
 
 struct A {
   int n;
-  int a[];  // { dg-warning "forbids flexible array member" }
+  int a[];  // { dg-warning "7:ISO C\\+\\+ forbids flexible array member" }
 };
 
 struct A foo (void)
index f958cc5555a4fdbc0866fec6bd9af990339e0aed..058c1e7d1e6694113b239bb4f77a73461e86189e 100644 (file)
@@ -4,7 +4,7 @@
 
 struct A {
   int n;
-  char a[];   // { dg-error "forbids flexible array member" }
+  char a[];   // { dg-error "8:ISO C\\+\\+ forbids flexible array member" }
 };
 
 void f ()
index add150a0be8042a8be80c936778a1b3dc268c6c9..cda6635d8cfeb1e41e805888c13825aa9deb3950 100644 (file)
@@ -10,7 +10,7 @@ struct A<T[]> { typedef int X; };
 template <class T> int foo (T&, typename A<T>::X = 0) { return 0; }
 
 struct B {
-  int n, a[];     // { dg-error "forbids flexible array member" }
+  int n, a[];     // { dg-error "10:ISO C\\+\\+ forbids flexible array member" }
 };
 
 void bar (B *b)
index 64a9f5d051510c5ab0b74e08e5600910a4bfdfea..94eb6c8c577a855b464f284f7302b6412d37b6ac 100644 (file)
@@ -12,7 +12,7 @@ struct container
 
   struct incomplete {
     int x;
-    elem array[];  // { dg-warning "forbids flexible array member" }
+    elem array[];  // { dg-warning "10:ISO C\\+\\+ forbids flexible array member" }
   };
 };
 
@@ -27,7 +27,7 @@ struct D: container<T>
 {
   struct S {
     int x;
-    typename container<T>::elem array[];  // { dg-warning "forbids flexible array member" }
+    typename container<T>::elem array[];  // { dg-warning "33:ISO C\\+\\+ forbids flexible array member" }
   };
 };
 
index af1277287aae76e6bc011d17eaa152621fa457f9..e62e221cff51d137be132ee33d87ec23dce7dc3a 100644 (file)
@@ -2,8 +2,8 @@
 // { dg-do compile }
 // { dg-options "-Wpedantic" }
 
-struct S { const char *a; char b[]; }; // { dg-warning "forbids flexible array member" }
-struct T { int a; int b[]; };  // { dg-warning "forbids flexible array member" }
+struct S { const char *a; char b[]; }; // { dg-warning "32:ISO C\\+\\+ forbids flexible array member" }
+struct T { int a; int b[]; };  // { dg-warning "23:ISO C\\+\\+ forbids flexible array member" }
 #if __cplusplus >= 201103L
 S c[] { "", "" };              // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
                                // { dg-warning "initialization of a flexible array member" "" { target c++11 } .-1 }
index 9dfa9a2b82c9481176bb9eeffe7f9021fec89695..20c04b42f5870d60703bbb25e3061bc372c993b5 100644 (file)
@@ -1,8 +1,8 @@
 // PR c++/81922
 // { dg-do compile }
 
-struct S { const char *a; char b[]; }; // { dg-error "forbids flexible array member" }
-struct T { int a; int b[]; };  // { dg-error "forbids flexible array member" }
+struct S { const char *a; char b[]; }; // { dg-error "32:ISO C\\+\\+ forbids flexible array member" }
+struct T { int a; int b[]; };  // { dg-error "23:ISO C\\+\\+ forbids flexible array member" }
 #if __cplusplus >= 201103L
 S c[] { "", "" };              // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
                                // { dg-error "initialization of a flexible array member" "" { target c++11 } .-1 }
index 1b22f21b2b635e7fd75152151f331fd6c98fa8e2..62d869ee7ad40acf8edb158a9b5f1c2a5f06db39 100644 (file)
@@ -5,7 +5,7 @@
 
 struct FlexChar {
     int n;
-    char a[];       // { dg-warning "forbids flexible array member" }
+    char a[];       // { dg-warning "10:ISO C\\+\\+ forbids flexible array member" }
 };
 
 struct FlexChar ac =
@@ -18,7 +18,7 @@ typedef __WCHAR_TYPE__ wchar_t;
 
 struct FlexWchar {
     int n;
-    wchar_t a[];    // { dg-warning "forbids flexible array member" }
+    wchar_t a[];    // { dg-warning "13:ISO C\\+\\+ forbids flexible array member" }
 };
 
 struct FlexWchar awc =
@@ -27,7 +27,7 @@ struct FlexWchar awc =
 
 struct FlexInt {
     int n;
-    int a[];        // { dg-warning "forbids flexible array member" }
+    int a[];        // { dg-warning "9:ISO C\\+\\+ forbids flexible array member" }
 };
 
 // Verify that no warning is issued for the case when a flexible array
@@ -48,7 +48,7 @@ struct FlexInt ai2 =
 template <class T>
 struct FlexT {
     int n;
-    T a[];          // { dg-warning "forbids flexible array member" }
+    T a[];          // { dg-warning "7:ISO C\\+\\+ forbids flexible array member" }
 };
 
 struct FlexT<char> atc =
index e782eb1a486130f2f64a694e696e1683793a8b7b..7268294381c0b812ddfaa440ad51415811346ce6 100644 (file)
@@ -1,17 +1,17 @@
 // PR c++/71290 - [6/7 Regression] Flexible array member is not diagnosed
 // with -pedantic
 
-// { dg-do compile }s
+// { dg-do compile }
 // { dg-options "-Wall -Wpedantic" }
 
 struct A
 {
   int i;
-  int arr[];   // { dg-warning "forbids flexible array member .arr." }
+  int arr[];   // { dg-warning "7:ISO C\\+\\+ forbids flexible array member .arr." }
 };
 
 template <class T>
 struct B {
   T n;
-  T a[];       // { dg-warning "forbids flexible array member .a." }
+  T a[];       // { dg-warning "5:ISO C\\+\\+ forbids flexible array member .a." }
 };