From ed29e24b8bae184e7f3f3e92afb57aa8767659be Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 11 May 2016 03:04:03 +0000 Subject: [PATCH] PR c++/38611 - missing -Wattributes on a typedef with attribute aligned From-SVN: r236112 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/Wattributes.C | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/Wattributes.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee47bd8bdf7..dc87b0c34d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-10 Martin Sebor + + PR c++/38611 + * g++.dg/Wattributes.C: New test. + 2016-05-10 Marc Glisse * gcc.dg/tree-ssa/bit-assoc.c: New testcase. diff --git a/gcc/testsuite/g++.dg/Wattributes.C b/gcc/testsuite/g++.dg/Wattributes.C new file mode 100644 index 00000000000..35fae035683 --- /dev/null +++ b/gcc/testsuite/g++.dg/Wattributes.C @@ -0,0 +1,20 @@ +// PR c++/38611 +// { dg-do compile } + +struct A { unsigned char a [272]; }; + +typedef struct __attribute__ ((aligned (128))) A B; // { dg-warning "attributes ignored" } +typedef struct __attribute__ ((__may_alias__)) A C; // { dg-warning "attributes ignored" } + +#ifndef __cplusplus +# define alignof _Alignof +# define static_assert _Static_assert +#elif __cplusplus < 201103L +# define alignof __alignof__ +# define static_assert(expr, ignore) typedef int Assert [(expr) ? 1 : -1] +#endif + +#define SA(expr) static_assert ((expr), #expr) + +SA (alignof (struct A) == alignof (B)); + -- 2.30.2