aboutsummaryrefslogtreecommitdiff
path: root/libcpp/pch.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-06-11 20:37:34 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-06-11 20:37:34 +0200
commit8e680db5b64c74ef131f7eb6a50902cf2134f845 (patch)
tree202ae75e58b19cf2da840d299ec67598a6eef33b /libcpp/pch.c
parent7b14477e384de8841d377e3c3254f9f3bcc9aecb (diff)
downloadgcc-8e680db5b64c74ef131f7eb6a50902cf2134f845.zip
gcc-8e680db5b64c74ef131f7eb6a50902cf2134f845.tar.gz
gcc-8e680db5b64c74ef131f7eb6a50902cf2134f845.tar.bz2
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
Diffstat (limited to 'libcpp/pch.c')
-rw-r--r--libcpp/pch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libcpp/pch.c b/libcpp/pch.c
index 2fb7ba5..a6d8cea 100644
--- a/libcpp/pch.c
+++ b/libcpp/pch.c
@@ -58,7 +58,9 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
return 1;
case NT_MACRO:
- if ((hn->flags & NODE_BUILTIN))
+ if ((hn->flags & NODE_BUILTIN)
+ && (!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, hn)))
return 1;
{
@@ -759,6 +761,12 @@ static int
save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p)
{
struct save_macro_data *data = (struct save_macro_data *)data_p;
+
+ if ((h->flags & NODE_BUILTIN)
+ && h->type == NT_MACRO
+ && r->cb.user_builtin_macro)
+ r->cb.user_builtin_macro (r, h);
+
if (h->type != NT_VOID
&& (h->flags & NODE_BUILTIN) == 0)
{