]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: avoid init_priority warning in system header
authorJason Merrill <jason@redhat.com>
Sat, 14 Sep 2024 09:46:22 +0000 (11:46 +0200)
committerJason Merrill <jason@redhat.com>
Sat, 14 Sep 2024 13:39:12 +0000 (15:39 +0200)
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

index 99088da9cee07dce9565856b561e2eddef214b67..f43febed124cc885a0100bdeba06e96e252eb199 100644 (file)
@@ -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",