From: Bernhard Reutner-Fischer <al...@gcc.gnu.org>

gcc/ChangeLog:

        * incpath.c (free_cpp_dirs): New function.
        * incpath.h (free_cpp_dirs): Ditto.

---
This adds a helper to allow the fortran FE to free it's include dirs.

Bootstrapped and regtested without new regressions on x86_64-unknown-linux.
Ok for trunk?
---
 gcc/incpath.c | 13 +++++++++++++
 gcc/incpath.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/gcc/incpath.c b/gcc/incpath.c
index 52dbb806b1b..de77a56062c 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -513,6 +513,19 @@ get_added_cpp_dirs (incpath_kind chain)
   return heads[chain];
 }
 
+/* Free all cpp dirs.  */
+void
+free_cpp_dirs (void)
+{
+  struct cpp_dir **pcur, *cur;
+  for (pcur = &heads[INC_QUOTE]; *pcur;)
+    {
+      cur = *pcur;
+      *pcur = cur->next;
+      free_path (cur, REASON_QUIET);
+    }
+}
+
 #if !(defined TARGET_EXTRA_INCLUDES) || !(defined TARGET_EXTRA_PRE_INCLUDES)
 static void hook_void_charptr_charptr_int (const char *sysroot 
ATTRIBUTE_UNUSED,
                                           const char *iprefix ATTRIBUTE_UNUSED,
diff --git a/gcc/incpath.h b/gcc/incpath.h
index 2a4a314d7f9..4bf878b4e74 100644
--- a/gcc/incpath.h
+++ b/gcc/incpath.h
@@ -34,6 +34,7 @@ extern void register_include_chains (cpp_reader *, const char 
*,
                                     int, int, int);
 extern void add_cpp_dir_path (struct cpp_dir *, incpath_kind);
 extern struct cpp_dir *get_added_cpp_dirs (incpath_kind);
+extern void free_cpp_dirs(void);
 
 struct target_c_incpath_s {
   /* Do extra includes processing.  STDINC is false iff -nostdinc was given.  
*/
-- 
2.33.0

Reply via email to