]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/langhooks-def.h
re PR target/37170 (gcc.dg/weak/weak-1.c)
[thirdparty/gcc.git] / gcc / langhooks-def.h
CommitLineData
d23c55c2 1/* Default macros to initialize the lang_hooks data structure.
08f0e79e 2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
d23c55c2
NB
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4
63b025a5 5This file is part of GCC.
d23c55c2 6
63b025a5 7GCC is free software; you can redistribute it and/or modify
d23c55c2 8it under the terms of the GNU General Public License as published by
9dcd6f09 9the Free Software Foundation; either version 3, or (at your option)
d23c55c2
NB
10any later version.
11
63b025a5 12GCC is distributed in the hope that it will be useful,
d23c55c2
NB
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
9dcd6f09
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
d23c55c2
NB
20
21#ifndef GCC_LANG_HOOKS_DEF_H
22#define GCC_LANG_HOOKS_DEF_H
23
e5f3b786
NB
24#include "hooks.h"
25
7cb32822 26struct diagnostic_context;
c94ed7a1 27struct diagnostic_info;
7cb32822 28
d23c55c2
NB
29/* Note to creators of new hooks:
30
31 The macros in this file should NOT be surrounded by a
32 #ifdef...#endif pair, since this file declares the defaults. Each
33 front end overrides any hooks it wishes to, in the file containing
7fb26bb0 34 its struct lang_hooks, AFTER including this file. */
d23c55c2
NB
35
36/* See langhooks.h for the definition and documentation of each hook. */
37
0c20a65f
AJ
38extern void lhd_do_nothing (void);
39extern void lhd_do_nothing_t (tree);
40extern void lhd_do_nothing_i (int);
41extern void lhd_do_nothing_f (struct function *);
42extern bool lhd_post_options (const char **);
4862826d 43extern alias_set_type lhd_get_alias_set (tree);
47aa0df4 44extern tree lhd_return_null_tree_v (void);
0c20a65f 45extern tree lhd_return_null_tree (tree);
fa233e34 46extern tree lhd_return_null_const_tree (const_tree);
a7e8c268 47extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
270c60bb 48extern tree lhd_staticp (tree);
0c20a65f
AJ
49extern void lhd_print_tree_nothing (FILE *, tree, int);
50extern const char *lhd_decl_printable_name (tree, int);
721a8ac5 51extern const char *lhd_dwarf_name (tree, int);
6de9cd9a 52extern int lhd_types_compatible_p (tree, tree);
0fab64a3 53extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
0c20a65f 54extern void lhd_print_error_function (struct diagnostic_context *,
c94ed7a1 55 const char *, struct diagnostic_info *);
0c20a65f 56extern void lhd_set_decl_assembler_name (tree);
ac7d7749
KG
57extern bool lhd_warn_unused_global_decl (const_tree);
58extern void lhd_incomplete_type_error (const_tree, const_tree);
0c20a65f 59extern tree lhd_type_promotes_to (tree);
9649812a 60extern void lhd_register_builtin_type (tree, const char *);
58f9752a 61extern bool lhd_decl_ok_for_sibcall (const_tree);
c18a5b6c 62extern const char *lhd_comdat_group (tree);
ac7d7749 63extern tree lhd_expr_size (const_tree);
0c20a65f 64extern size_t lhd_tree_size (enum tree_code);
c5ff069d 65extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
51eed280 66extern tree lhd_expr_to_decl (tree, bool *, bool *);
c79efc4d 67extern tree lhd_builtin_function (tree decl);
d23c55c2
NB
68
69/* Declarations of default tree inlining hooks. */
21ecc5a7 70extern void lhd_initialize_diagnostics (struct diagnostic_context *);
c4e622b6 71extern tree lhd_callgraph_analyze_expr (tree *, int *);
25c84396 72
0c20a65f 73
6de9cd9a 74/* Declarations for tree gimplification hooks. */
726a989a 75extern int lhd_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
953ff289
DN
76extern enum omp_clause_default_kind lhd_omp_predetermined_sharing (tree);
77extern tree lhd_omp_assignment (tree, tree, tree);
78struct gimplify_omp_ctx;
79extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
80 tree);
6de9cd9a 81
3ac88239
NB
82#define LANG_HOOKS_NAME "GNU unknown"
83#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
4bfec483 84#define LANG_HOOKS_INIT hook_bool_void_false
d23c55c2 85#define LANG_HOOKS_FINISH lhd_do_nothing
ff45c01e 86#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
b86f6cd9 87#define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0
fc95cf70 88#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
b86f6cd9 89#define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constcharptr_int_0
cb66e385 90#define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false
4bfec483 91#define LANG_HOOKS_POST_OPTIONS lhd_post_options
e8924938 92#define LANG_HOOKS_MISSING_NORETURN_OK_P hook_bool_tree_true
d23c55c2 93#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
c9d892a8 94#define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr
48a7a235 95#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
270c60bb 96#define LANG_HOOKS_STATICP lhd_staticp
63e1b1c4 97#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
599bba86 98#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
2896d056 99#define LANG_HOOKS_NO_BODY_BLOCKS false
5d69f816
NB
100#define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing
101#define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing
102#define LANG_HOOKS_PRINT_DECL lhd_print_tree_nothing
103#define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing
104#define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing
7cb32822 105#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
7afff7cf 106#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
721a8ac5 107#define LANG_HOOKS_DWARF_NAME lhd_dwarf_name
a77a9a18 108#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
d78e771d 109#define LANG_HOOKS_TREE_SIZE lhd_tree_size
6de9cd9a 110#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p
c79efc4d 111#define LANG_HOOKS_BUILTIN_FUNCTION lhd_builtin_function
5779e713 112#define LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE LANG_HOOKS_BUILTIN_FUNCTION
73f397d4 113#define LANG_HOOKS_EXPR_TO_DECL lhd_expr_to_decl
c5ff069d 114#define LANG_HOOKS_TO_TARGET_CHARSET lhd_to_target_charset
820cc88f 115#define LANG_HOOKS_INIT_TS lhd_do_nothing
d23c55c2 116
349ae713
NB
117/* Attribute hooks. */
118#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
119#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE NULL
120#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL
121
d23c55c2 122/* Tree inlining hooks. */
8bcefb43 123#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
5377d5ba 124 hook_bool_tree_tree_false
d23c55c2
NB
125
126#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
8bcefb43 127 LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
25c84396 128}
d23c55c2 129
25c84396 130#define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
e89d6010 131#define LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS NULL
e72fcfe8
JH
132
133#define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
25c84396 134 LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR, \
e89d6010 135 LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS, \
25c84396 136}
e72fcfe8 137
6de9cd9a
DN
138/* Hooks for tree gimplification. */
139#define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
0f59171d 140#define LANG_HOOKS_FOLD_OBJ_TYPE_REF NULL
4985cde3 141
89d684bb 142/* Tree dump hooks. */
0c20a65f 143extern bool lhd_tree_dump_dump_tree (void *, tree);
ac7d7749 144extern int lhd_tree_dump_type_quals (const_tree);
b9dcdee4 145extern tree lhd_make_node (enum tree_code);
89d684bb
BM
146
147#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
148#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
149
150#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
151 LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
152 LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
43577e6b
NB
153}
154
48a7a235
NB
155/* Types hooks. There are no reasonable defaults for most of them,
156 so we create a compile-time error instead. */
b9dcdee4 157#define LANG_HOOKS_MAKE_TYPE lhd_make_node
394d9fe7 158#define LANG_HOOKS_CLASSIFY_RECORD NULL
7a228918 159#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error
ac7d7749 160#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false
ab393bf1 161#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
9649812a 162#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
ac7d7749 163#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree
953ff289
DN
164#define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
165 lhd_omp_firstprivatize_type_sizes
2dff8956 166#define LANG_HOOKS_TYPE_HASH_EQ NULL
fad0afd7 167#define LANG_HOOKS_GET_ARRAY_DESCR_INFO NULL
5dc11954 168#define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
7548281d 169#define LANG_HOOKS_HASH_TYPES true
f1e639b1
NB
170
171#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
b0c48229 172 LANG_HOOKS_MAKE_TYPE, \
394d9fe7 173 LANG_HOOKS_CLASSIFY_RECORD, \
b0c48229 174 LANG_HOOKS_TYPE_FOR_MODE, \
ceef8ce4 175 LANG_HOOKS_TYPE_FOR_SIZE, \
39ef6592 176 LANG_HOOKS_GENERIC_TYPE_P, \
ab393bf1 177 LANG_HOOKS_TYPE_PROMOTES_TO, \
9649812a 178 LANG_HOOKS_REGISTER_BUILTIN_TYPE, \
7548281d 179 LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
8963a517 180 LANG_HOOKS_TYPE_MAX_SIZE, \
953ff289 181 LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \
2dff8956 182 LANG_HOOKS_TYPE_HASH_EQ, \
fad0afd7 183 LANG_HOOKS_GET_ARRAY_DESCR_INFO, \
5dc11954 184 LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE, \
7548281d 185 LANG_HOOKS_HASH_TYPES \
f1e639b1
NB
186}
187
43577e6b 188/* Declaration hooks. */
43577e6b 189#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
43577e6b
NB
190#define LANG_HOOKS_PUSHDECL pushdecl
191#define LANG_HOOKS_GETDECLS getdecls
ef4f94ac 192#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
2b59501b 193#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
e076f71a 194#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
c18a5b6c 195#define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
58f9752a 196#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false
953ff289
DN
197#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
198#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
199#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false
a68ab351
JJ
200#define LANG_HOOKS_OMP_PRIVATE_OUTER_REF hook_bool_tree_false
201#define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR hook_tree_tree_tree_tree_null
953ff289
DN
202#define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR lhd_omp_assignment
203#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP lhd_omp_assignment
204#define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null
a68ab351 205#define LANG_HOOKS_OMP_FINISH_CLAUSE hook_void_tree
43577e6b
NB
206
207#define LANG_HOOKS_DECLS { \
43577e6b 208 LANG_HOOKS_GLOBAL_BINDINGS_P, \
43577e6b 209 LANG_HOOKS_PUSHDECL, \
ef4f94ac 210 LANG_HOOKS_GETDECLS, \
2b59501b 211 LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
e076f71a
AH
212 LANG_HOOKS_WRITE_GLOBALS, \
213 LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
953ff289
DN
214 LANG_HOOKS_COMDAT_GROUP, \
215 LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \
216 LANG_HOOKS_OMP_PREDETERMINED_SHARING, \
217 LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \
218 LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, \
a68ab351 219 LANG_HOOKS_OMP_PRIVATE_OUTER_REF, \
953ff289
DN
220 LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR, \
221 LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, \
222 LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, \
a68ab351
JJ
223 LANG_HOOKS_OMP_CLAUSE_DTOR, \
224 LANG_HOOKS_OMP_FINISH_CLAUSE \
43577e6b 225}
89d684bb
BM
226
227/* The whole thing. The structure is defined in langhooks.h. */
d23c55c2 228#define LANG_HOOKS_INITIALIZER { \
3ac88239
NB
229 LANG_HOOKS_NAME, \
230 LANG_HOOKS_IDENTIFIER_SIZE, \
d78e771d 231 LANG_HOOKS_TREE_SIZE, \
d23c55c2 232 LANG_HOOKS_INIT_OPTIONS, \
fc95cf70 233 LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
2772ef3e 234 LANG_HOOKS_HANDLE_OPTION, \
cb66e385 235 LANG_HOOKS_MISSING_ARGUMENT, \
d23c55c2 236 LANG_HOOKS_POST_OPTIONS, \
4d6baafa
NB
237 LANG_HOOKS_INIT, \
238 LANG_HOOKS_FINISH, \
52dabb6c 239 LANG_HOOKS_PARSE_FILE, \
e8924938 240 LANG_HOOKS_MISSING_NORETURN_OK_P, \
d23c55c2 241 LANG_HOOKS_GET_ALIAS_SET, \
c9d892a8 242 LANG_HOOKS_EXPAND_EXPR, \
48a7a235 243 LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
dffd7eb6 244 LANG_HOOKS_MARK_ADDRESSABLE, \
270c60bb 245 LANG_HOOKS_STATICP, \
63e1b1c4 246 LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
599bba86 247 LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
2896d056 248 LANG_HOOKS_NO_BODY_BLOCKS, \
5d69f816
NB
249 LANG_HOOKS_PRINT_STATISTICS, \
250 LANG_HOOKS_PRINT_XNODE, \
251 LANG_HOOKS_PRINT_DECL, \
252 LANG_HOOKS_PRINT_TYPE, \
253 LANG_HOOKS_PRINT_IDENTIFIER, \
7afff7cf 254 LANG_HOOKS_DECL_PRINTABLE_NAME, \
721a8ac5 255 LANG_HOOKS_DWARF_NAME, \
6de9cd9a 256 LANG_HOOKS_TYPES_COMPATIBLE_P, \
7cb32822 257 LANG_HOOKS_PRINT_ERROR_FUNCTION, \
a77a9a18 258 LANG_HOOKS_EXPR_SIZE, \
c5ff069d 259 LANG_HOOKS_TO_TARGET_CHARSET, \
349ae713
NB
260 LANG_HOOKS_ATTRIBUTE_TABLE, \
261 LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
262 LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
89d684bb 263 LANG_HOOKS_TREE_INLINING_INITIALIZER, \
e72fcfe8 264 LANG_HOOKS_CALLGRAPH_INITIALIZER, \
43577e6b 265 LANG_HOOKS_TREE_DUMP_INITIALIZER, \
f1e639b1 266 LANG_HOOKS_DECLS, \
4985cde3 267 LANG_HOOKS_FOR_TYPES_INITIALIZER, \
6de9cd9a 268 LANG_HOOKS_GIMPLIFY_EXPR, \
0f59171d 269 LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
6e34d3a3 270 LANG_HOOKS_BUILTIN_FUNCTION, \
5779e713 271 LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE, \
820cc88f 272 LANG_HOOKS_INIT_TS, \
73f397d4 273 LANG_HOOKS_EXPR_TO_DECL, \
d23c55c2
NB
274}
275
276#endif /* GCC_LANG_HOOKS_DEF_H */