diff mbox series

[pushed] c++: avoid init_priority warning in system header

Message ID 20240914133929.272912-1-jason@redhat.com
State New
Headers show
Series [pushed] c++: avoid init_priority warning in system header | expand

Commit Message

Jason Merrill Sept. 14, 2024, 1:39 p.m. UTC
Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

We don't want a warning about a reserved init_priority in a system header
even with -Wsystem-headers.

gcc/cp/ChangeLog:

	* tree.cc (handle_init_priority_attribute): Check
	in_system_header_at.
---
 gcc/cp/tree.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: 005f7176e0f457a1e1a7398ddcb4a4972da28c62
diff mbox series

Patch

diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 99088da9cee..f43febed124 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -5196,7 +5196,8 @@  handle_init_priority_attribute (tree* node,
 
   /* Check for init_priorities that are reserved for
      language and runtime support implementations.*/
-  if (pri <= MAX_RESERVED_INIT_PRIORITY)
+  if (pri <= MAX_RESERVED_INIT_PRIORITY
+      && !in_system_header_at (input_location))
     {
       warning
 	(0, "requested %<init_priority%> %i is reserved for internal use",