diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-11-17 06:07:30 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-11-17 06:12:01 -0800 |
commit | 8a97aed0d290bc12b91091703444546d9b3edba7 (patch) | |
tree | eaa8646dd871f738feb30a5df76996329da161a6 /gcc/langhooks-def.h | |
parent | e3b55ce50ec294f30106947bd819f12a98069c57 (diff) | |
download | gcc-8a97aed0d290bc12b91091703444546d9b3edba7.zip gcc-8a97aed0d290bc12b91091703444546d9b3edba7.tar.gz gcc-8a97aed0d290bc12b91091703444546d9b3edba7.tar.bz2 |
langhooks: preprocessor hooks for c++ modules
This is a slightly modified version of 01-langhooks.def. I realized I
didn't need the deferred macro langhook -- that can be directly
installed into the preprocessor callbacks via preprocess_options lang
hook.
gcc/
* langhooks-def.h (LANG_HOOKS_PREPROCESS_MAIN_FILE)
(LANG_HOOKS_PREPROCESS_OPTIONS, LANG_HOOKS_PREPROCESS_UNDEF)
(LANG_HOOKS_PREPROCESS_TOKEN): New.
(LANG_HOOKS_INITIALIZER): Add them.
* langhooks.h (struct lang_hooks): Add preprocess_main_file,
preprocess_options, preprocess_undef, preprocess_token hooks. Add
enum PT_flags.
gcc/c-family/
* c-lex.c: #include "langhooks.h".
(cb_undef): Maybe call preprocess_undef lang hook.
* c-opts.c (c_common_post_options): Maybe call preprocess_options
lang hook.
(push_command_line_include): Maybe call preprocess_main_file lang
hook.
(cb_file_change): Likewise.
* c-ppoutput.c: #include "langhooks.h.
(scan_translation_unit): Maybe call preprocess_token lang hook.
(class do_streamer): New, derive from token_streamer.
(directives_only_cb): Data pointer is do_streamer, call
preprocess_token lang hook.
(scan_translation_unit_directives_only): Use do_streamer.
(print_line_1): Move src_line recording to after string output.
(cb_undef): Maybe call preprocess_undef lang hook.
Diffstat (limited to 'gcc/langhooks-def.h')
-rw-r--r-- | gcc/langhooks-def.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index a909915..2f66f5e 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -103,6 +103,10 @@ extern void lhd_finalize_early_debug (void); #define LANG_HOOKS_INIT_OPTIONS_STRUCT hook_void_gcc_optionsp #define LANG_HOOKS_INIT_OPTIONS lhd_init_options #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics +#define LANG_HOOKS_PREPROCESS_MAIN_FILE NULL +#define LANG_HOOKS_PREPROCESS_OPTIONS NULL +#define LANG_HOOKS_PREPROCESS_UNDEF NULL +#define LANG_HOOKS_PREPROCESS_TOKEN NULL #define LANG_HOOKS_REGISTER_DUMPS lhd_register_dumps #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p #define LANG_HOOKS_HANDLE_OPTION lhd_handle_option @@ -317,6 +321,10 @@ extern void lhd_end_section (void); LANG_HOOKS_INIT_OPTIONS_STRUCT, \ LANG_HOOKS_INIT_OPTIONS, \ LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \ + LANG_HOOKS_PREPROCESS_MAIN_FILE, \ + LANG_HOOKS_PREPROCESS_OPTIONS, \ + LANG_HOOKS_PREPROCESS_UNDEF, \ + LANG_HOOKS_PREPROCESS_TOKEN, \ LANG_HOOKS_REGISTER_DUMPS, \ LANG_HOOKS_COMPLAIN_WRONG_LANG_P, \ LANG_HOOKS_HANDLE_OPTION, \ |