diff options
author | Nathan Sidwell <nathan@acm.org> | 2019-08-28 18:43:37 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2019-08-28 18:43:37 +0000 |
commit | a0be978a8216b58562c8eff71df977aca7d78387 (patch) | |
tree | 434fe4e0a9b38aaa633dacf3381e0bd4c8049022 /libcpp/internal.h | |
parent | fc4f90f0c8eca75fb90c736476360584f68d7ef9 (diff) | |
download | gcc-a0be978a8216b58562c8eff71df977aca7d78387.zip gcc-a0be978a8216b58562c8eff71df977aca7d78387.tar.gz gcc-a0be978a8216b58562c8eff71df977aca7d78387.tar.bz2 |
[Preprocessor] small cleanups
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01904.html
* directives-only.c (_cpp_preprocess_dir_only): Use false, not
zero for _cpp_handle_directive call.
* directives.c (_cpp_handle_directive): Indented is bool.
* files.c (struct _cpp_file): Make bools 1 bit bitfields.
* internal.h (enum include_type): Reformat and comment.
(struct cpp_buffer): Make flags 1 bit bitfields.
(_cpp_handle_directive): Indented is bool.
From-SVN: r274999
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r-- | libcpp/internal.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h index 45167a9..a86b587 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -113,7 +113,17 @@ extern unsigned char *_cpp_unaligned_alloc (cpp_reader *, size_t); #define BUFF_LIMIT(BUFF) ((BUFF)->limit) /* #include types. */ -enum include_type {IT_INCLUDE, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE, IT_DEFAULT}; +enum include_type + { + /* Directive-based including mechanisms. */ + IT_INCLUDE, /* #include */ + IT_INCLUDE_NEXT, /* #include_next */ + IT_IMPORT, /* #import */ + + /* Non-directive including mechanisms. */ + IT_CMDLINE, /* -include */ + IT_DEFAULT, /* forced header */ + }; union utoken { @@ -327,23 +337,23 @@ struct cpp_buffer struct if_stack *if_stack; /* True if we need to get the next clean line. */ - bool need_line; + bool need_line : 1; /* True if we have already warned about C++ comments in this file. The warning happens only for C89 extended mode with -pedantic on, or for -Wtraditional, and only once per file (otherwise it would be far too noisy). */ - unsigned int warned_cplusplus_comments : 1; + bool warned_cplusplus_comments : 1; /* True if we don't process trigraphs and escaped newlines. True for preprocessed input, command line directives, and _Pragma buffers. */ - unsigned int from_stage3 : 1; + bool from_stage3 : 1; /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is true, a CPP_EOF token is then returned. Otherwise, the next token from the enclosing buffer is returned. */ - unsigned int return_at_eof : 1; + bool return_at_eof : 1; /* One for a system header, two for a C system header file that therefore needs to be extern "C" protected in C++, and zero otherwise. */ @@ -419,13 +429,13 @@ struct cpp_reader /* This is the node representing the macro being expanded at top-level. The value of this data member is valid iff - in_macro_expansion_p() returns TRUE. */ + cpp_in_macro_expansion_p() returns TRUE. */ cpp_hashnode *top_most_macro_node; /* Nonzero if we are about to expand a macro. Note that if we are really expanding a macro, the function macro_of_context returns the macro being expanded and this flag is set to false. Client - code should use the function in_macro_expansion_p to know if we + code should use the function cpp_in_macro_expansion_p to know if we are either about to expand a macro, or are actually expanding one. */ bool about_to_expand_macro_p; @@ -711,7 +721,7 @@ extern const char *cpp_named_operator2name (enum cpp_ttype type); /* In directives.c */ extern int _cpp_test_assertion (cpp_reader *, unsigned int *); -extern int _cpp_handle_directive (cpp_reader *, int); +extern int _cpp_handle_directive (cpp_reader *, bool); extern void _cpp_define_builtin (cpp_reader *, const char *); extern char ** _cpp_save_pragma_names (cpp_reader *); extern void _cpp_restore_pragma_names (cpp_reader *, char **); |