Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

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.
---
 gcc/cp/tree.cc                        | 3 ++-
 gcc/testsuite/g++.dg/special/initp1.C | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 79bc74fa2b7..bf84fb6bcec 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 %<init_priority%> %i is reserved for internal use",
+       (OPT_Wprio_ctor_dtor,
+        "requested %<init_priority%> %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 4a539a5a4bd..ef88ca970b8 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 )

base-commit: cdb4d27a4c2786cf1b1b0eb1872eac6a5f931578
prerequisite-patch-id: cf6b02f09f22e626404250f9e5fc33e6e0351db2
-- 
2.48.1

Reply via email to