c-lang.c 5.79 KB
Newer Older
Richard Stallman committed
1
/* Language-specific hook definitions for C front end.
Jeff Law committed
2
   Copyright (C) 1991, 1995, 1997, 1998,
3
   1999, 2000, 2001 Free Software Foundation, Inc.
Richard Stallman committed
4

5
This file is part of GCC.
Richard Stallman committed
6

7 8 9 10
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Richard Stallman committed
11

12 13 14 15
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
Richard Stallman committed
16 17

You should have received a copy of the GNU General Public License
18 19 20
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */
Richard Stallman committed
21 22 23


#include "config.h"
24
#include "system.h"
Richard Stallman committed
25
#include "tree.h"
26
#include "c-tree.h"
27
#include "c-common.h"
Alexandre Oliva committed
28
#include "langhooks.h"
Neil Booth committed
29
#include "langhooks-def.h"
30

31
static const char *c_init PARAMS ((const char *));
32
static void c_init_options PARAMS ((void));
33
static void c_post_options PARAMS ((void));
34 35

/* ### When changing hooks, consider if ObjC needs changing too!! ### */
36

37 38
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C"
Alexandre Oliva committed
39 40
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT c_init
41 42
#undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH c_common_finish
Alexandre Oliva committed
43 44 45 46 47 48
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_init_options
#undef LANG_HOOKS_DECODE_OPTION
#define LANG_HOOKS_DECODE_OPTION c_decode_option
#undef LANG_HOOKS_POST_OPTIONS
#define LANG_HOOKS_POST_OPTIONS c_post_options
49 50
#undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
51 52
#undef LANG_HOOKS_SAFE_FROM_P
#define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
53 54
#undef LANG_HOOKS_MARK_TREE
#define LANG_HOOKS_MARK_TREE c_mark_tree
55 56
#undef LANG_HOOKS_EXPAND_EXPR
#define LANG_HOOKS_EXPAND_EXPR c_expand_expr
57 58
#undef LANG_HOOKS_MARK_ADDRESSABLE
#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
59 60
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE c_common_parse_file
61 62
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
63 64
#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes
65 66 67 68
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
69 70
#undef LANG_HOOKS_STATICP
#define LANG_HOOKS_STATICP c_staticp
71 72
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
Neil Booth committed
73 74 75 76
#undef LANG_HOOKS_PRINT_IDENTIFIER
#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
#undef LANG_HOOKS_SET_YYDEBUG
#define LANG_HOOKS_SET_YYDEBUG c_set_yydebug
77 78
#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
79

Alexandre Oliva committed
80 81 82 83 84 85 86 87 88
#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
  c_cannot_inline_tree_fn
#undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
  c_disregard_inline_limits
#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
  anon_aggr_type_p
89 90 91
#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
  c_convert_parm_for_inlining
Alexandre Oliva committed
92

93 94 95 96
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
97 98 99 100 101 102
#undef LANG_HOOKS_SIGNED_TYPE
#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
#undef LANG_HOOKS_UNSIGNED_TYPE
#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
103

104 105
/* ### When changing hooks, consider if ObjC needs changing too!! ### */

106
/* Each front end provides its own.  */
107
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
108

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
/* Tree code classes.  */

#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,

const char tree_code_type[] = {
#include "tree.def"
  'x',
#include "c-common.def"
};
#undef DEFTREECODE

/* Table indexed by tree code giving number of expression
   operands beyond the fixed part of the node structure.
   Not used for types or decls.  */

#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,

const unsigned char tree_code_length[] = {
#include "tree.def"
  0,
#include "c-common.def"
};
#undef DEFTREECODE

/* Names of tree components.
   Used for printing out the tree and error messages.  */
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,

const char *const tree_code_name[] = {
#include "tree.def"
  "@@dummy",
#include "c-common.def"
};
#undef DEFTREECODE

144 145 146 147
/* Post-switch processing.  */
static void
c_post_options ()
{
148
  c_common_post_options ();
149
}
Zack Weinberg committed
150

151 152
static void
c_init_options ()
153
{
154
  c_common_init_options (clk_c);
155 156
}

157 158 159
static const char *
c_init (filename)
     const char *filename;
Richard Stallman committed
160
{
161
  return c_objc_common_init (filename);
Richard Stallman committed
162 163 164
}

/* Used by c-lex.c, but only for objc.  */
165

Richard Stallman committed
166 167
tree
lookup_interface (arg)
Kaveh R. Ghazi committed
168
     tree arg ATTRIBUTE_UNUSED;
Richard Stallman committed
169 170 171 172
{
  return 0;
}

173 174
tree
is_class_name (arg)
Kaveh R. Ghazi committed
175
    tree arg ATTRIBUTE_UNUSED;
176 177 178 179
{
  return 0;
}

Richard Stallman committed
180 181
void
maybe_objc_check_decl (decl)
Kaveh R. Ghazi committed
182
     tree decl ATTRIBUTE_UNUSED;
Richard Stallman committed
183 184 185 186
{
}

int
187
maybe_objc_comptypes (lhs, rhs, reflexive)
Kaveh R. Ghazi committed
188 189 190
     tree lhs ATTRIBUTE_UNUSED;
     tree rhs ATTRIBUTE_UNUSED;
     int reflexive ATTRIBUTE_UNUSED;
191
{
192
  return -1;
193 194 195
}

tree
Richard Stallman committed
196 197 198 199 200 201 202 203 204 205 206
maybe_building_objc_message_expr ()
{
  return 0;
}

int
recognize_objc_keyword ()
{
  return 0;
}

207 208 209 210 211 212 213 214 215
/* Used by c-typeck.c (build_external_ref), but only for objc.  */

tree
lookup_objc_ivar (id)
     tree id ATTRIBUTE_UNUSED;
{
  return 0;
}

216 217 218
void
finish_file ()
{
219
  c_objc_common_finish_file ();
220
}