1 /* Library interface to C front end
2 Copyright (C) 2014-2016 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
: free_ptr_hash
<decl_addr_value
>
116 static inline hashval_t
hash (const decl_addr_value
*);
117 static inline bool equal (const decl_addr_value
*, const decl_addr_value
*);
121 decl_addr_hasher::hash (const decl_addr_value
*e
)
123 return IDENTIFIER_HASH_VALUE (DECL_NAME (e
->decl
));
127 decl_addr_hasher::equal (const decl_addr_value
*p1
, const decl_addr_value
*p2
)
129 return p1
->decl
== p2
->decl
;
134 struct string_hasher
: nofree_ptr_hash
<const char>
136 static inline hashval_t
hash (const char *s
)
138 return htab_hash_string (s
);
141 static inline bool equal (const char *p1
, const char *p2
)
143 return strcmp (p1
, p2
) == 0;
149 // A wrapper for pushdecl that doesn't let gdb have a chance to
150 // instantiate a symbol.
153 pushdecl_safe (tree decl
)
155 void (*save
) (enum c_oracle_request
, tree identifier
);
157 save
= c_binding_oracle
;
158 c_binding_oracle
= NULL
;
160 c_binding_oracle
= save
;
165 struct plugin_context
: public cc1_plugin::connection
167 plugin_context (int fd
);
169 // Map decls to addresses.
170 hash_table
<decl_addr_hasher
> address_map
;
172 // A collection of trees that are preserved for the GC.
173 hash_table
< nofree_ptr_hash
<tree_node
> > preserved
;
176 hash_table
<string_hasher
> file_names
;
178 // Perform GC marking.
181 // Preserve a tree during the plugin's operation.
182 tree
preserve (tree t
)
184 tree_node
**slot
= preserved
.find_slot (t
, INSERT
);
189 source_location
get_source_location (const char *filename
,
190 unsigned int line_number
)
192 if (filename
== NULL
)
193 return UNKNOWN_LOCATION
;
195 filename
= intern_filename (filename
);
196 linemap_add (line_table
, LC_ENTER
, false, filename
, line_number
);
197 source_location loc
= linemap_line_start (line_table
, line_number
, 0);
198 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
204 // Add a file name to FILE_NAMES and return the canonical copy.
205 const char *intern_filename (const char *filename
)
207 const char **slot
= file_names
.find_slot (filename
, INSERT
);
210 /* The file name must live as long as the line map, which
211 effectively means as long as this compilation. So, we copy
212 the string here but never free it. */
213 *slot
= xstrdup (filename
);
219 static plugin_context
*current_context
;
223 plugin_context::plugin_context (int fd
)
224 : cc1_plugin::connection (fd
),
232 plugin_context::mark ()
234 for (hash_table
<decl_addr_hasher
>::iterator it
= address_map
.begin ();
235 it
!= address_map
.end ();
238 ggc_mark ((*it
)->decl
);
239 ggc_mark ((*it
)->address
);
242 for (hash_table
< nofree_ptr_hash
<tree_node
> >::iterator
243 it
= preserved
.begin (); it
!= preserved
.end (); ++it
)
248 plugin_binding_oracle (enum c_oracle_request kind
, tree identifier
)
250 enum gcc_c_oracle_request request
;
252 gcc_assert (current_context
!= NULL
);
256 case C_ORACLE_SYMBOL
:
257 request
= GCC_C_ORACLE_SYMBOL
;
260 request
= GCC_C_ORACLE_TAG
;
263 request
= GCC_C_ORACLE_LABEL
;
270 cc1_plugin::call (current_context
, "binding_oracle", &ignore
,
271 request
, IDENTIFIER_POINTER (identifier
));
275 plugin_pragma_user_expression (cpp_reader
*)
277 c_binding_oracle
= plugin_binding_oracle
;
281 plugin_init_extra_pragmas (void *, void *)
283 c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression
);
288 // Maybe rewrite a decl to its address.
290 address_rewriter (tree
*in
, int *walk_subtrees
, void *arg
)
292 plugin_context
*ctx
= (plugin_context
*) arg
;
294 if (!DECL_P (*in
) || DECL_NAME (*in
) == NULL_TREE
)
297 decl_addr_value value
;
299 decl_addr_value
*found_value
= ctx
->address_map
.find (&value
);
300 if (found_value
!= NULL
)
302 // At this point we don't need VLA sizes for gdb-supplied
303 // variables, and having them here confuses later passes, so we
305 if (C_TYPE_VARIABLE_SIZE (TREE_TYPE (*in
)))
308 = build_array_type_nelts (TREE_TYPE (TREE_TYPE (*in
)), 1);
309 DECL_SIZE (*in
) = TYPE_SIZE (TREE_TYPE (*in
));
310 DECL_SIZE_UNIT (*in
) = TYPE_SIZE_UNIT (TREE_TYPE (*in
));
313 else if (DECL_IS_BUILTIN (*in
))
317 if (!cc1_plugin::call (ctx
, "address_oracle", &address
,
318 IDENTIFIER_POINTER (DECL_NAME (*in
))))
323 // Insert the decl into the address map in case it is referenced
325 value
.address
= build_int_cst_type (ptr_type_node
, address
);
326 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
327 gcc_assert (*slot
== NULL
);
329 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
336 if (found_value
->address
!= error_mark_node
)
338 // We have an address for the decl, so rewrite the tree.
339 tree ptr_type
= build_pointer_type (TREE_TYPE (*in
));
340 *in
= fold_build1 (INDIRECT_REF
, TREE_TYPE (*in
),
341 fold_build1 (CONVERT_EXPR
, ptr_type
,
342 found_value
->address
));
350 // When generating code for gdb, we want to be able to use absolute
351 // addresses to refer to otherwise external objects that gdb knows
352 // about. gdb passes in these addresses when building decls, and then
353 // before gimplification we go through the trees, rewriting uses to
354 // the equivalent of "*(TYPE *) ADDR".
356 rewrite_decls_to_addresses (void *function_in
, void *)
358 tree function
= (tree
) function_in
;
360 // Do nothing if we're not in gdb.
361 if (current_context
== NULL
)
364 walk_tree (&DECL_SAVED_TREE (function
), address_rewriter
, current_context
,
371 plugin_build_decl (cc1_plugin::connection
*self
,
373 enum gcc_c_symbol_kind sym_kind
,
374 gcc_type sym_type_in
,
375 const char *substitution_name
,
377 const char *filename
,
378 unsigned int line_number
)
380 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
381 tree identifier
= get_identifier (name
);
384 tree sym_type
= convert_in (sym_type_in
);
388 case GCC_C_SYMBOL_FUNCTION
:
389 code
= FUNCTION_DECL
;
392 case GCC_C_SYMBOL_VARIABLE
:
396 case GCC_C_SYMBOL_TYPEDEF
:
400 case GCC_C_SYMBOL_LABEL
:
401 // FIXME: we aren't ready to handle labels yet.
402 // It isn't clear how to translate them properly
403 // and in any case a "goto" isn't likely to work.
404 return convert_out (error_mark_node
);
410 source_location loc
= ctx
->get_source_location (filename
, line_number
);
412 decl
= build_decl (loc
, code
, identifier
, sym_type
);
413 TREE_USED (decl
) = 1;
414 TREE_ADDRESSABLE (decl
) = 1;
416 if (sym_kind
!= GCC_C_SYMBOL_TYPEDEF
)
418 decl_addr_value value
;
421 if (substitution_name
!= NULL
)
423 // If the translator gave us a name without a binding,
424 // we can just substitute error_mark_node, since we know the
425 // translator will be reporting an error anyhow.
427 = lookup_name (get_identifier (substitution_name
));
428 if (value
.address
== NULL_TREE
)
429 value
.address
= error_mark_node
;
432 value
.address
= build_int_cst_type (ptr_type_node
, address
);
433 decl_addr_value
**slot
= ctx
->address_map
.find_slot (&value
, INSERT
);
434 gcc_assert (*slot
== NULL
);
436 = static_cast<decl_addr_value
*> (xmalloc (sizeof (decl_addr_value
)));
440 return convert_out (ctx
->preserve (decl
));
444 plugin_bind (cc1_plugin::connection
*,
445 gcc_decl decl_in
, int is_global
)
447 tree decl
= convert_in (decl_in
);
448 c_bind (DECL_SOURCE_LOCATION (decl
), decl
, is_global
);
449 rest_of_decl_compilation (decl
, is_global
, 0);
454 plugin_tagbind (cc1_plugin::connection
*self
,
455 const char *name
, gcc_type tagged_type
,
456 const char *filename
, unsigned int line_number
)
458 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
459 c_pushtag (ctx
->get_source_location (filename
, line_number
),
460 get_identifier (name
), convert_in (tagged_type
));
465 plugin_build_pointer_type (cc1_plugin::connection
*,
468 // No need to preserve a pointer type as the base type is preserved.
469 return convert_out (build_pointer_type (convert_in (base_type
)));
473 plugin_build_record_type (cc1_plugin::connection
*self
)
475 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
476 return convert_out (ctx
->preserve (make_node (RECORD_TYPE
)));
480 plugin_build_union_type (cc1_plugin::connection
*self
)
482 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
483 return convert_out (ctx
->preserve (make_node (UNION_TYPE
)));
487 plugin_build_add_field (cc1_plugin::connection
*,
488 gcc_type record_or_union_type_in
,
489 const char *field_name
,
490 gcc_type field_type_in
,
491 unsigned long bitsize
,
492 unsigned long bitpos
)
494 tree record_or_union_type
= convert_in (record_or_union_type_in
);
495 tree field_type
= convert_in (field_type_in
);
497 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
498 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
500 /* Note that gdb does not preserve the location of field decls, so
501 we can't provide a decent location here. */
502 tree decl
= build_decl (BUILTINS_LOCATION
, FIELD_DECL
,
503 get_identifier (field_name
), field_type
);
504 DECL_FIELD_CONTEXT (decl
) = record_or_union_type
;
506 if (TREE_CODE (field_type
) == INTEGER_TYPE
507 && TYPE_PRECISION (field_type
) != bitsize
)
509 DECL_BIT_FIELD_TYPE (decl
) = field_type
;
511 = c_build_bitfield_integer_type (bitsize
, TYPE_UNSIGNED (field_type
));
514 SET_DECL_MODE (decl
, TYPE_MODE (TREE_TYPE (decl
)));
516 // There's no way to recover this from DWARF.
517 SET_DECL_OFFSET_ALIGN (decl
, TYPE_PRECISION (pointer_sized_int_node
));
519 tree pos
= bitsize_int (bitpos
);
520 pos_from_bit (&DECL_FIELD_OFFSET (decl
), &DECL_FIELD_BIT_OFFSET (decl
),
521 DECL_OFFSET_ALIGN (decl
), pos
);
523 DECL_SIZE (decl
) = bitsize_int (bitsize
);
524 DECL_SIZE_UNIT (decl
) = size_int ((bitsize
+ BITS_PER_UNIT
- 1)
527 DECL_CHAIN (decl
) = TYPE_FIELDS (record_or_union_type
);
528 TYPE_FIELDS (record_or_union_type
) = decl
;
534 plugin_finish_record_or_union (cc1_plugin::connection
*,
535 gcc_type record_or_union_type_in
,
536 unsigned long size_in_bytes
)
538 tree record_or_union_type
= convert_in (record_or_union_type_in
);
540 gcc_assert (TREE_CODE (record_or_union_type
) == RECORD_TYPE
541 || TREE_CODE (record_or_union_type
) == UNION_TYPE
);
543 /* We built the field list in reverse order, so fix it now. */
544 TYPE_FIELDS (record_or_union_type
)
545 = nreverse (TYPE_FIELDS (record_or_union_type
));
547 if (TREE_CODE (record_or_union_type
) == UNION_TYPE
)
549 /* Unions can just be handled by the generic code. */
550 layout_type (record_or_union_type
);
554 // FIXME there's no way to get this from DWARF,
555 // or even, it seems, a particularly good way to deduce it.
556 SET_TYPE_ALIGN (record_or_union_type
,
557 TYPE_PRECISION (pointer_sized_int_node
));
559 TYPE_SIZE (record_or_union_type
) = bitsize_int (size_in_bytes
561 TYPE_SIZE_UNIT (record_or_union_type
) = size_int (size_in_bytes
);
563 compute_record_mode (record_or_union_type
);
564 finish_bitfield_layout (record_or_union_type
);
565 // FIXME we have no idea about TYPE_PACKED
572 plugin_build_enum_type (cc1_plugin::connection
*self
,
573 gcc_type underlying_int_type_in
)
575 tree underlying_int_type
= convert_in (underlying_int_type_in
);
577 if (underlying_int_type
== error_mark_node
)
578 return convert_out (error_mark_node
);
580 tree result
= make_node (ENUMERAL_TYPE
);
582 TYPE_PRECISION (result
) = TYPE_PRECISION (underlying_int_type
);
583 TYPE_UNSIGNED (result
) = TYPE_UNSIGNED (underlying_int_type
);
585 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
586 return convert_out (ctx
->preserve (result
));
590 plugin_build_add_enum_constant (cc1_plugin::connection
*,
591 gcc_type enum_type_in
,
595 tree cst
, decl
, cons
;
596 tree enum_type
= convert_in (enum_type_in
);
598 gcc_assert (TREE_CODE (enum_type
) == ENUMERAL_TYPE
);
600 cst
= build_int_cst (enum_type
, value
);
601 /* Note that gdb does not preserve the location of enum constants,
602 so we can't provide a decent location here. */
603 decl
= build_decl (BUILTINS_LOCATION
, CONST_DECL
,
604 get_identifier (name
), enum_type
);
605 DECL_INITIAL (decl
) = cst
;
606 pushdecl_safe (decl
);
608 cons
= tree_cons (DECL_NAME (decl
), cst
, TYPE_VALUES (enum_type
));
609 TYPE_VALUES (enum_type
) = cons
;
615 plugin_finish_enum_type (cc1_plugin::connection
*,
616 gcc_type enum_type_in
)
618 tree enum_type
= convert_in (enum_type_in
);
619 tree minnode
, maxnode
, iter
;
621 iter
= TYPE_VALUES (enum_type
);
622 minnode
= maxnode
= TREE_VALUE (iter
);
623 for (iter
= TREE_CHAIN (iter
);
625 iter
= TREE_CHAIN (iter
))
627 tree value
= TREE_VALUE (iter
);
628 if (tree_int_cst_lt (maxnode
, value
))
630 if (tree_int_cst_lt (value
, minnode
))
633 TYPE_MIN_VALUE (enum_type
) = minnode
;
634 TYPE_MAX_VALUE (enum_type
) = maxnode
;
636 layout_type (enum_type
);
642 plugin_build_function_type (cc1_plugin::connection
*self
,
643 gcc_type return_type_in
,
644 const struct gcc_type_array
*argument_types_in
,
647 tree
*argument_types
;
648 tree return_type
= convert_in (return_type_in
);
651 argument_types
= new tree
[argument_types_in
->n_elements
];
652 for (int i
= 0; i
< argument_types_in
->n_elements
; ++i
)
653 argument_types
[i
] = convert_in (argument_types_in
->elements
[i
]);
656 result
= build_varargs_function_type_array (return_type
,
657 argument_types_in
->n_elements
,
660 result
= build_function_type_array (return_type
,
661 argument_types_in
->n_elements
,
664 delete[] argument_types
;
666 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
667 return convert_out (ctx
->preserve (result
));
671 plugin_int_type (cc1_plugin::connection
*self
,
672 int is_unsigned
, unsigned long size_in_bytes
)
674 tree result
= c_common_type_for_size (BITS_PER_UNIT
* size_in_bytes
,
676 if (result
== NULL_TREE
)
677 result
= error_mark_node
;
680 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
681 ctx
->preserve (result
);
683 return convert_out (result
);
687 plugin_float_type (cc1_plugin::connection
*,
688 unsigned long size_in_bytes
)
690 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (float_type_node
))
691 return convert_out (float_type_node
);
692 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (double_type_node
))
693 return convert_out (double_type_node
);
694 if (BITS_PER_UNIT
* size_in_bytes
== TYPE_PRECISION (long_double_type_node
))
695 return convert_out (long_double_type_node
);
696 return convert_out (error_mark_node
);
700 plugin_void_type (cc1_plugin::connection
*)
702 return convert_out (void_type_node
);
706 plugin_bool_type (cc1_plugin::connection
*)
708 return convert_out (boolean_type_node
);
712 plugin_build_array_type (cc1_plugin::connection
*self
,
713 gcc_type element_type_in
, int num_elements
)
715 tree element_type
= convert_in (element_type_in
);
718 if (num_elements
== -1)
719 result
= build_array_type (element_type
, NULL_TREE
);
721 result
= build_array_type_nelts (element_type
, num_elements
);
723 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
724 return convert_out (ctx
->preserve (result
));
728 plugin_build_vla_array_type (cc1_plugin::connection
*self
,
729 gcc_type element_type_in
,
730 const char *upper_bound_name
)
732 tree element_type
= convert_in (element_type_in
);
733 tree upper_bound
= lookup_name (get_identifier (upper_bound_name
));
734 tree range
= build_index_type (upper_bound
);
736 tree result
= build_array_type (element_type
, range
);
737 C_TYPE_VARIABLE_SIZE (result
) = 1;
739 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
740 return convert_out (ctx
->preserve (result
));
744 plugin_build_qualified_type (cc1_plugin::connection
*,
745 gcc_type unqualified_type_in
,
746 enum gcc_qualifiers qualifiers
)
748 tree unqualified_type
= convert_in (unqualified_type_in
);
751 if ((qualifiers
& GCC_QUALIFIER_CONST
) != 0)
752 quals
|= TYPE_QUAL_CONST
;
753 if ((qualifiers
& GCC_QUALIFIER_VOLATILE
) != 0)
754 quals
|= TYPE_QUAL_VOLATILE
;
755 if ((qualifiers
& GCC_QUALIFIER_RESTRICT
) != 0)
756 quals
|= TYPE_QUAL_RESTRICT
;
758 return convert_out (build_qualified_type (unqualified_type
, quals
));
762 plugin_build_complex_type (cc1_plugin::connection
*self
,
765 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
766 return convert_out (ctx
->preserve (build_complex_type (convert_in (base_type
))));
770 plugin_build_vector_type (cc1_plugin::connection
*self
,
771 gcc_type base_type
, int nunits
)
773 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
774 return convert_out (ctx
->preserve (build_vector_type (convert_in (base_type
),
779 plugin_build_constant (cc1_plugin::connection
*self
, gcc_type type_in
,
780 const char *name
, unsigned long value
,
781 const char *filename
, unsigned int line_number
)
783 plugin_context
*ctx
= static_cast<plugin_context
*> (self
);
785 tree type
= convert_in (type_in
);
787 cst
= build_int_cst (type
, value
);
788 decl
= build_decl (ctx
->get_source_location (filename
, line_number
),
789 CONST_DECL
, get_identifier (name
), type
);
790 DECL_INITIAL (decl
) = cst
;
791 pushdecl_safe (decl
);
797 plugin_error (cc1_plugin::connection
*,
800 error ("%s", message
);
801 return convert_out (error_mark_node
);
806 // Perform GC marking.
809 gc_mark (void *, void *)
811 if (current_context
!= NULL
)
812 current_context
->mark ();
816 #pragma GCC visibility push(default)
820 plugin_init (struct plugin_name_args
*plugin_info
,
821 struct plugin_gcc_version
*)
824 for (int i
= 0; i
< plugin_info
->argc
; ++i
)
826 if (strcmp (plugin_info
->argv
[i
].key
, "fd") == 0)
830 fd
= strtol (plugin_info
->argv
[i
].value
, &tail
, 0);
831 if (*tail
!= '\0' || errno
!= 0)
832 fatal_error (input_location
,
833 "%s: invalid file descriptor argument to plugin",
834 plugin_info
->base_name
);
839 fatal_error (input_location
,
840 "%s: required plugin argument %<fd%> is missing",
841 plugin_info
->base_name
);
843 current_context
= new plugin_context (fd
);
846 cc1_plugin::protocol_int version
;
847 if (!current_context
->require ('H')
848 || ! ::cc1_plugin::unmarshall (current_context
, &version
))
849 fatal_error (input_location
,
850 "%s: handshake failed", plugin_info
->base_name
);
851 if (version
!= GCC_C_FE_VERSION_0
)
852 fatal_error (input_location
,
853 "%s: unknown version in handshake", plugin_info
->base_name
);
855 register_callback (plugin_info
->base_name
, PLUGIN_PRAGMAS
,
856 plugin_init_extra_pragmas
, NULL
);
857 register_callback (plugin_info
->base_name
, PLUGIN_PRE_GENERICIZE
,
858 rewrite_decls_to_addresses
, NULL
);
859 register_callback (plugin_info
->base_name
, PLUGIN_GGC_MARKING
,
862 lang_hooks
.print_error_function
= plugin_print_error_function
;
864 #define GCC_METHOD0(R, N) \
866 cc1_plugin::callback_ftype *fun \
867 = cc1_plugin::callback<R, plugin_ ## N>; \
868 current_context->add_callback (# N, fun); \
870 #define GCC_METHOD1(R, N, A) \
872 cc1_plugin::callback_ftype *fun \
873 = cc1_plugin::callback<R, A, plugin_ ## N>; \
874 current_context->add_callback (# N, fun); \
876 #define GCC_METHOD2(R, N, A, B) \
878 cc1_plugin::callback_ftype *fun \
879 = cc1_plugin::callback<R, A, B, plugin_ ## N>; \
880 current_context->add_callback (# N, fun); \
882 #define GCC_METHOD3(R, N, A, B, C) \
884 cc1_plugin::callback_ftype *fun \
885 = cc1_plugin::callback<R, A, B, C, plugin_ ## N>; \
886 current_context->add_callback (# N, fun); \
888 #define GCC_METHOD4(R, N, A, B, C, D) \
890 cc1_plugin::callback_ftype *fun \
891 = cc1_plugin::callback<R, A, B, C, D, \
893 current_context->add_callback (# N, fun); \
895 #define GCC_METHOD5(R, N, A, B, C, D, E) \
897 cc1_plugin::callback_ftype *fun \
898 = cc1_plugin::callback<R, A, B, C, D, E, \
900 current_context->add_callback (# N, fun); \
902 #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
904 cc1_plugin::callback_ftype *fun \
905 = cc1_plugin::callback<R, A, B, C, D, E, F, G, \
907 current_context->add_callback (# N, fun); \
910 #include "gcc-c-fe.def"