decl.c (grokdeclarator): Use declarator->id_loc in diagnostic about flexible array members.
/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
This commit is contained in:
parent
6a6e0926b2
commit
190facef83
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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" }
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 ()
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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" }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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." }
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user