diff options
Diffstat (limited to 'libcpp/pch.c')
-rw-r--r-- | libcpp/pch.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/libcpp/pch.c b/libcpp/pch.c index 79900c30c36..7f054b23c2f 100644 --- a/libcpp/pch.c +++ b/libcpp/pch.c @@ -423,7 +423,14 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) struct ht_node_list nl = { 0, 0, 0 }; unsigned char *first, *last; unsigned int i; - + /* APPLE LOCAL begin pch distcc --mrs */ + int skip_validation; + + /* Skip pch validation if we have just validated it. */ + skip_validation = CPP_OPTION (r, pch_preprocess) + && CPP_OPTION (r, preprocessed); + /* APPLE LOCAL end pch distcc --mrs */ + /* Read in the list of identifiers that must be defined Check that they are defined in the same way. */ for (;;) @@ -456,6 +463,11 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) if ((size_t)read (fd, namebuf, m.definition_length) != m.definition_length) goto error; + + /* APPLE LOCAL begin pch distcc --mrs */ + if (skip_validation) + continue; + /* APPLE LOCAL end pch distcc --mrs */ h = cpp_lookup (r, namebuf, m.name_length); if (m.flags & NODE_POISONED @@ -492,6 +504,14 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) if ((size_t) read (fd, undeftab, m.definition_length) != m.definition_length) goto error; + /* APPLE LOCAL begin pch distcc --mrs */ + if (skip_validation) + { + free (undeftab); + return 0; + } + /* APPLE LOCAL end pch distcc --mrs */ + /* Collect identifiers from the current hash table. */ nl.n_defs = 0; nl.asize = 10; @@ -630,6 +650,12 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, struct save_macro_data *data) { size_t i; + /* APPLE LOCAL begin pch distcc --mrs */ + void (*saved_line_change) PARAMS ((cpp_reader *, const cpp_token *, int)); + + saved_line_change = r->cb.line_change; + /* APPLE LOCAL end pch distcc --mrs */ + struct lexer_state old_state; /* Restore spec_nodes, which will be full of references to the old @@ -646,6 +672,8 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, r->state.in_directive = 1; r->state.prevent_expansion = 1; r->state.angled_headers = 0; + /* APPLE LOCAL pch distcc --mrs */ + r->cb.line_change = 0; /* Run through the carefully-saved macros, insert them. */ for (i = 0; i < data->count; i++) @@ -678,6 +706,8 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, free (data->defns[i]); } r->state = old_state; + /* APPLE LOCAL pch distcc --mrs */ + r->cb.line_change = saved_line_change; _cpp_restore_pragma_names (r, data->saved_pragmas); |