c, c++: attribute format on a ctor with a vbase [PR101833, PR47634]
[official-gcc.git] / gcc / hooks.cc
blobb29233f4f852fb81ede75a5065d743cd16cc9219
1 /* General-purpose hooks.
2 Copyright (C) 2002-2022 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
7 later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>.
18 In other words, you are welcome to use, share and improve this program.
19 You are forbidden to forbid anyone else to use, share and improve
20 what you give them. Help stamp out software-hoarding! */
22 /* This file contains generic hooks that can be used as defaults for
23 target or language-dependent hook initializers. */
25 #include "config.h"
26 #include "system.h"
27 #include "coretypes.h"
28 #include "tm.h"
29 #include "hooks.h"
31 /* Generic hook that does absolutely zappo. */
32 void
33 hook_void_void (void)
37 /* Generic hook that takes no arguments and returns false. */
38 bool
39 hook_bool_void_false (void)
41 return false;
44 /* Generic hook that takes no arguments and returns true. */
45 bool
46 hook_bool_void_true (void)
48 return true;
51 /* Generic hook that takes (bool) and returns false. */
52 bool
53 hook_bool_bool_false (bool)
55 return false;
58 /* Generic hook that takes (bool, struct gcc_options *) and returns false. */
59 bool
60 hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *)
62 return false;
65 /* Generic hook that takes const int, const int) and returns true. */
66 bool hook_bool_const_int_const_int_true (const int, const int)
68 return true;
71 /* Generic hook that takes (machine_mode) and returns false. */
72 bool
73 hook_bool_mode_false (machine_mode)
75 return false;
78 /* Generic hook that takes (machine_mode) and returns true. */
79 bool
80 hook_bool_mode_true (machine_mode)
82 return true;
85 /* Generic hook that takes (machine_mode, machine_mode) and returns true. */
86 bool
87 hook_bool_mode_mode_true (machine_mode, machine_mode)
89 return true;
92 /* Generic hook that takes (machine_mode, const_rtx) and returns false. */
93 bool
94 hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
96 return false;
99 /* Generic hook that takes (machine_mode, const_rtx) and returns true. */
100 bool
101 hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
103 return true;
106 /* Generic hook that takes (machine_mode, rtx) and returns false. */
107 bool
108 hook_bool_mode_rtx_false (machine_mode, rtx)
110 return false;
113 /* Generic hook that takes (machine_mode, rtx) and returns true. */
114 bool
115 hook_bool_mode_rtx_true (machine_mode, rtx)
117 return true;
120 /* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true. */
121 bool
122 hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
123 const rtx_insn *)
125 return true;
128 /* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
129 and returns false. */
130 bool
131 hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
133 return false;
136 /* Generic hook that takes (poly_uint64, poly_uint64) and returns true. */
137 bool
138 hook_bool_puint64_puint64_true (poly_uint64, poly_uint64)
140 return true;
143 bool
144 hook_bool_uint_uint_mode_false (unsigned int, unsigned int, machine_mode)
146 return false;
149 /* Generic hook that takes (unsigned int, machine_mode) and returns true. */
150 bool
151 hook_bool_uint_mode_true (unsigned int, machine_mode)
153 return true;
156 /* Generic hook that takes (FILE *, const char *) and does nothing. */
157 void
158 hook_void_FILEptr_constcharptr (FILE *, const char *)
162 /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
163 nothing. */
164 void
165 hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
169 /* Generic hook that takes (FILE *, rtx) and returns false. */
170 bool
171 hook_bool_FILEptr_rtx_false (FILE *, rtx)
173 return false;
176 /* Generic hook that takes (gimple_stmt_iterator *) and returns
177 false. */
178 bool
179 hook_bool_gsiptr_false (gimple_stmt_iterator *)
181 return false;
184 /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
185 bool
186 hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
187 HOST_WIDE_INT, const_tree)
189 return false;
192 bool
193 hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
194 HOST_WIDE_INT, const_tree)
196 return true;
199 bool
200 default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
201 HOST_WIDE_INT c, const_tree)
203 return c == 0;
207 hook_int_uint_mode_1 (unsigned int, machine_mode)
209 return 1;
213 hook_int_const_tree_0 (const_tree)
215 return 0;
218 /* ??? Used for comp_type_attributes, which ought to return bool. */
220 hook_int_const_tree_const_tree_1 (const_tree, const_tree)
222 return 1;
226 hook_int_rtx_0 (rtx)
228 return 0;
232 hook_int_rtx_1 (rtx)
234 return 1;
238 hook_int_rtx_insn_0 (rtx_insn *)
240 return 0;
244 hook_int_rtx_insn_unreachable (rtx_insn *)
246 gcc_unreachable ();
250 hook_int_rtx_bool_0 (rtx, bool)
252 return 0;
256 hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
258 return 0;
261 unsigned int
262 hook_uint_void_0 (void)
264 return 0;
267 HOST_WIDE_INT
268 hook_hwi_void_0 (void)
270 return 0;
273 void
274 hook_void_tree (tree)
278 void
279 hook_void_FILEptr_tree (FILE *, tree)
283 void
284 hook_void_rtx_tree (rtx, tree)
288 void
289 hook_void_constcharptr (const char *)
293 void
294 hook_void_tree_treeptr (tree, tree *)
298 void
299 hook_void_int_int (int, int)
303 bool
304 hook_bool_tree_false (tree)
306 return false;
309 bool
310 hook_bool_const_tree_false (const_tree)
312 return false;
315 bool
316 hook_bool_const_tree_const_tree_true (const_tree, const_tree)
318 return true;
321 bool
322 hook_bool_tree_true (tree)
324 return true;
327 bool
328 hook_bool_const_tree_true (const_tree)
330 return true;
333 bool
334 hook_bool_tree_tree_false (tree, tree)
336 return false;
339 bool
340 hook_bool_tree_tree_true (tree, tree)
342 return true;
345 bool
346 hook_bool_tree_bool_false (tree, bool)
348 return false;
351 bool
352 hook_bool_rtx_insn_true (rtx_insn *)
354 return true;
357 bool
358 hook_bool_rtx_false (rtx)
360 return false;
363 bool
364 hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
366 return false;
369 bool
370 hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
371 int *, bool)
373 return false;
376 bool
377 hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
378 unsigned int, bool)
380 return true;
383 /* Generic hook that takes an rtx and returns it. */
385 hook_rtx_rtx_identity (rtx x)
387 return x;
390 /* Generic hook that takes an rtx and returns NULL_RTX. */
392 hook_rtx_rtx_null (rtx)
394 return NULL;
397 /* Generic hook that takes a tree and an int and returns NULL_RTX. */
399 hook_rtx_tree_int_null (tree, int)
401 return NULL;
404 /* Generic hook that takes a machine mode and returns an unsigned int 0. */
405 unsigned int
406 hook_uint_mode_0 (machine_mode)
408 return 0;
411 /* Generic hook that takes no arguments and returns a NULL const string. */
412 const char *
413 hook_constcharptr_void_null (void)
415 return NULL;
418 /* Generic hook that takes no arguments and returns a NULL string. */
419 char *
420 hook_charptr_void_null (void)
422 return NULL;
425 /* Generic hook that takes a tree and returns a NULL string. */
426 const char *
427 hook_constcharptr_const_tree_null (const_tree)
429 return NULL;
432 tree
433 hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
435 return NULL;
438 tree
439 hook_tree_tree_bool_null (tree, bool)
441 return NULL;
444 tree
445 hook_tree_tree_tree_null (tree, tree)
447 return NULL;
450 tree
451 hook_tree_tree_tree_tree_null (tree, tree, tree)
453 return NULL;
456 tree
457 hook_tree_treeptr_tree_tree_int_boolptr_null (tree *, tree, tree, int, bool *)
459 return NULL;
462 /* Generic hook that takes an rtx_insn *and returns a NULL string. */
463 const char *
464 hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
466 return NULL;
469 const char *
470 hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
472 return NULL;
475 const char *
476 hook_constcharptr_int_const_tree_null (int, const_tree)
478 return NULL;
481 const char *
482 hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
484 return NULL;
487 /* Generic hook that takes a const_tree and returns NULL_TREE. */
488 tree
489 hook_tree_const_tree_null (const_tree)
491 return NULL;
494 /* Generic hook that takes no arguments and returns a NULL_TREE. */
495 tree
496 hook_tree_void_null (void)
498 return NULL;
501 /* Generic hook that takes a rtx_insn * and an int and returns a bool. */
503 bool
504 hook_bool_rtx_insn_int_false (rtx_insn *, int)
506 return false;
509 /* Generic hook that takes a rtx_insn * and an int and returns void. */
511 void
512 hook_void_rtx_insn_int (rtx_insn *, int)
516 /* Generic hook that takes a struct gcc_options * and returns void. */
518 void
519 hook_void_gcc_optionsp (struct gcc_options *)
523 /* Generic hook that takes an unsigned int and returns true. */
525 bool
526 hook_bool_uint_true (unsigned int)
528 return true;
531 /* Generic hook that takes an unsigned int, an unsigned int pointer and
532 returns false. */
534 bool
535 hook_bool_uint_uintp_false (unsigned int, unsigned int *)
537 return false;
540 /* Generic hook that takes a register class and returns false. */
541 bool
542 hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
544 return false;
547 /* Generic hook that takes 2 machine_modes and a register class and
548 returns true. */
549 bool
550 hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
552 return true;
555 /* Generic hook that takes a machine_mode and 2 register classes
556 and returns false. */
557 bool
558 hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
559 reg_class_t)
561 return false;
564 /* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
565 returns no mode. */
567 opt_machine_mode
568 hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
570 return opt_machine_mode ();