From: Jason Merrill Date: Wed, 12 Feb 2025 22:21:25 +0000 (+0100) Subject: c++: use -Wprio-ctor-dtor for attribute init_priority X-Git-Tag: basepoints/gcc-16~2042 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7f74225116e76caa65c5ce2815c2714343dfbc;p=thirdparty%2Fgcc.git c++: use -Wprio-ctor-dtor for attribute init_priority gcc/cp/ChangeLog: * tree.cc (handle_init_priority_attribute): Use OPT_prio_ctor_dtor. gcc/testsuite/ChangeLog: * g++.dg/special/initp1.C: Test disabling -Wprio-ctor-dtor. --- diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 79bc74fa2b7a..bf84fb6bcec4 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -5335,7 +5335,8 @@ handle_init_priority_attribute (tree* node, && !in_system_header_at (input_location)) { warning - (0, "requested % %i is reserved for internal use", + (OPT_Wprio_ctor_dtor, + "requested % %i is reserved for internal use", pri); } diff --git a/gcc/testsuite/g++.dg/special/initp1.C b/gcc/testsuite/g++.dg/special/initp1.C index 4a539a5a4bdd..ef88ca970b88 100644 --- a/gcc/testsuite/g++.dg/special/initp1.C +++ b/gcc/testsuite/g++.dg/special/initp1.C @@ -30,9 +30,9 @@ Two hoo[ 3 ] = { Two( 15, 16 ) }; -Two coo[ 3 ] __attribute__((init_priority(1000))); - -Two koo[ 3 ] __attribute__((init_priority(1000))) = { +Two coo[ 3 ] __attribute__((init_priority(10))); // { dg-warning "reserved" } +#pragma GCC diagnostic ignored "-Wprio-ctor-dtor" +Two koo[ 3 ] __attribute__((init_priority(10))) = { Two( 21, 22 ), Two( 23, 24 ), Two( 25, 26 )