diff options
Diffstat (limited to 'gcc/cpppch.c')
-rw-r--r-- | gcc/cpppch.c | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/gcc/cpppch.c b/gcc/cpppch.c index 8cb5bcff87a..a4886ae3457 100644 --- a/gcc/cpppch.c +++ b/gcc/cpppch.c @@ -224,6 +224,12 @@ count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p) struct cpp_string news; void **slot; + /* APPLE LOCAL begin Symbol Separation */ + if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier) + if (pfile->cb.is_builtin_identifier (hn)) + return 1; + /* APPLE LOCAL end Symbol Separation */ + news.len = NODE_LEN (hn); news.text = NODE_NAME (hn); slot = htab_find (ss->definedhash, &news); @@ -263,6 +269,12 @@ write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p) struct cpp_string news; void **slot; + /* APPLE LOCAL begin Symbol Separation */ + if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier) + if (pfile->cb.is_builtin_identifier (hn)) + return 1; + /* APPLE LOCAL end Symbol Separation */ + news.len = NODE_LEN (hn); news.text = NODE_NAME (hn); slot = htab_find (ss->definedhash, &news); @@ -420,8 +432,9 @@ collect_ht_nodes (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, - anything that was not defined then, but is defined now, was not used by the PCH. - NAME is used to print warnings if `warn_invalid_pch' is set in the - reader's flags. + APPLE LOCAL Symbol Separation + NAME is used to print warnings if `warn_invalid_pch' or `warn_invalid_sr' + is set in the reader's flags. */ int @@ -434,7 +447,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 (;;) @@ -459,12 +479,18 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) != 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 || h->type != NT_MACRO || h->flags & NODE_POISONED) { - if (CPP_OPTION (r, warn_invalid_pch)) + /* APPLE LOCAL Symbol Separtion */ + if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr)) cpp_error (r, CPP_DL_WARNING_SYSHDR, "%s: not used because `%.*s' not defined", name, m.name_length, namebuf); @@ -476,7 +502,8 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) if (m.definition_length != ustrlen (newdefn) || memcmp (namebuf, newdefn, m.definition_length) != 0) { - if (CPP_OPTION (r, warn_invalid_pch)) + /* APPLE LOCAL Symbol Separtion */ + if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr)) cpp_error (r, CPP_DL_WARNING_SYSHDR, "%s: not used because `%.*s' defined as `%s' not `%.*s'", name, m.name_length, namebuf, newdefn + m.name_length, @@ -494,6 +521,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; @@ -517,7 +552,8 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) ++i; else { - if (CPP_OPTION (r, warn_invalid_pch)) + /* APPLE LOCAL Symbol Separtion */ + if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr)) cpp_error (r, CPP_DL_WARNING_SYSHDR, "%s: not used because `%s' is defined", name, first); @@ -619,6 +655,11 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, struct save_macro_item *d; size_t i, mac_count; int saved_line = r->line; + /* APPLE LOCAL pch distcc mrs */ + void (*saved_line_change) PARAMS ((cpp_reader *, const cpp_token *, int)); + + /* APPLE LOCAL pch distcc mrs */ + saved_line_change = r->cb.line_change; /* Restore spec_nodes, which will be full of references to the old hashtable entries and so will now be invalid. */ @@ -663,6 +704,9 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, r->state.prevent_expansion = 1; r->state.angled_headers = 0; + /* APPLE LOCAL pch distcc mrs */ + r->cb.line_change = 0; + /* Read in the identifiers that must be defined. */ for (;;) { @@ -708,6 +752,9 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, r->state = old_state; r->line = saved_line; + /* APPLE LOCAL pch distcc mrs */ + r->cb.line_change = saved_line_change; + free (defn); defn = NULL; |