/* Call backs to cpplib client. */ struct cpp_callbacks { /* Called when a new line of preprocessed output is started. */ void (*line_change) (cpp_reader *, const cpp_token *, int);
/* Called when switching to/from a new file. The line_map is for the new file. It is NULL if there is no new file. (In C this happens when done with <built-in>+<command line> and also when done with a main file.) This can be used for resource cleanup. */ void (*file_change) (cpp_reader *, const line_map_ordinary *);
void (*dir_change) (cpp_reader *, const char *); void (*include) (cpp_reader *, source_location, const unsigned char *, const char *, int, const cpp_token **); void (*define) (cpp_reader *, source_location, cpp_hashnode *); void (*undef) (cpp_reader *, source_location, cpp_hashnode *); void (*ident) (cpp_reader *, source_location, const cpp_string *); void (*def_pragma) (cpp_reader *, source_location); int (*valid_pch) (cpp_reader *, const char *, int); void (*read_pch) (cpp_reader *, const char *, int, const char *); missing_header_cb missing_header;
/* Context-sensitive macro support. Returns macro (if any) that should be expanded. */ cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *);
/* Called to emit a diagnostic. This callback receives the translated message. */ bool (*error) (cpp_reader *, int, int, rich_location *, const char *, va_list *) ATTRIBUTE_FPTR_PRINTF(5,0);
/* Callbacks for when a macro is expanded, or tested (whether defined or not at the time) in #ifdef, #ifndef or "defined". */ void (*used_define) (cpp_reader *, source_location, cpp_hashnode *); void (*used_undef) (cpp_reader *, source_location, cpp_hashnode *); /* Called before #define and #undef or other macro definition changes are processed. */ void (*before_define) (cpp_reader *); /* Called whenever a macro is expanded or tested. Second argument is the location of the start of the current expansion. */ void (*used) (cpp_reader *, source_location, cpp_hashnode *);
/* Callback to identify whether an attribute exists. */ int (*has_attribute) (cpp_reader *);
/* Callback that can change a user builtin into normal macro. */ bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *); };
GCC主要数据结构之cpp_callbacks
最新推荐文章于 2021-05-19 07:41:02 发布