diff options
Diffstat (limited to 'support/cpp/libcpp/internal.h')
-rw-r--r-- | support/cpp/libcpp/internal.h | 98 |
1 files changed, 56 insertions, 42 deletions
diff --git a/support/cpp/libcpp/internal.h b/support/cpp/libcpp/internal.h index 0095d9c4a..c280e9729 100644 --- a/support/cpp/libcpp/internal.h +++ b/support/cpp/libcpp/internal.h @@ -37,13 +37,13 @@ along with this program; see the file COPYING3. If not see typedef int iconv_t; /* dummy */ #endif -struct directive; /* Deliberately incomplete. */ +struct directive; /* Deliberately incomplete. */ struct pending_option; struct op; struct _cpp_strbuf; typedef bool (*convert_f) (iconv_t, const unsigned char *, size_t, - struct _cpp_strbuf *); + struct _cpp_strbuf *); struct cset_converter { convert_f func; @@ -91,8 +91,8 @@ struct dummy #define CPP_ALIGN2(size, align) (((size) + ((align) - 1)) & ~((align) - 1)) #define CPP_ALIGN(size) CPP_ALIGN2 (size, DEFAULT_ALIGNMENT) -#define _cpp_mark_macro_used(NODE) do { \ - if ((NODE)->type == NT_MACRO && !((NODE)->flags & NODE_BUILTIN)) \ +#define _cpp_mark_macro_used(NODE) do { \ + if ((NODE)->type == NT_MACRO && !((NODE)->flags & NODE_BUILTIN)) \ (NODE)->value.macro->used = 1; } while (0) /* A generic memory buffer, and operations on it. */ @@ -226,10 +226,10 @@ struct lexer_state /* Special nodes - identifiers with predefined significance. */ struct spec_nodes { - cpp_hashnode *n_defined; /* defined operator */ - cpp_hashnode *n_true; /* C++ keyword true */ - cpp_hashnode *n_false; /* C++ keyword false */ - cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */ + cpp_hashnode *n_defined; /* defined operator */ + cpp_hashnode *n_true; /* C++ keyword true */ + cpp_hashnode *n_false; /* C++ keyword false */ + cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */ /* SDCC _asm specific */ cpp_hashnode *n__asm1; /* _asm ... _endasm ; */ cpp_hashnode *n__asm; /* __asm ... __endasm ; */ @@ -308,6 +308,16 @@ struct cpp_buffer struct cset_converter input_cset_desc; }; +/* The list of saved macros by push_macro pragma. */ +struct def_pragma_macro { + /* Chain element to previous saved macro. */ + struct def_pragma_macro *next; + /* Name of the macro. */ + char *name; + /* The stored macro content. */ + cpp_macro *value; +}; + /* A cpp_reader encapsulates the "state" of a pre-processor run. Applying cpp_get_token repeatedly yields a stream of pre-processor tokens. Usually, there is only one cpp_reader object active. */ @@ -329,9 +339,9 @@ struct cpp_reader source_location directive_line; /* Memory buffers. */ - _cpp_buff *a_buff; /* Aligned permanent storage. */ - _cpp_buff *u_buff; /* Unaligned permanent storage. */ - _cpp_buff *free_buffs; /* Free buffer chain. */ + _cpp_buff *a_buff; /* Aligned permanent storage. */ + _cpp_buff *u_buff; /* Unaligned permanent storage. */ + _cpp_buff *free_buffs; /* Free buffer chain. */ /* Context stack. */ struct cpp_context base_context; @@ -352,9 +362,9 @@ struct cpp_reader bool set_invocation_location; /* Search paths for include files. */ - struct cpp_dir *quote_include; /* "" */ - struct cpp_dir *bracket_include; /* <> */ - struct cpp_dir no_search_path; /* No path. */ + struct cpp_dir *quote_include; /* "" */ + struct cpp_dir *bracket_include; /* <> */ + struct cpp_dir no_search_path; /* No path. */ /* Chain of all hashed _cpp_file instances. */ struct _cpp_file *all_files; @@ -477,6 +487,9 @@ struct cpp_reader /* Table of comments, when state.save_comments is true. */ cpp_comment_table comments; + + /* List of saved macros by push_macro. */ + struct def_pragma_macro *pushed_macros; }; /* Character classes. Based on the more primitive macros in safe-ctype.h. @@ -486,16 +499,16 @@ struct cpp_reader In the unlikely event that characters other than \r and \n enter the set is_vspace, the macro handle_newline() in lex.c must be updated. */ -#define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident)) +#define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident)) -#define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x)) -#define is_numchar(x) ISIDNUM(x) -#define is_idstart(x) (ISIDST(x) || _dollar_ok(x)) -#define is_numstart(x) ISDIGIT(x) -#define is_hspace(x) ISBLANK(x) -#define is_vspace(x) IS_VSPACE(x) -#define is_nvspace(x) IS_NVSPACE(x) -#define is_space(x) IS_SPACE_OR_NUL(x) +#define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x)) +#define is_numchar(x) ISIDNUM(x) +#define is_idstart(x) (ISIDST(x) || _dollar_ok(x)) +#define is_numstart(x) ISDIGIT(x) +#define is_hspace(x) ISBLANK(x) +#define is_vspace(x) IS_VSPACE(x) +#define is_nvspace(x) IS_NVSPACE(x) +#define is_space(x) IS_SPACE_OR_NUL(x) /* This table is constant if it can be initialized at compile time, which is the case if cpp was compiled with GCC >=2.7, or another @@ -529,15 +542,15 @@ extern void _cpp_free_definition (cpp_hashnode *); extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *); extern void _cpp_pop_context (cpp_reader *); extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *, - const unsigned char *, size_t); + const unsigned char *, size_t); extern bool _cpp_save_parameter (cpp_reader *, cpp_macro *, cpp_hashnode *); extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *, - unsigned int); + unsigned int); extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *, - cpp_hashnode *); + cpp_hashnode *); extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *); extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *, - const cpp_token *, unsigned int); + const cpp_token *, unsigned int); extern void _cpp_backup_tokens_direct (cpp_reader *, unsigned int); /* In identifiers.c */ @@ -547,13 +560,13 @@ extern void _cpp_destroy_hashtable (cpp_reader *); /* In files.c */ typedef struct _cpp_file _cpp_file; extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *, - bool, int); + bool, int); 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); extern bool _cpp_stack_include (cpp_reader *, const char *, int, - enum include_type); + enum include_type); extern int _cpp_compare_file_date (cpp_reader *, const char *, int); extern void _cpp_report_missing_guards (cpp_reader *); extern void _cpp_init_files (cpp_reader *); @@ -577,6 +590,7 @@ extern const cpp_token *_cpp_lex_token (cpp_reader *); extern cpp_token *_cpp_lex_direct (cpp_reader *); extern int _cpp_equiv_tokens (const cpp_token *, const cpp_token *); extern void _cpp_init_tokenrun (tokenrun *, unsigned int); +extern cpp_hashnode *_cpp_lex_identifier (cpp_reader *, const char *); /* In init.c. */ extern void _cpp_maybe_push_include_file (cpp_reader *); @@ -591,7 +605,7 @@ extern int _cpp_do__Pragma (cpp_reader *); extern void _cpp_init_directives (cpp_reader *); extern void _cpp_init_internal_pragmas (cpp_reader *); extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *, - linenum_type, unsigned int); + linenum_type, unsigned int); extern void _cpp_pop_buffer (cpp_reader *); /* In directives.c */ @@ -603,19 +617,19 @@ struct _cpp_dir_only_callbacks }; extern void _cpp_preprocess_dir_only (cpp_reader *, - const struct _cpp_dir_only_callbacks *); + const struct _cpp_dir_only_callbacks *); /* In traditional.c. */ extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *); extern bool _cpp_read_logical_line_trad (cpp_reader *); extern void _cpp_overlay_buffer (cpp_reader *pfile, const unsigned char *, - size_t); + size_t); extern void _cpp_remove_overlay (cpp_reader *); extern bool _cpp_create_trad_definition (cpp_reader *, cpp_macro *); extern bool _cpp_expansions_different_trad (const cpp_macro *, - const cpp_macro *); + const cpp_macro *); extern unsigned char *_cpp_copy_replacement_text (const cpp_macro *, - unsigned char *); + unsigned char *); extern size_t _cpp_replacement_text_len (const cpp_macro *); /* In charset.c. */ @@ -624,7 +638,7 @@ extern size_t _cpp_replacement_text_len (const cpp_macro *); It starts initialized to all zeros, and at the end 'level' is the normalization level of the sequence. */ -struct normalize_state +struct normalize_state { /* The previous character. */ cppchar_t previous; @@ -642,16 +656,16 @@ struct normalize_state ((st)->previous = 0, (st)->prev_class = 0) extern cppchar_t _cpp_valid_ucn (cpp_reader *, const unsigned char **, - const unsigned char *, int, - struct normalize_state *state); + const unsigned char *, int, + struct normalize_state *state); extern void _cpp_destroy_iconv (cpp_reader *); extern unsigned char *_cpp_convert_input (cpp_reader *, const char *, - unsigned char *, size_t, size_t, - const unsigned char **, off_t *); + unsigned char *, size_t, size_t, + const unsigned char **, off_t *); extern const char *_cpp_default_encoding (void); extern cpp_hashnode * _cpp_interpret_identifier (cpp_reader *pfile, - const unsigned char *id, - size_t len); + const unsigned char *id, + size_t len); /* Utility routines and macros. */ #define DSC(str) (const unsigned char *)str, sizeof str - 1 @@ -660,7 +674,7 @@ extern cpp_hashnode * _cpp_interpret_identifier (cpp_reader *pfile, checking. */ static inline int ustrcmp (const unsigned char *, const unsigned char *); static inline int ustrncmp (const unsigned char *, const unsigned char *, - size_t); + size_t); static inline size_t ustrlen (const unsigned char *); static inline unsigned char *uxstrdup (const unsigned char *); static inline unsigned char *ustrchr (const unsigned char *, int); |