1 /* Library interface to C front end
2 Copyright (C) 2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #include <cc1plugin-config.h>
24 #undef PACKAGE_TARNAME
25 #undef PACKAGE_VERSION
27 #include "../gcc/config.h"
31 #undef PACKAGE_TARNAME
32 #undef PACKAGE_VERSION
34 #include "gcc-plugin.h"
36 #include "coretypes.h"
37 #include "stringpool.h"
39 #include "gcc-interface.h"
43 #include "double-int.h"
51 #include "fold-const.h"
52 #include "stor-layout.h"
56 #include "hash-table.h"
58 #include "c-family/c-pragma.h"
60 #include "diagnostic.h"
61 #include "langhooks.h"
62 #include "langhooks-def.h"
64 #include "callbacks.hh"
65 #include "connection.hh"
69 #pragma GCC visibility push(default)
71 int plugin_is_GPL_compatible
;
73 #pragma GCC visibility pop
78 // This is put into the lang hooks when the plugin starts.
81 plugin_print_error_function (diagnostic_context
*context
, const char *file
,
82 diagnostic_info
*diagnostic
)
84 if (current_function_decl
!= NULL_TREE
85 && DECL_NAME (current_function_decl
) != NULL_TREE
86 && strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl
)),
87 GCC_FE_WRAPPER_FUNCTION
) == 0)
89 lhd_print_error_function (context
, file
, diagnostic
);
94 static unsigned long long
97 return (unsigned long long) (uintptr_t) t
;
101 convert_in (unsigned long long v
)
103 return (tree
) (uintptr_t) v
;
108 struct decl_addr_value
114 struct decl_addr_hasher
: typed_free_remove
<decl_addr_value
>
116 typedef decl_addr_value
*value_type
;
117 typedef decl_addr_value
*compare_type
;
119 static inline hashval_t
hash (const decl_addr_value
*);
120 static inline bool equal (const decl_addr_value
*, const decl_addr_value
*);
124 decl_addr_hasher::hash (const decl_addr_value
*e
)
126 return IDENTIFIER_HASH_VALUE (DECL_NAME (e
->decl
));
130 decl_addr_hasher::equal (const decl_addr_value
*p1
, const decl_addr_value
*p2
)
132 return p1
->decl
== p2
->decl
;
137 struct string_hasher
: nofree_ptr_hash
<const char>
139 static inline hashval_t
hash (const char *s
)
141 return htab_hash_string (s
);
144 static inline bool equal (const char *p1
, const char *p2
)
146 return strcmp (p1
, p2
) == 0;
152 // A wrapper for pushdecl that doesn't let gdb have a chance to
153 // instantiate a symbol.
156 pushdecl_safe (tree decl
)
158 void (*save
) (enum c_oracle_request
, tree identifier
);
160 save
= c_binding_oracle
;
161 c_binding_oracle
= NULL
;
163 c_binding_oracle
= save
;
168 struct plugin_context
: public cc1_plugin::connection
170 plugin_context (int fd
);
172 // Map decls to addresses.
173 hash_table
<decl_addr_hasher
> address_map
;
175 // A collection of trees that are preserved for the GC.
176 hash_table
< nofree_ptr_hash
<tree_node
> > preserved
;
179 hash_table
<string_hasher
> file_names
;
181 // Perform GC marking.
184 // Preserve a tree during the plugin's operation.
185 tree
preserve (tree t
)
187 tree_node
**slot
= preserved
.find_slot (t
, INSERT
);
192 source_location
get_source_location (const char *filename
,
193 unsigned int line_number
)
195 if (filename
== NULL
)
196 return UNKNOWN_LOCATION
;
198 filename
= intern_filename (filename
);
199 linemap_add (line_table
, LC_ENTER
, false, filename
, line_number
);
200 source_location loc
= linemap_line_start (line_table
, line_number
, 0);
201 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
207 // Add a file name to FILE_NAMES and return the canonical copy.
208 const char *intern_filename (const char *filename
)
210 const char **slot
= file_names
.find_slot (filename
, INSERT
);
213 /* The file name must live as long as the line map, which
214 effectively means as long as this compilation. So, we copy
215 the string here but never free it. */
216 *slot
= xstrdup (filename
);
222 static plugin_context
*current_context
;
226 plugin_context::plugin_context (int fd
)
227 : cc1_plugin::connection (fd
),
235 plugin_context::mark ()
237 for (hash_table
<decl_addr_hasher
>::iterator it
= address_map
.begin ();
238 it
!= address_map
.end ();
241 ggc_mark ((*it
)->decl
);
242 ggc_mark ((*it
)->address
);
245 for (hash_table
< nofree_ptr_hash
<tree_node
> >::iterator
246 it
= preserved
.begin (); it
!= preserved
.end (); ++it
)
251 plugin_binding_oracle (enum c_oracle_request kind
, tree identifier
)
253 enum gcc_c_oracle_request request
;
255 gcc_assert (current_context
!= NULL
);
259 case C_ORACLE_SYMBOL
:
260 request
= GCC_C_ORACLE_SYMBOL
;
263 request
= GCC_C_ORACLE_TAG
;
266 request
= GCC_C_ORACLE_LABEL
;
273 cc1_plugin::call (current_context
, "binding_oracle", &ignore
,
274 request
, IDENTIFIER_POINTER (identifier
));
278 plugin_pragma_user_expression (cpp_reader
*)
280 c_binding_oracle
= plugin_binding_oracle
;
284 plugin_init_extra_pragmas (void *, void *)
286 c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression
);
291 // Maybe rewrite a decl to its address.
293 address_rewriter (tree
*in
, int *walk_subtrees
, void *arg
)
295 plugin_context
*ctx
= (plugin_context
*) arg
;
297 if (!DECL_P (*in
) || DECL_NAME (*in
) == NULL_TREE
)
300 decl_addr_value value
;
302 decl_addr_value
*found_value
= ctx
->address_map
.find (&value
);
303 if (found_value
!= NULL
)
305 // At this point we don't need VLA sizes for gdb-supplied
306 // variables, and having them here confuses later passes, so we
308 if (C_TYPE_VARIABLE_SIZE (TREE_TYPE (*in
)))
311 = build_array_type_nelts (TREE_TYPE (TREE_TYPE (*in
)), 1);
312 DECL_SIZE (*in
) = TYPE_SIZE (TREE_TYPE (*in
));
313 DECL_SIZE_UNIT (*in
) = TYPE_SIZE_UNIT (TREE_TYPE (*in
));
316 else if (DECL_IS_BUILTIN (*in
))
320 if (!cc1_plugin::call (ctx
, "address_oracle", &address
,
321 IDENTIFIER_POINTER (DECL_NAME (*in
))))
326 // Insert the decl into the address map in case it is referenced
328 value
.address
= build_int_cst_type (ptr_type_node
, address
);
329 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
330 gcc_assert (*slot
== NULL
);
332 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
339 if (found_value
->address
!= error_mark_node
)
341 // We have an address for the decl, so rewrite the tree.
342 tree ptr_type
= build_pointer_type (TREE_TYPE (*in
));
343 *in
= fold_build1 (INDIRECT_REF
, TREE_TYPE (*in
),
344 fold_build1 (CONVERT_EXPR
, ptr_type
,
345 found_value
->address
));
353 // When generating code for gdb, we want to be able to use absolute
354 // addresses to refer to otherwise external objects that gdb knows
355 // about. gdb passes in these addresses when building decls, and then
356 // before gimplification we go through the trees, rewriting uses to
357 // the equivalent of "*(TYPE *) ADDR".
359 rewrite_decls_to_addresses (void *function_in
, void *)
361 tree function
= (tree
) function_in
;
363 // Do nothing if we're not in gdb.
364 if (current_context
== NULL
)
367 walk_tree (&DECL_SAVED_TREE (function
), address_rewriter
, current_context
,
374 plugin_build_decl (cc1_plugin::connection
*self
,
376 enum gcc_c_symbol_kind sym_kind
,
377 gcc_type sym_type_in
,
378 const char *substitution_name
,
380 const char *filename
,
381 unsigned int line_number
)
383 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
384 tree identifier
= get_identifier (name
);
387 tree sym_type
= convert_in (sym_type_in
);
391 case GCC_C_SYMBOL_FUNCTION
:
392 code
= FUNCTION_DECL
;
395 case GCC_C_SYMBOL_VARIABLE
:
399 case GCC_C_SYMBOL_TYPEDEF
:
403 case GCC_C_SYMBOL_LABEL
:
404 // FIXME: we aren't ready to handle labels yet.
405 // It isn't clear how to translate them properly
406 // and in any case a "goto" isn't likely to work.
407 return convert_out (error_mark_node
);
413 source_location loc
= ctx
->get_source_location (filename
, line_number
);
415 decl
= build_decl (loc
, code
, identifier
, sym_type
);
416 TREE_USED (decl
) = 1;
417 TREE_ADDRESSABLE (decl
) = 1;
419 if (sym_kind
!= GCC_C_SYMBOL_TYPEDEF
)
421 decl_addr_value value
;
424 if (substitution_name
!= NULL
)
426 // If the translator gave us a name without a binding,
427 // we can just substitute error_mark_node, since we know the
428 // translator will be reporting an error anyhow.
430 = lookup_name (get_identifier (substitution_name
));
431 if (value
.address
== NULL_TREE
)
432 value
.address
= error_mark_node
;
435 value
.address
= build_int_cst_type (ptr_type_node
, address
);
436 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
437 gcc_assert (*slot
== NULL
);
439 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
443 return convert_out (ctx
->preserve (decl
));
447 plugin_bind (cc1_plugin::connection
*,
448 gcc_decl decl_in
, int is_global
)
450 tree decl
= convert_in (decl_in
);
451 c_bind (DECL_SOURCE_LOCATION (decl
), decl
, is_global
);
452 rest_of_decl_compilation (decl
, is_global
, 0);
457 plugin_tagbind (cc1_plugin::connection
*self
,
458 const char *name
, gcc_type tagged_type
,
459 const char *filename
, unsigned int line_number
)
461 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
462 c_pushtag (ctx
->get_source_location (filename
, line_number
),
463 get_identifier (name
), convert_in (tagged_type
));
468 plugin_build_pointer_type (cc1_plugin::connection
*,
471 // No need to preserve a pointer type as the base type is preserved.
472 return convert_out (build_pointer_type (convert_in (base_type
)));
476 plugin_build_record_type (cc1_plugin::connection
*self
)
478 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
479 return convert_out (ctx
->preserve (make_node (RECORD_TYPE
)));
483 plugin_build_union_type (cc1_plugin::connection
*self
)
485 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
486 return convert_out (ctx
->preserve (make_node (UNION_TYPE
)));
490 plugin_build_add_field (cc1_plugin::connection
*,
491 gcc_type record_or_union_type_in
,
492 const char *field_name
,
493 gcc_type field_type_in
,
494 unsigned long bitsize
,
495 unsigned long bitpos
)
497 tree record_or_union_type
= convert_in (record_or_union_type_in
);
498 tree field_type
= convert_in (field_type_in
);
500 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
501 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
503 /* Note that gdb does not preserve the location of field decls, so
504 we can't provide a decent location here. */
505 tree decl
= build_decl (BUILTINS_LOCATION
, FIELD_DECL
,
506 get_identifier (field_name
), field_type
);
507 DECL_FIELD_CONTEXT (decl
) = record_or_union_type
;
509 if (TREE_CODE (field_type
) == INTEGER_TYPE
510 && TYPE_PRECISION (field_type
) != bitsize
)
512 DECL_BIT_FIELD_TYPE (decl
) = field_type
;
514 = c_build_bitfield_integer_type (bitsize
, TYPE_UNSIGNED (field_type
));
517 DECL_MODE (decl
) = TYPE_MODE (TREE_TYPE (decl
));
519 // There's no way to recover this from DWARF.
520 SET_DECL_OFFSET_ALIGN (decl
, TYPE_PRECISION (pointer_sized_int_node
));
522 tree pos
= bitsize_int (bitpos
);
523 pos_from_bit (&DECL_FIELD_OFFSET (decl
), &DECL_FIELD_BIT_OFFSET (decl
),
524 DECL_OFFSET_ALIGN (decl
), pos
);
526 DECL_SIZE (decl
) = bitsize_int (bitsize
);
527 DECL_SIZE_UNIT (decl
) = size_int ((bitsize
+ BITS_PER_UNIT
- 1)
530 DECL_CHAIN (decl
) = TYPE_FIELDS (record_or_union_type
);
531 TYPE_FIELDS (record_or_union_type
) = decl
;
537 plugin_finish_record_or_union (cc1_plugin::connection
*,
538 gcc_type record_or_union_type_in
,
539 unsigned long size_in_bytes
)
541 tree record_or_union_type
= convert_in (record_or_union_type_in
);
543 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
544 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
546 /* We built the field list in reverse order, so fix it now. */
547 TYPE_FIELDS (record_or_union_type
)
548 = nreverse (TYPE_FIELDS (record_or_union_type
));
550 if (TREE_CODE (record_or_union_type
) == UNION_TYPE
)
552 /* Unions can just be handled by the generic code. */
553 layout_type (record_or_union_type
);
557 // FIXME there's no way to get this from DWARF,
558 // or even, it seems, a particularly good way to deduce it.
559 TYPE_ALIGN (record_or_union_type
)
560 = TYPE_PRECISION (pointer_sized_int_node
);
562 TYPE_SIZE (record_or_union_type
) = bitsize_int (size_in_bytes
564 TYPE_SIZE_UNIT (record_or_union_type
) = size_int (size_in_bytes
);
566 compute_record_mode (record_or_union_type
);
567 finish_bitfield_layout (record_or_union_type
);
568 // FIXME we have no idea about TYPE_PACKED
575 plugin_build_enum_type (cc1_plugin::connection
*self
,
576 gcc_type underlying_int_type_in
)
578 tree underlying_int_type
= convert_in (underlying_int_type_in
);
580 if (underlying_int_type
== error_mark_node
)
581 return convert_out (error_mark_node
);
583 tree result
= make_node (ENUMERAL_TYPE
);
585 TYPE_PRECISION (result
) = TYPE_PRECISION (underlying_int_type
);
586 TYPE_UNSIGNED (result
) = TYPE_UNSIGNED (underlying_int_type
);
588 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
589 return convert_out (ctx
->preserve (result
));
593 plugin_build_add_enum_constant (cc1_plugin::connection
*,
594 gcc_type enum_type_in
,
598 tree cst
, decl
, cons
;
599 tree enum_type
= convert_in (enum_type_in
);
601 gcc_assert (TREE_CODE (enum_type
) == ENUMERAL_TYPE
);
603 cst
= build_int_cst (enum_type
, value
);
604 /* Note that gdb does not preserve the location of enum constants,
605 so we can't provide a decent location here. */
606 decl
= build_decl (BUILTINS_LOCATION
, CONST_DECL
,
607 get_identifier (name
), enum_type
);
608 DECL_INITIAL (decl
) = cst
;
609 pushdecl_safe (decl
);
611 cons
= tree_cons (DECL_NAME (decl
), cst
, TYPE_VALUES (enum_type
));
612 TYPE_VALUES (enum_type
) = cons
;
618 plugin_finish_enum_type (cc1_plugin::connection
*,
619 gcc_type enum_type_in
)
621 tree enum_type
= convert_in (enum_type_in
);
622 tree minnode
, maxnode
, iter
;
624 iter
= TYPE_VALUES (enum_type
);
625 minnode
= maxnode
= TREE_VALUE (iter
);
626 for (iter
= TREE_CHAIN (iter
);
628 iter
= TREE_CHAIN (iter
))
630 tree value
= TREE_VALUE (iter
);
631 if (tree_int_cst_lt (maxnode
, value
))
633 if (tree_int_cst_lt (value
, minnode
))
636 TYPE_MIN_VALUE (enum_type
) = minnode
;
637 TYPE_MAX_VALUE (enum_type
) = maxnode
;
639 layout_type (enum_type
);
645 plugin_build_function_type (cc1_plugin::connection
*self
,
646 gcc_type return_type_in
,
647 const struct gcc_type_array
*argument_types_in
,
650 tree
*argument_types
;
651 tree return_type
= convert_in (return_type_in
);
654 argument_types
= new tree
[argument_types_in
->n_elements
];
655 for (int i
= 0; i
< argument_types_in
->n_elements
; ++i
)
656 argument_types
[i
] = convert_in (argument_types_in
->elements
[i
]);
659 result
= build_varargs_function_type_array (return_type
,
660 argument_types_in
->n_elements
,
663 result
= build_function_type_array (return_type
,
664 argument_types_in
->n_elements
,
667 delete[] argument_types
;
669 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
670 return convert_out (ctx
->preserve (result
));
674 plugin_int_type (cc1_plugin::connection
*self
,
675 int is_unsigned
, unsigned long size_in_bytes
)
677 tree result
= c_common_type_for_size (BITS_PER_UNIT
* size_in_bytes
,
679 if (result
== NULL_TREE
)
680 result
= error_mark_node
;
683 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
684 ctx
->preserve (result
);
686 return convert_out (result
);
690 plugin_float_type (cc1_plugin::connection
*,
691 unsigned long size_in_bytes
)
693 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (float_type_node
))
694 return convert_out (float_type_node
);
695 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (double_type_node
))
696 return convert_out (double_type_node
);
697 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (long_double_type_node
))
698 return convert_out (long_double_type_node
);
699 return convert_out (error_mark_node
);
703 plugin_void_type (cc1_plugin::connection
*)
705 return convert_out (void_type_node
);
709 plugin_bool_type (cc1_plugin::connection
*)
711 return convert_out (boolean_type_node
);
715 plugin_build_array_type (cc1_plugin::connection
*self
,
716 gcc_type element_type_in
, int num_elements
)
718 tree element_type
= convert_in (element_type_in
);
721 if (num_elements
== -1)
722 result
= build_array_type (element_type
, NULL_TREE
);
724 result
= build_array_type_nelts (element_type
, num_elements
);
726 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
727 return convert_out (ctx
->preserve (result
));
731 plugin_build_vla_array_type (cc1_plugin::connection
*self
,
732 gcc_type element_type_in
,
733 const char *upper_bound_name
)
735 tree element_type
= convert_in (element_type_in
);
736 tree upper_bound
= lookup_name (get_identifier (upper_bound_name
));
737 tree range
= build_index_type (upper_bound
);
739 tree result
= build_array_type (element_type
, range
);
740 C_TYPE_VARIABLE_SIZE (result
) = 1;
742 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
743 return convert_out (ctx
->preserve (result
));
747 plugin_build_qualified_type (cc1_plugin::connection
*,
748 gcc_type unqualified_type_in
,
749 enum gcc_qualifiers qualifiers
)
751 tree unqualified_type
= convert_in (unqualified_type_in
);
754 if ((qualifiers
& GCC_QUALIFIER_CONST
) != 0)
755 quals
|= TYPE_QUAL_CONST
;
756 if ((qualifiers
& GCC_QUALIFIER_VOLATILE
) != 0)
757 quals
|= TYPE_QUAL_VOLATILE
;
758 if ((qualifiers
& GCC_QUALIFIER_RESTRICT
) != 0)
759 quals
|= TYPE_QUAL_RESTRICT
;
761 return convert_out (build_qualified_type (unqualified_type
, quals
));
765 plugin_build_complex_type (cc1_plugin::connection
*self
,
768 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
769 return convert_out (ctx
->preserve (build_complex_type (convert_in (base_type
))));
773 plugin_build_vector_type (cc1_plugin::connection
*self
,
774 gcc_type base_type
, int nunits
)
776 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
777 return convert_out (ctx
->preserve (build_vector_type (convert_in (base_type
),
782 plugin_build_constant (cc1_plugin::connection
*self
, gcc_type type_in
,
783 const char *name
, unsigned long value
,
784 const char *filename
, unsigned int line_number
)
786 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
788 tree type
= convert_in (type_in
);
790 cst
= build_int_cst (type
, value
);
791 decl
= build_decl (ctx
->get_source_location (filename
, line_number
),
792 CONST_DECL
, get_identifier (name
), type
);
793 DECL_INITIAL (decl
) = cst
;
794 pushdecl_safe (decl
);
800 plugin_error (cc1_plugin::connection
*,
803 error ("%s", message
);
804 return convert_out (error_mark_node
);
809 // Perform GC marking.
812 gc_mark (void *, void *)
814 if (current_context
!= NULL
)
815 current_context
->mark ();
819 #pragma GCC visibility push(default)
823 plugin_init (struct plugin_name_args
*plugin_info
,
824 struct plugin_gcc_version
*)
827 for (int i
= 0; i
< plugin_info
->argc
; ++i
)
829 if (strcmp (plugin_info
->argv
[i
].key
, "fd") == 0)
833 fd
= strtol (plugin_info
->argv
[i
].value
, &tail
, 0);
834 if (*tail
!= '\0' || errno
!= 0)
835 fatal_error (input_location
,
836 "%s: invalid file descriptor argument to plugin",
837 plugin_info
->base_name
);
842 fatal_error (input_location
,
843 "%s: required plugin argument %<fd%> is missing",
844 plugin_info
->base_name
);
846 current_context
= new plugin_context (fd
);
849 cc1_plugin::protocol_int version
;
850 if (!current_context
->require ('H')
851 || ! ::cc1_plugin::unmarshall (current_context
, &version
))
852 fatal_error (input_location
,
853 "%s: handshake failed", plugin_info
->base_name
);
854 if (version
!= GCC_C_FE_VERSION_0
)
855 fatal_error (input_location
,
856 "%s: unknown version in handshake", plugin_info
->base_name
);
858 register_callback (plugin_info
->base_name
, PLUGIN_PRAGMAS
,
859 plugin_init_extra_pragmas
, NULL
);
860 register_callback (plugin_info
->base_name
, PLUGIN_PRE_GENERICIZE
,
861 rewrite_decls_to_addresses
, NULL
);
862 register_callback (plugin_info
->base_name
, PLUGIN_GGC_MARKING
,
865 lang_hooks
.print_error_function
= plugin_print_error_function
;
867 #define GCC_METHOD0(R, N) \
869 cc1_plugin::callback_ftype *fun \
870 = cc1_plugin::callback<R, plugin_ ## N>; \
871 current_context->add_callback (# N, fun); \
873 #define GCC_METHOD1(R, N, A) \
875 cc1_plugin::callback_ftype *fun \
876 = cc1_plugin::callback<R, A, plugin_ ## N>; \
877 current_context->add_callback (# N, fun); \
879 #define GCC_METHOD2(R, N, A, B) \
881 cc1_plugin::callback_ftype *fun \
882 = cc1_plugin::callback<R, A, B, plugin_ ## N>; \
883 current_context->add_callback (# N, fun); \
885 #define GCC_METHOD3(R, N, A, B, C) \
887 cc1_plugin::callback_ftype *fun \
888 = cc1_plugin::callback<R, A, B, C, plugin_ ## N>; \
889 current_context->add_callback (# N, fun); \
891 #define GCC_METHOD4(R, N, A, B, C, D) \
893 cc1_plugin::callback_ftype *fun \
894 = cc1_plugin::callback<R, A, B, C, D, \
896 current_context->add_callback (# N, fun); \
898 #define GCC_METHOD5(R, N, A, B, C, D, E) \
900 cc1_plugin::callback_ftype *fun \
901 = cc1_plugin::callback<R, A, B, C, D, E, \
903 current_context->add_callback (# N, fun); \
905 #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
907 cc1_plugin::callback_ftype *fun \
908 = cc1_plugin::callback<R, A, B, C, D, E, F, G, \
910 current_context->add_callback (# N, fun); \
913 #include "gcc-c-fe.def"