On 12/19/24 5:00 AM, Jakub Jelinek wrote:
On Wed, Dec 18, 2024 at 04:44:55PM +0100, Jakub Jelinek wrote:
The first check would flag something that is used in the wild, e.g.
g++.dg/Wmissing-attributes.C
gcc.dg/gnu23-attrs-2.c
g++.dg/cpp0x/gen-attrs-81.C
g++.dg/warn/Wdangling-reference17.C
g++.dg/warn/Wdangling-reference20.C
tests would be affected by it (at least if pedantic), including
<exception> header which uses this on
/// If you write a replacement %unexpected handler, it must be of this type.
typedef void (*_GLIBCXX11_DEPRECATED unexpected_handler) ();
(not to mention the diagnostic wording is C++ish).
E.g. gnu23-attrs-2.c has
typedef int A[2];
__typeof__ (int [[gnu::deprecated]]) var1; /* { dg-warning "deprecated" } */
__typeof__ (A [[gnu::deprecated]]) var2; /* { dg-warning "deprecated" } */
__typeof__ (int [3] [[gnu::deprecated]]) var3; /* { dg-warning "deprecated" } */
tests.
E.g.
typedef int * D * T;
T b;
typedef __typeof__ (*b) U;
currently works both in C and C++ for D [[gnu::deprecated]] and
__attribute__((deprecated)) and warns
a.C:12:1: warning: type is deprecated [-Wdeprecated-declarations]
12 | typedef __typeof__ (*b) U;
| ^~~~~~~
Interesting, I thought it was useless, but clearly others disagree!
The patch is OK, then.
Jason