From 8e680db5b64c74ef131f7eb6a50902cf2134f845 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 11 Jun 2010 20:37:34 +0200 Subject: cpplib.h (struct cpp_callbacks): Add user_builtin_macro callback. * include/cpplib.h (struct cpp_callbacks): Add user_builtin_macro callback. (enum cpp_builtin_type): Add BT_FIRST_USER and BT_LAST_USER. (cpp_macro_definition): Remove const qual from second argument. * macro.c (enter_macro_context): Call user_builtin_macro callback for NODE_BUILTIN !NODE_USED macros. (warn_of_redefinition): Likewise. Remove const qual from second argument. (cpp_macro_definition): Likewise. * pch.c (write_macdef, save_macros): Call user_builtin_macro callback for NODE_BUILTIN !NODE_USED macros. * c-family/c-cppbuiltin.c: Include cpp-id-data.h. (lazy_hex_fp_values, lazy_hex_fp_value_count): New variables. (lazy_hex_fp_value): New function. (builtin_define_with_hex_fp_value): Provide definitions lazily. * Makefile.in (c-family/c-cppbuiltin.o): Depend on $(CPP_ID_DATA_H). From-SVN: r160626 --- libcpp/include/cpplib.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libcpp/include') diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index ba79262..87d368e 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -509,6 +509,9 @@ struct cpp_callbacks /* 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 that can change a user builtin into normal macro. */ + bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *); }; #ifdef VMS @@ -599,7 +602,9 @@ enum cpp_builtin_type BT_STDC, /* `__STDC__' */ BT_PRAGMA, /* `_Pragma' operator */ BT_TIMESTAMP, /* `__TIMESTAMP__' */ - BT_COUNTER /* `__COUNTER__' */ + BT_COUNTER, /* `__COUNTER__' */ + BT_FIRST_USER, /* User defined builtin macros. */ + BT_LAST_USER = BT_FIRST_USER + 31 }; #define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE)) @@ -726,7 +731,7 @@ extern const cpp_token *cpp_get_token (cpp_reader *); extern const cpp_token *cpp_get_token_with_location (cpp_reader *, source_location *); extern const unsigned char *cpp_macro_definition (cpp_reader *, - const cpp_hashnode *); + cpp_hashnode *); extern void _cpp_backup_tokens (cpp_reader *, unsigned int); extern const cpp_token *cpp_peek_token (cpp_reader *, int); -- cgit v1.1