diff options
author | Nathan Sidwell <nathan@acm.org> | 2019-08-29 14:06:32 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2019-08-29 14:06:32 +0000 |
commit | b0d11f1ed68727a85280e0ceb83bf77b5385902a (patch) | |
tree | d343c7483c9b5485fe33ff454c466a9d24d4f765 /libcpp/internal.h | |
parent | d02a0412422b144f6e84605997302a1c36e81600 (diff) | |
download | gcc-b0d11f1ed68727a85280e0ceb83bf77b5385902a.zip gcc-b0d11f1ed68727a85280e0ceb83bf77b5385902a.tar.gz gcc-b0d11f1ed68727a85280e0ceb83bf77b5385902a.tar.bz2 |
[preprocessor] Include stacking
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01971.html
* internal.h (enum include_type): Add IT_MAIN, IT_DIRECTIVE_HWM,
IT_HEADER_HWM.
(_cpp_stack_file): Take include_type, not a bool.
* files.c (_cpp_find_file): Refactor to not hide an if inside a
for conditional.
(should_stack_file): Break apart to ...
(is_known_idempotent_file, has_unique_contents): ... these.
(_cpp_stack_file): Replace IMPORT boolean with include_type enum.
Refactor to use new predicates. Do linemap compensation here ...
(_cpp_stack_include): ... not here.
* init.c (cpp_read_main_file): Pass IT_MAIN to _cpp_stack_file.
From-SVN: r275034
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r-- | libcpp/internal.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h index a86b587..d4768ae 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -123,6 +123,10 @@ enum include_type /* Non-directive including mechanisms. */ IT_CMDLINE, /* -include */ IT_DEFAULT, /* forced header */ + IT_MAIN, /* main */ + + IT_DIRECTIVE_HWM = IT_IMPORT + 1, /* Directives below this. */ + IT_HEADER_HWM = IT_DEFAULT + 1, /* Header files below this. */ }; union utoken @@ -671,8 +675,7 @@ extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *, extern bool _cpp_find_failed (_cpp_file *); extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *); extern void _cpp_fake_include (cpp_reader *, const char *); -extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, bool, - location_t); +extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, include_type, location_t); extern bool _cpp_stack_include (cpp_reader *, const char *, int, enum include_type, location_t); extern int _cpp_compare_file_date (cpp_reader *, const char *, int); |