@@ -590,6 +590,11 @@ extern const char *pph_out_file;
extern bool
pph_reader_enabled_p (void);
+/* Disable the PPH reader. */
+
+extern void
+pph_disable_reader (void);
+
/* Query for a mapping from an INCLUDE to a PPH file.
Return the filename, without ownership.
If there is no mapping, return null. */
@@ -140,6 +140,18 @@ pph_reader_enabled_p (void)
return include_pph_mapping != NULL;
}
+
+/* Disable PPH reading. After this function is called, all subsequent
+ #include commands will be processed as textual includes. */
+
+void
+pph_disable_reader (void)
+{
+ strstrmap_destroy (include_pph_mapping);
+ include_pph_mapping = NULL;
+}
+
+
/* Add mappings from include directive to PPH files found within file FILENAME.
The file is a sequence of lines.
Each line contains the directive, followed by a tab,
@@ -784,6 +784,11 @@ pph_include_handler (cpp_reader *reader,
fprintf (pph_logfile, "%c\n", angle_brackets ? '>' : '"');
}
+ /* If PPH has been disabled, process the #include as a regular
+ text include. */
+ if (!pph_enabled_p ())
+ return true;
+
/* If we find a #include_next directive in the primary file,
refuse to generate a PPH image for it. #include_next cannot
be resolved from the primary source file, so generating an
@@ -2854,6 +2854,11 @@ pph_disable_output (void)
pph_stream_close_no_flush (pph_out_stream);
pph_out_file = NULL;
pph_out_stream = NULL;
+
+ /* Also disable the reader. We are not generating a PPH image anymore,
+ so it makes no sense to keep reading images. FIXME pph, instead
+ of disabling PPH generation we may want to simply abort compilation. */
+ pph_disable_reader ();
}
#include "gt-cp-pph-out.h"