xref: /dflybsd-src/contrib/gcc-4.7/gcc/objcp/objcp-decl.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Process the ObjC-specific declarations and variables for
2*e4b17023SJohn Marino    the Objective-C++ compiler.
3*e4b17023SJohn Marino    Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
4*e4b17023SJohn Marino    Contributed by Ziemowit Laski  <zlaski@apple.com>
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino This file is part of GCC.
7*e4b17023SJohn Marino 
8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
11*e4b17023SJohn Marino version.
12*e4b17023SJohn Marino 
13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16*e4b17023SJohn Marino for more details.
17*e4b17023SJohn Marino 
18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21*e4b17023SJohn Marino 
22*e4b17023SJohn Marino 
23*e4b17023SJohn Marino #ifndef GCC_OBJCP_DECL_H
24*e4b17023SJohn Marino #define GCC_OBJCP_DECL_H
25*e4b17023SJohn Marino 
26*e4b17023SJohn Marino extern tree objcp_start_struct (location_t, enum tree_code, tree);
27*e4b17023SJohn Marino extern tree objcp_finish_struct (location_t, tree, tree, tree);
28*e4b17023SJohn Marino extern void objcp_finish_function (void);
29*e4b17023SJohn Marino extern tree objcp_build_function_call (tree, tree);
30*e4b17023SJohn Marino extern tree objcp_xref_tag (enum tree_code, tree);
31*e4b17023SJohn Marino extern int objcp_comptypes (tree, tree);
32*e4b17023SJohn Marino extern tree objcp_begin_compound_stmt (int);
33*e4b17023SJohn Marino extern tree objcp_end_compound_stmt (tree, int);
34*e4b17023SJohn Marino 
35*e4b17023SJohn Marino /* Now "cover up" the corresponding C++ functions if required (NB: the
36*e4b17023SJohn Marino    OBJCP_ORIGINAL_FUNCTION macro, shown below, can still be used to
37*e4b17023SJohn Marino    invoke the original C++ functions if needed).  */
38*e4b17023SJohn Marino #ifdef OBJCP_REMAP_FUNCTIONS
39*e4b17023SJohn Marino 
40*e4b17023SJohn Marino #define start_struct(loc, code, name, struct_info) \
41*e4b17023SJohn Marino 	objcp_start_struct (loc, code, name)
42*e4b17023SJohn Marino #define finish_struct(loc, t, fieldlist, attributes, struct_info) \
43*e4b17023SJohn Marino 	objcp_finish_struct (loc, t, fieldlist, attributes)
44*e4b17023SJohn Marino #define finish_function() \
45*e4b17023SJohn Marino 	objcp_finish_function ()
46*e4b17023SJohn Marino #define finish_decl(decl, loc, init, origtype, asmspec) \
47*e4b17023SJohn Marino 	cp_finish_decl (decl, init, false, asmspec, 0)
48*e4b17023SJohn Marino #define xref_tag(code, name) \
49*e4b17023SJohn Marino 	objcp_xref_tag (code, name)
50*e4b17023SJohn Marino #define comptypes(type1, type2) \
51*e4b17023SJohn Marino 	objcp_comptypes (type1, type2)
52*e4b17023SJohn Marino #define c_begin_compound_stmt(flags) \
53*e4b17023SJohn Marino 	objcp_begin_compound_stmt (flags)
54*e4b17023SJohn Marino #define c_end_compound_stmt(loc, stmt, flags)	\
55*e4b17023SJohn Marino 	objcp_end_compound_stmt (stmt, flags)
56*e4b17023SJohn Marino 
57*e4b17023SJohn Marino #undef OBJC_TYPE_NAME
58*e4b17023SJohn Marino #define OBJC_TYPE_NAME(type) \
59*e4b17023SJohn Marino   (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \
60*e4b17023SJohn Marino    ? DECL_NAME (TYPE_NAME (type)) \
61*e4b17023SJohn Marino    : TYPE_NAME (type))
62*e4b17023SJohn Marino #undef OBJC_SET_TYPE_NAME
63*e4b17023SJohn Marino #define OBJC_SET_TYPE_NAME(type, name) \
64*e4b17023SJohn Marino   if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \
65*e4b17023SJohn Marino     DECL_NAME (TYPE_NAME (type)) = name; \
66*e4b17023SJohn Marino   else \
67*e4b17023SJohn Marino     TYPE_NAME (type) = name;
68*e4b17023SJohn Marino 
69*e4b17023SJohn Marino #undef TYPE_OBJC_INFO
70*e4b17023SJohn Marino #define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
71*e4b17023SJohn Marino #undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC
72*e4b17023SJohn Marino #define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type_class)
73*e4b17023SJohn Marino #undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
74*e4b17023SJohn Marino #define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE)				\
75*e4b17023SJohn Marino   do {									\
76*e4b17023SJohn Marino     TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_cleared_lang_type		\
77*e4b17023SJohn Marino       (sizeof (struct lang_type_class));		\
78*e4b17023SJohn Marino     TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1;		\
79*e4b17023SJohn Marino   } while (0)
80*e4b17023SJohn Marino 
81*e4b17023SJohn Marino #define OBJCP_ORIGINAL_FUNCTION(name, args) 	(name)args
82*e4b17023SJohn Marino 
83*e4b17023SJohn Marino /* C++ marks ellipsis-free function parameters differently from C.  */
84*e4b17023SJohn Marino #undef OBJC_VOID_AT_END
85*e4b17023SJohn Marino #define OBJC_VOID_AT_END        void_list_node
86*e4b17023SJohn Marino 
87*e4b17023SJohn Marino #endif  /* OBJCP_REMAP_FUNCTIONS */
88*e4b17023SJohn Marino 
89*e4b17023SJohn Marino #endif /* ! GCC_OBJCP_DECL_H */
90