@@ -448,6 +448,11 @@ Winvalid-pch
C ObjC C++ ObjC++ Warning
Warn about PCH files that are found but not used
+Winvalid-pph
+C++ Warning
+Warn about PPH files that are found but cannot used
+
+
Wjump-misses-init
C ObjC Var(warn_jump_misses_init) Init(-1) Warning
Warn when a jump misses a variable initialization
@@ -492,6 +497,10 @@ Wmissing-prototypes
C ObjC Var(warn_missing_prototypes) Warning
Warn about global functions without prototypes
+Wmissing-pph
+C++ Warning
+Warn about missing PPH files
+
Wmultichar
C ObjC C++ ObjC++ Warning
Warn about use of multi-character character constants
@@ -586,7 +586,8 @@ pph_is_valid_here (const char *name, location_t loc)
the original text file. */
if (scope_chain->x_brace_nesting > 0)
{
- error_at (loc, "PPH file %s not included at global scope", name);
+ warning_at (loc, OPT_Winvalid_pph,
+ "PPH file %s not included at global scope", name);
return false;
}
@@ -626,22 +627,22 @@ pph_include_handler (cpp_reader *reader,
&& pph_is_valid_here (name, loc)
&& !cpp_included_before (reader, name, input_location))
{
- pph_stream *include;
-
- /* Hack. We do this to mimic what the non-pph compiler does in
- _cpp_stack_include as our goal is to have identical line_tables. */
- line_table->highest_location--;
-
- include = pph_read_file (pph_file);
-
- /* If we are generating a new PPH image, add the stream we just
- read to the list of includes. This way, the parser will be
- able to resolve references to symbols in INCLUDE and its
- children. */
- if (pph_writer_enabled_p ())
- pph_writer_add_include (include);
-
- read_text_file_p = false;
+ pph_stream *include = pph_read_file (pph_file);
+ if (include)
+ {
+ /* If we are generating a new PPH image, add the stream we
+ just read to the list of includes. This way, the parser
+ will be able to resolve references to symbols in INCLUDE
+ and its children. */
+ if (pph_writer_enabled_p ())
+ pph_writer_add_include (include);
+
+ read_text_file_p = false;
+ }
+ else
+ warning_at (input_location, OPT_Wmissing_pph,
+ "cannot open PPH file %s for reading: %m\n"
+ "using original header %s", pph_file, name);
}
return read_text_file_p;
@@ -2900,10 +2900,15 @@ pph_stream *
pph_read_file (const char *filename)
{
pph_stream *stream = pph_stream_open (filename, "rb");
- if (stream == NULL)
- fatal_error ("cannot open PPH file %s for reading: %m", filename);
+ if (stream)
+ {
+ /* FIXME pph. We do this to mimic what the non-pph compiler
+ does in _cpp_stack_include as our goal is to have identical
+ line_tables. */
+ line_table->highest_location--;
- pph_read_file_1 (stream);
+ pph_read_file_1 (stream);
+ }
return stream;
}