Makefile.am: Add makedepend.
libcpp: * Makefile.am: Add makedepend. * Makefile.in, aclocal.m4: Regenerate. * charset.c: Insert a space to avoid a warning. * directives.c: Include mkdeps.h. (_cpp_handle_directive): Reenable macro expander if appropriate. (undefine_macros): Inline body of _cpp_free_definition for speed. Do not call undef callback or _cpp_warn_if_unused_macro. (cpp_get_deps): New interface. * files.c (search_cache): Add pfile argument. Check for file that would be found by "" or <> search here... (_cpp_find_file): ...not here. Correct recorded start_dir of files found by directory-of-current-file search that would be found by "" or <> search. * init.c (cpp_add_dependency_target): Delete. * internal.h (struct lexer_state): Add discarding_output flag. * lex.c (lex_identifier): Compute hash function while scanning. * macro.c (cpp_scan_nooutput): Disable macro expansion outside directives. * makedepend.c: New file. * mkdeps.c (struct deps): Add vpath vector. (apply_vpath, deps_add_vpath): New function. (deps_free): Free vpath vector. (deps_add_dep, deps_add_target): Use apply_vpath. * symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH. (ht_lookup_with_hash): New function. * cpplib.h, mkdeps.h: Update prototypes. * symtab.h: Update prototypes. (HT_HASHSTEP, HT_FINISH): New macros. gcc: * Makefile.in (MKDEPS_H): New shorthand. (c-opts.o): Update dependencies. * c-opts.c: Include mkdeps.h. (handle_deferred_opts): Use cpp_get_deps and deps_add_target, not cpp_add_dependency_target. From-SVN: r82654
This commit is contained in:
parent
dbeff3e56d
commit
c6e8380069
20 changed files with 531 additions and 120 deletions
28
libcpp/lex.c
28
libcpp/lex.c
|
@ -470,22 +470,36 @@ static cpp_hashnode *
|
|||
lex_identifier (cpp_reader *pfile, const uchar *base)
|
||||
{
|
||||
cpp_hashnode *result;
|
||||
const uchar *cur;
|
||||
const uchar *cur, *limit;
|
||||
unsigned int len;
|
||||
unsigned int hash = HT_HASHSTEP (0, *base);
|
||||
|
||||
do
|
||||
cur = pfile->buffer->cur;
|
||||
for (;;)
|
||||
{
|
||||
cur = pfile->buffer->cur;
|
||||
|
||||
/* N.B. ISIDNUM does not include $. */
|
||||
while (ISIDNUM (*cur))
|
||||
cur++;
|
||||
{
|
||||
hash = HT_HASHSTEP (hash, *cur);
|
||||
cur++;
|
||||
}
|
||||
|
||||
pfile->buffer->cur = cur;
|
||||
if (!forms_identifier_p (pfile, false))
|
||||
break;
|
||||
|
||||
limit = pfile->buffer->cur;
|
||||
while (cur < limit)
|
||||
{
|
||||
hash = HT_HASHSTEP (hash, *cur);
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
while (forms_identifier_p (pfile, false));
|
||||
len = cur - base;
|
||||
hash = HT_HASHFINISH (hash, len);
|
||||
|
||||
result = (cpp_hashnode *)
|
||||
ht_lookup (pfile->hash_table, base, cur - base, HT_ALLOC);
|
||||
ht_lookup_with_hash (pfile->hash_table, base, len, hash, HT_ALLOC);
|
||||
|
||||
/* Rarely, identifiers require diagnostics when lexed. */
|
||||
if (__builtin_expect ((result->flags & NODE_DIAGNOSTIC)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue