`add_sysrooted_hdrs_prefix` is only used in `find_fortran_preinclude_file`
when NATIVE_SYSTEM_HEADER_DIR is defined, while itself is defined
unconditionally. This generates the following warning when compiling GCC
with NATIVE_SYSTEM_HEADER_DIR not defined (e.g. on MinGW-w64):

../../gcc-16.1.0/gcc/gcc.cc:3231:1: warning: 'void add_sysrooted_hdrs_prefix(path_prefix*, const char*, const char*, int, int, int)' defined but not used [-Wunused-function]
 3231 | add_sysrooted_hdrs_prefix (struct path_prefix *pprefix, const char 
*prefix,
      | ^~~~~~~~~~~~~~~~~~

gcc/ChangeLog:

        PR driver/126506
        * gcc.cc (add_sysrooted_hdrs_prefix): Guard with #ifdef
        NATIVE_SYSTEM_HEADER_DIR.

Signed-off-by: Zhongteng Gui <[email protected]>
---
 gcc/gcc.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 43b0158ee02..bef80b239fc 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -3225,6 +3225,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
              require_machine_suffix, os_multilib);
 }

+#ifdef NATIVE_SYSTEM_HEADER_DIR
 /* Same as add_prefix, but prepending target_sysroot_hdrs_suffix to prefix.  */

 static void
@@ -3261,6 +3262,7 @@ add_sysrooted_hdrs_prefix (struct path_prefix *pprefix, const char *prefix,
   add_prefix (pprefix, prefix, component, priority,
              require_machine_suffix, os_multilib);
 }
+#endif

 
 /* Execute the command specified by the arguments on the current line of spec.
--
2.55.0.windows.3

Reply via email to