diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2000-04-30 17:30:25 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-04-30 17:30:25 +0000 |
commit | 6d2c2047b5760b68cc9eb98fba1ad00a2539fc12 (patch) | |
tree | b4d768db6e949f31e3dc54159c98b6eb77a9dea5 /gcc/fix-header.c | |
parent | 638d694d84aedb360309dd956b261e428d85f092 (diff) | |
download | gcc-6d2c2047b5760b68cc9eb98fba1ad00a2539fc12.zip gcc-6d2c2047b5760b68cc9eb98fba1ad00a2539fc12.tar.gz gcc-6d2c2047b5760b68cc9eb98fba1ad00a2539fc12.tar.bz2 |
cpplex.c (cpp_idcmp): New function.
* cpplex.c (cpp_idcmp): New function.
* cpplib.h: Prototype it.
* scan_decls.c (scan_decls): Use it to inspect token names.
* fix-header.c (read_scan_file): Likewise. Set system_header_p on
the file being run through the preprocessor.
(check_macro_names): Provide length of token to cpp_defined.
* Makefile.in: Remove stale warning message.
From-SVN: r33552
Diffstat (limited to 'gcc/fix-header.c')
-rw-r--r-- | gcc/fix-header.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/fix-header.c b/gcc/fix-header.c index 73e7bb6..29b4d35 100644 --- a/gcc/fix-header.c +++ b/gcc/fix-header.c @@ -602,11 +602,13 @@ check_macro_names (pfile, names) cpp_reader *pfile; namelist names; { + size_t len; while (*names) { - if (cpp_defined (pfile, names, -1)) + len = strlen (names); + if (cpp_defined (pfile, names, len)) recognized_macro (names); - names += strlen (names) + 1; + names += len + 1; } } @@ -637,6 +639,9 @@ read_scan_file (in_fname, argc, argv) if (! cpp_start_read (&scan_in, 0, in_fname)) exit (FATAL_EXIT_CODE); + /* We are scanning a system header, so mark it as such. */ + CPP_BUFFER (&scan_in)->system_header_p = 1; + scan_decls (&scan_in, argc, argv); for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++) check_macro_names (&scan_in, cur_symbols->names); @@ -663,6 +668,8 @@ read_scan_file (in_fname, argc, argv) { enum cpp_ttype token = cpp_get_token (&scan_in); int length = CPP_WRITTEN (&scan_in) - old_written; + unsigned char *id = scan_in.token_buffer + old_written; + CPP_SET_WRITTEN (&scan_in, old_written); if (token == CPP_EOF) /* Should not happen ... */ break; @@ -671,8 +678,7 @@ read_scan_file (in_fname, argc, argv) cpp_pop_buffer (&scan_in); break; } - if (token == CPP_NAME && length == 7 - && strcmp ("_filbuf", scan_in.token_buffer + old_written) == 0) + if (token == CPP_NAME && cpp_idcmp (id, length, "_filbuf") == 0) seen_filbuf++; } if (seen_filbuf) @@ -690,7 +696,7 @@ read_scan_file (in_fname, argc, argv) SET_REQUIRED (fn); if (need_flsbuf) SET_REQUIRED (flsbuf_fn); - if (need_flsbuf + need_filbuf == 2) + if (need_flsbuf && need_filbuf) new_list = "_filbuf\0_flsbuf\0"; else if (need_flsbuf) new_list = "_flsbuf\0"; |