OSDN Git Service

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