diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-05-08 11:06:49 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-05-08 11:13:29 -0700 |
commit | b224c3763e018e8bdd0047b3eb283992fb655ce0 (patch) | |
tree | 0b9853fb61dcbb380a433dec1f58679c77036663 /libcpp/internal.h | |
parent | bc484e250990393e887f7239157cc85ce6fadcce (diff) | |
download | gcc-b224c3763e018e8bdd0047b3eb283992fb655ce0.zip gcc-b224c3763e018e8bdd0047b3eb283992fb655ce0.tar.gz gcc-b224c3763e018e8bdd0047b3eb283992fb655ce0.tar.bz2 |
preprocessor: Reimplement directives only processing, support raw literals.
The existing directives-only code (a) punched a hole through the
libcpp interface and (b) didn't support raw string literals. This
reimplements this preprocessing mode. I added a proper callback
interface, and adjusted c-ppoutput to use it. Sadly I cannot get rid
of the libcpp/internal.h include for unrelated reasons.
The new scanner is in lex.x, and works doing some backwards scanning
when it finds a charater of interest. This reduces the number of
cases one has to deal with in forward scanning. It may have different
failure mode than forward scanning on bad tokenization.
Finally, Moved some cpp tests from the c-specific dg.gcc/cpp directory
to the c-c++-common/cpp shared directory,
libcpp/
* directives-only.c: Delete.
* Makefile.in (libcpp_a_OBJS, libcpp_a_SOURCES): Remove it.
* include/cpplib.h (enum CPP_DO_task): New enum.
(cpp_directive_only_preprocess): Declare.
* internal.h (_cpp_dir_only_callbacks): Delete.
(_cpp_preprocess_dir_only): Delete.
* lex.c (do_peek_backslask, do_peek_next, do_peek_prev): New.
(cpp_directives_only_process): New implementation.
gcc/c-family/
Reimplement directives only processing.
* c-ppoutput.c (token_streamer): Ne.
(directives_only_cb): New. Swallow ...
(print_lines_directives_only): ... this.
(scan_translation_unit_directives_only): Reimplment using the
published interface.
gcc/testsuite/
* gcc.dg/cpp/counter-[23].c: Move to c-c+_-common/cpp.
* gcc.dg/cpp/dir-only-*: Likewise.
* c-c++-common/cpp/dir-only-[78].c: New.
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r-- | libcpp/internal.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h index 97d9bdb..11b6469 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -747,17 +747,6 @@ extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *, extern void _cpp_pop_buffer (cpp_reader *); extern char *_cpp_bracket_include (cpp_reader *); -/* In directives.c */ -struct _cpp_dir_only_callbacks -{ - /* Called to print a block of lines. */ - void (*print_lines) (int, const void *, size_t); - bool (*maybe_print_line) (location_t); -}; - -extern void _cpp_preprocess_dir_only (cpp_reader *, - const struct _cpp_dir_only_callbacks *); - /* In traditional.c. */ extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *, bool); extern bool _cpp_read_logical_line_trad (cpp_reader *); |