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
: typed_noop_remove
<const char>
139 typedef const char *value_type
;
140 typedef const char *compare_type
;
142 static inline hashval_t
hash (const char *s
)
144 return htab_hash_string (s
);
147 static inline bool equal (const char *p1
, const char *p2
)
149 return strcmp (p1
, p2
) == 0;
155 // A wrapper for pushdecl that doesn't let gdb have a chance to
156 // instantiate a symbol.
159 pushdecl_safe (tree decl
)
161 void (*save
) (enum c_oracle_request
, tree identifier
);
163 save
= c_binding_oracle
;
164 c_binding_oracle
= NULL
;
166 c_binding_oracle
= save
;
171 struct plugin_context
: public cc1_plugin::connection
173 plugin_context (int fd
);
175 // Map decls to addresses.
176 hash_table
<decl_addr_hasher
> address_map
;
178 // A collection of trees that are preserved for the GC.
179 hash_table
< pointer_hash
<tree_node
> > preserved
;
182 hash_table
<string_hasher
> file_names
;
184 // Perform GC marking.
187 // Preserve a tree during the plugin's operation.
188 tree
preserve (tree t
)
190 tree_node
**slot
= preserved
.find_slot (t
, INSERT
);
195 source_location
get_source_location (const char *filename
,
196 unsigned int line_number
)
198 if (filename
== NULL
)
199 return UNKNOWN_LOCATION
;
201 filename
= intern_filename (filename
);
202 linemap_add (line_table
, LC_ENTER
, false, filename
, line_number
);
203 source_location loc
= linemap_line_start (line_table
, line_number
, 0);
204 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
210 // Add a file name to FILE_NAMES and return the canonical copy.
211 const char *intern_filename (const char *filename
)
213 const char **slot
= file_names
.find_slot (filename
, INSERT
);
216 /* The file name must live as long as the line map, which
217 effectively means as long as this compilation. So, we copy
218 the string here but never free it. */
219 *slot
= xstrdup (filename
);
225 static plugin_context
*current_context
;
229 plugin_context::plugin_context (int fd
)
230 : cc1_plugin::connection (fd
),
238 plugin_context::mark ()
240 for (hash_table
<decl_addr_hasher
>::iterator it
= address_map
.begin ();
241 it
!= address_map
.end ();
244 ggc_mark ((*it
)->decl
);
245 ggc_mark ((*it
)->address
);
248 for (hash_table
< pointer_hash
<tree_node
> >::iterator it
= preserved
.begin ();
249 it
!= preserved
.end ();
255 plugin_binding_oracle (enum c_oracle_request kind
, tree identifier
)
257 enum gcc_c_oracle_request request
;
259 gcc_assert (current_context
!= NULL
);
263 case C_ORACLE_SYMBOL
:
264 request
= GCC_C_ORACLE_SYMBOL
;
267 request
= GCC_C_ORACLE_TAG
;
270 request
= GCC_C_ORACLE_LABEL
;
277 cc1_plugin::call (current_context
, "binding_oracle", &ignore
,
278 request
, IDENTIFIER_POINTER (identifier
));
282 plugin_pragma_user_expression (cpp_reader
*)
284 c_binding_oracle
= plugin_binding_oracle
;
288 plugin_init_extra_pragmas (void *, void *)
290 c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression
);
295 // Maybe rewrite a decl to its address.
297 address_rewriter (tree
*in
, int *walk_subtrees
, void *arg
)
299 plugin_context
*ctx
= (plugin_context
*) arg
;
301 if (!DECL_P (*in
) || DECL_NAME (*in
) == NULL_TREE
)
304 decl_addr_value value
;
306 decl_addr_value
*found_value
= ctx
->address_map
.find (&value
);
307 if (found_value
!= NULL
)
309 // At this point we don't need VLA sizes for gdb-supplied
310 // variables, and having them here confuses later passes, so we
312 if (C_TYPE_VARIABLE_SIZE (TREE_TYPE (*in
)))
315 = build_array_type_nelts (TREE_TYPE (TREE_TYPE (*in
)), 1);
316 DECL_SIZE (*in
) = TYPE_SIZE (TREE_TYPE (*in
));
317 DECL_SIZE_UNIT (*in
) = TYPE_SIZE_UNIT (TREE_TYPE (*in
));
320 else if (DECL_IS_BUILTIN (*in
))
324 if (!cc1_plugin::call (ctx
, "address_oracle", &address
,
325 IDENTIFIER_POINTER (DECL_NAME (*in
))))
330 // Insert the decl into the address map in case it is referenced
332 value
.address
= build_int_cst_type (ptr_type_node
, address
);
333 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
334 gcc_assert (*slot
== NULL
);
336 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
343 if (found_value
->address
!= error_mark_node
)
345 // We have an address for the decl, so rewrite the tree.
346 tree ptr_type
= build_pointer_type (TREE_TYPE (*in
));
347 *in
= fold_build1 (INDIRECT_REF
, TREE_TYPE (*in
),
348 fold_build1 (CONVERT_EXPR
, ptr_type
,
349 found_value
->address
));
357 // When generating code for gdb, we want to be able to use absolute
358 // addresses to refer to otherwise external objects that gdb knows
359 // about. gdb passes in these addresses when building decls, and then
360 // before gimplification we go through the trees, rewriting uses to
361 // the equivalent of "*(TYPE *) ADDR".
363 rewrite_decls_to_addresses (void *function_in
, void *)
365 tree function
= (tree
) function_in
;
367 // Do nothing if we're not in gdb.
368 if (current_context
== NULL
)
371 walk_tree (&DECL_SAVED_TREE (function
), address_rewriter
, current_context
,
378 plugin_build_decl (cc1_plugin::connection
*self
,
380 enum gcc_c_symbol_kind sym_kind
,
381 gcc_type sym_type_in
,
382 const char *substitution_name
,
384 const char *filename
,
385 unsigned int line_number
)
387 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
388 tree identifier
= get_identifier (name
);
391 tree sym_type
= convert_in (sym_type_in
);
395 case GCC_C_SYMBOL_FUNCTION
:
396 code
= FUNCTION_DECL
;
399 case GCC_C_SYMBOL_VARIABLE
:
403 case GCC_C_SYMBOL_TYPEDEF
:
407 case GCC_C_SYMBOL_LABEL
:
408 // FIXME: we aren't ready to handle labels yet.
409 // It isn't clear how to translate them properly
410 // and in any case a "goto" isn't likely to work.
411 return convert_out (error_mark_node
);
417 source_location loc
= ctx
->get_source_location (filename
, line_number
);
419 decl
= build_decl (loc
, code
, identifier
, sym_type
);
420 TREE_USED (decl
) = 1;
421 TREE_ADDRESSABLE (decl
) = 1;
423 if (sym_kind
!= GCC_C_SYMBOL_TYPEDEF
)
425 decl_addr_value value
;
428 if (substitution_name
!= NULL
)
430 // If the translator gave us a name without a binding,
431 // we can just substitute error_mark_node, since we know the
432 // translator will be reporting an error anyhow.
434 = lookup_name (get_identifier (substitution_name
));
435 if (value
.address
== NULL_TREE
)
436 value
.address
= error_mark_node
;
439 value
.address
= build_int_cst_type (ptr_type_node
, address
);
440 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
441 gcc_assert (*slot
== NULL
);
443 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
447 return convert_out (ctx
->preserve (decl
));
451 plugin_bind (cc1_plugin::connection
*,
452 gcc_decl decl_in
, int is_global
)
454 tree decl
= convert_in (decl_in
);
455 c_bind (DECL_SOURCE_LOCATION (decl
), decl
, is_global
);
456 rest_of_decl_compilation (decl
, is_global
, 0);
461 plugin_tagbind (cc1_plugin::connection
*self
,
462 const char *name
, gcc_type tagged_type
,
463 const char *filename
, unsigned int line_number
)
465 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
466 c_pushtag (ctx
->get_source_location (filename
, line_number
),
467 get_identifier (name
), convert_in (tagged_type
));
472 plugin_build_pointer_type (cc1_plugin::connection
*,
475 // No need to preserve a pointer type as the base type is preserved.
476 return convert_out (build_pointer_type (convert_in (base_type
)));
480 plugin_build_record_type (cc1_plugin::connection
*self
)
482 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
483 return convert_out (ctx
->preserve (make_node (RECORD_TYPE
)));
487 plugin_build_union_type (cc1_plugin::connection
*self
)
489 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
490 return convert_out (ctx
->preserve (make_node (UNION_TYPE
)));
494 plugin_build_add_field (cc1_plugin::connection
*,
495 gcc_type record_or_union_type_in
,
496 const char *field_name
,
497 gcc_type field_type_in
,
498 unsigned long bitsize
,
499 unsigned long bitpos
)
501 tree record_or_union_type
= convert_in (record_or_union_type_in
);
502 tree field_type
= convert_in (field_type_in
);
504 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
505 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
507 /* Note that gdb does not preserve the location of field decls, so
508 we can't provide a decent location here. */
509 tree decl
= build_decl (BUILTINS_LOCATION
, FIELD_DECL
,
510 get_identifier (field_name
), field_type
);
511 DECL_FIELD_CONTEXT (decl
) = record_or_union_type
;
513 if (TREE_CODE (field_type
) == INTEGER_TYPE
514 && TYPE_PRECISION (field_type
) != bitsize
)
516 DECL_BIT_FIELD_TYPE (decl
) = field_type
;
518 = c_build_bitfield_integer_type (bitsize
, TYPE_UNSIGNED (field_type
));
521 DECL_MODE (decl
) = TYPE_MODE (TREE_TYPE (decl
));
523 // There's no way to recover this from DWARF.
524 SET_DECL_OFFSET_ALIGN (decl
, TYPE_PRECISION (pointer_sized_int_node
));
526 tree pos
= bitsize_int (bitpos
);
527 pos_from_bit (&DECL_FIELD_OFFSET (decl
), &DECL_FIELD_BIT_OFFSET (decl
),
528 DECL_OFFSET_ALIGN (decl
), pos
);
530 DECL_SIZE (decl
) = bitsize_int (bitsize
);
531 DECL_SIZE_UNIT (decl
) = size_int ((bitsize
+ BITS_PER_UNIT
- 1)
534 DECL_CHAIN (decl
) = TYPE_FIELDS (record_or_union_type
);
535 TYPE_FIELDS (record_or_union_type
) = decl
;
541 plugin_finish_record_or_union (cc1_plugin::connection
*,
542 gcc_type record_or_union_type_in
,
543 unsigned long size_in_bytes
)
545 tree record_or_union_type
= convert_in (record_or_union_type_in
);
547 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
548 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
550 /* We built the field list in reverse order, so fix it now. */
551 TYPE_FIELDS (record_or_union_type
)
552 = nreverse (TYPE_FIELDS (record_or_union_type
));
554 if (TREE_CODE (record_or_union_type
) == UNION_TYPE
)
556 /* Unions can just be handled by the generic code. */
557 layout_type (record_or_union_type
);
561 // FIXME there's no way to get this from DWARF,
562 // or even, it seems, a particularly good way to deduce it.
563 TYPE_ALIGN (record_or_union_type
)
564 = TYPE_PRECISION (pointer_sized_int_node
);
566 TYPE_SIZE (record_or_union_type
) = bitsize_int (size_in_bytes
568 TYPE_SIZE_UNIT (record_or_union_type
) = size_int (size_in_bytes
);
570 compute_record_mode (record_or_union_type
);
571 finish_bitfield_layout (record_or_union_type
);
572 // FIXME we have no idea about TYPE_PACKED
579 plugin_build_enum_type (cc1_plugin::connection
*self
,
580 gcc_type underlying_int_type_in
)
582 tree underlying_int_type
= convert_in (underlying_int_type_in
);
584 if (underlying_int_type
== error_mark_node
)
585 return convert_out (error_mark_node
);
587 tree result
= make_node (ENUMERAL_TYPE
);
589 TYPE_PRECISION (result
) = TYPE_PRECISION (underlying_int_type
);
590 TYPE_UNSIGNED (result
) = TYPE_UNSIGNED (underlying_int_type
);
592 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
593 return convert_out (ctx
->preserve (result
));
597 plugin_build_add_enum_constant (cc1_plugin::connection
*,
598 gcc_type enum_type_in
,
602 tree cst
, decl
, cons
;
603 tree enum_type
= convert_in (enum_type_in
);
605 gcc_assert (TREE_CODE (enum_type
) == ENUMERAL_TYPE
);
607 cst
= build_int_cst (enum_type
, value
);
608 /* Note that gdb does not preserve the location of enum constants,
609 so we can't provide a decent location here. */
610 decl
= build_decl (BUILTINS_LOCATION
, CONST_DECL
,
611 get_identifier (name
), enum_type
);
612 DECL_INITIAL (decl
) = cst
;
613 pushdecl_safe (decl
);
615 cons
= tree_cons (DECL_NAME (decl
), cst
, TYPE_VALUES (enum_type
));
616 TYPE_VALUES (enum_type
) = cons
;
622 plugin_finish_enum_type (cc1_plugin::connection
*,
623 gcc_type enum_type_in
)
625 tree enum_type
= convert_in (enum_type_in
);
626 tree minnode
, maxnode
, iter
;
628 iter
= TYPE_VALUES (enum_type
);
629 minnode
= maxnode
= TREE_VALUE (iter
);
630 for (iter
= TREE_CHAIN (iter
);
632 iter
= TREE_CHAIN (iter
))
634 tree value
= TREE_VALUE (iter
);
635 if (tree_int_cst_lt (maxnode
, value
))
637 if (tree_int_cst_lt (value
, minnode
))
640 TYPE_MIN_VALUE (enum_type
) = minnode
;
641 TYPE_MAX_VALUE (enum_type
) = maxnode
;
643 layout_type (enum_type
);
649 plugin_build_function_type (cc1_plugin::connection
*self
,
650 gcc_type return_type_in
,
651 const struct gcc_type_array
*argument_types_in
,
654 tree
*argument_types
;
655 tree return_type
= convert_in (return_type_in
);
658 argument_types
= new tree
[argument_types_in
->n_elements
];
659 for (int i
= 0; i
< argument_types_in
->n_elements
; ++i
)
660 argument_types
[i
] = convert_in (argument_types_in
->elements
[i
]);
663 result
= build_varargs_function_type_array (return_type
,
664 argument_types_in
->n_elements
,
667 result
= build_function_type_array (return_type
,
668 argument_types_in
->n_elements
,
671 delete[] argument_types
;
673 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
674 return convert_out (ctx
->preserve (result
));
678 plugin_int_type (cc1_plugin::connection
*self
,
679 int is_unsigned
, unsigned long size_in_bytes
)
681 tree result
= c_common_type_for_size (BITS_PER_UNIT
* size_in_bytes
,
683 if (result
== NULL_TREE
)
684 result
= error_mark_node
;
687 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
688 ctx
->preserve (result
);
690 return convert_out (result
);
694 plugin_float_type (cc1_plugin::connection
*,
695 unsigned long size_in_bytes
)
697 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (float_type_node
))
698 return convert_out (float_type_node
);
699 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (double_type_node
))
700 return convert_out (double_type_node
);
701 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (long_double_type_node
))
702 return convert_out (long_double_type_node
);
703 return convert_out (error_mark_node
);
707 plugin_void_type (cc1_plugin::connection
*)
709 return convert_out (void_type_node
);
713 plugin_bool_type (cc1_plugin::connection
*)
715 return convert_out (boolean_type_node
);
719 plugin_build_array_type (cc1_plugin::connection
*self
,
720 gcc_type element_type_in
, int num_elements
)
722 tree element_type
= convert_in (element_type_in
);
725 if (num_elements
== -1)
726 result
= build_array_type (element_type
, NULL_TREE
);
728 result
= build_array_type_nelts (element_type
, num_elements
);
730 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
731 return convert_out (ctx
->preserve (result
));
735 plugin_build_vla_array_type (cc1_plugin::connection
*self
,
736 gcc_type element_type_in
,
737 const char *upper_bound_name
)
739 tree element_type
= convert_in (element_type_in
);
740 tree upper_bound
= lookup_name (get_identifier (upper_bound_name
));
741 tree range
= build_index_type (upper_bound
);
743 tree result
= build_array_type (element_type
, range
);
744 C_TYPE_VARIABLE_SIZE (result
) = 1;
746 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
747 return convert_out (ctx
->preserve (result
));
751 plugin_build_qualified_type (cc1_plugin::connection
*,
752 gcc_type unqualified_type_in
,
753 enum gcc_qualifiers qualifiers
)
755 tree unqualified_type
= convert_in (unqualified_type_in
);
758 if ((qualifiers
& GCC_QUALIFIER_CONST
) != 0)
759 quals
|= TYPE_QUAL_CONST
;
760 if ((qualifiers
& GCC_QUALIFIER_VOLATILE
) != 0)
761 quals
|= TYPE_QUAL_VOLATILE
;
762 if ((qualifiers
& GCC_QUALIFIER_RESTRICT
) != 0)
763 quals
|= TYPE_QUAL_RESTRICT
;
765 return convert_out (build_qualified_type (unqualified_type
, quals
));
769 plugin_build_complex_type (cc1_plugin::connection
*self
,
772 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
773 return convert_out (ctx
->preserve (build_complex_type (convert_in (base_type
))));
777 plugin_build_vector_type (cc1_plugin::connection
*self
,
778 gcc_type base_type
, int nunits
)
780 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
781 return convert_out (ctx
->preserve (build_vector_type (convert_in (base_type
),
786 plugin_build_constant (cc1_plugin::connection
*self
, gcc_type type_in
,
787 const char *name
, unsigned long value
,
788 const char *filename
, unsigned int line_number
)
790 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
792 tree type
= convert_in (type_in
);
794 cst
= build_int_cst (type
, value
);
795 decl
= build_decl (ctx
->get_source_location (filename
, line_number
),
796 CONST_DECL
, get_identifier (name
), type
);
797 DECL_INITIAL (decl
) = cst
;
798 pushdecl_safe (decl
);
804 plugin_error (cc1_plugin::connection
*,
807 error ("%s", message
);
808 return convert_out (error_mark_node
);
813 // Perform GC marking.
816 gc_mark (void *, void *)
818 if (current_context
!= NULL
)
819 current_context
->mark ();
823 #pragma GCC visibility push(default)
827 plugin_init (struct plugin_name_args
*plugin_info
,
828 struct plugin_gcc_version
*)
831 for (int i
= 0; i
< plugin_info
->argc
; ++i
)
833 if (strcmp (plugin_info
->argv
[i
].key
, "fd") == 0)
837 fd
= strtol (plugin_info
->argv
[i
].value
, &tail
, 0);
838 if (*tail
!= '\0' || errno
!= 0)
839 fatal_error (input_location
,
840 "%s: invalid file descriptor argument to plugin",
841 plugin_info
->base_name
);
846 fatal_error (input_location
,
847 "%s: required plugin argument %<fd%> is missing",
848 plugin_info
->base_name
);
850 current_context
= new plugin_context (fd
);
853 cc1_plugin::protocol_int version
;
854 if (!current_context
->require ('H')
855 || ! ::cc1_plugin::unmarshall (current_context
, &version
))
856 fatal_error (input_location
,
857 "%s: handshake failed", plugin_info
->base_name
);
858 if (version
!= GCC_C_FE_VERSION_0
)
859 fatal_error (input_location
,
860 "%s: unknown version in handshake", plugin_info
->base_name
);
862 register_callback (plugin_info
->base_name
, PLUGIN_PRAGMAS
,
863 plugin_init_extra_pragmas
, NULL
);
864 register_callback (plugin_info
->base_name
, PLUGIN_PRE_GENERICIZE
,
865 rewrite_decls_to_addresses
, NULL
);
866 register_callback (plugin_info
->base_name
, PLUGIN_GGC_MARKING
,
869 lang_hooks
.print_error_function
= plugin_print_error_function
;
871 #define GCC_METHOD0(R, N) \
873 cc1_plugin::callback_ftype *fun \
874 = cc1_plugin::callback<R, plugin_ ## N>; \
875 current_context->add_callback (# N, fun); \
877 #define GCC_METHOD1(R, N, A) \
879 cc1_plugin::callback_ftype *fun \
880 = cc1_plugin::callback<R, A, plugin_ ## N>; \
881 current_context->add_callback (# N, fun); \
883 #define GCC_METHOD2(R, N, A, B) \
885 cc1_plugin::callback_ftype *fun \
886 = cc1_plugin::callback<R, A, B, plugin_ ## N>; \
887 current_context->add_callback (# N, fun); \
889 #define GCC_METHOD3(R, N, A, B, C) \
891 cc1_plugin::callback_ftype *fun \
892 = cc1_plugin::callback<R, A, B, C, plugin_ ## N>; \
893 current_context->add_callback (# N, fun); \
895 #define GCC_METHOD4(R, N, A, B, C, D) \
897 cc1_plugin::callback_ftype *fun \
898 = cc1_plugin::callback<R, A, B, C, D, \
900 current_context->add_callback (# N, fun); \
902 #define GCC_METHOD5(R, N, A, B, C, D, E) \
904 cc1_plugin::callback_ftype *fun \
905 = cc1_plugin::callback<R, A, B, C, D, E, \
907 current_context->add_callback (# N, fun); \
909 #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
911 cc1_plugin::callback_ftype *fun \
912 = cc1_plugin::callback<R, A, B, C, D, E, F, G, \
914 current_context->add_callback (# N, fun); \
917 #include "gcc-c-fe.def"