target-hooks-macros.h 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Common macros for target hook definitions.
  2. Copyright (C) 2001-2019 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the
  5. Free Software Foundation; either version 3, or (at your option) any
  6. later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; see the file COPYING3. If not see
  13. <http://www.gnu.org/licenses/>. */
  14. /* The following macros should be provided by the including file:
  15. DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
  16. DEFHOOKPOD(NAME, DOC, TYPE, INIT): Define a piece-of-data 'hook'. */
  17. /* Defaults for optional macros:
  18. DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
  19. with the previous 'hook'. */
  20. #ifndef DEFHOOKPODX
  21. #define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
  22. #endif
  23. /* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
  24. members into a struct gcc_target, which in turn contains several
  25. sub-structs. */
  26. #ifndef HOOKSTRUCT
  27. #define HOOKSTRUCT(FRAGMENT)
  28. #endif
  29. /* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
  30. HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
  31. name for nested use. */
  32. #ifndef HOOK_VECTOR_1
  33. #define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT (FRAGMENT)
  34. #endif
  35. #define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
  36. #define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
  37. /* FIXME: For pre-existing hooks, we can't place the documentation in the
  38. documentation field here till we get permission from the FSF to include
  39. it in GPLed software - the target hook documentation is so far only
  40. available under the GFDL. */
  41. /* A hook should generally be documented by a string in the DOC parameter,
  42. which should contain texinfo markup. If the documentation is only available
  43. under the GPL, but not under the GFDL, put it in a comment above the hook
  44. definition. If the function declaration is available both under GPL and
  45. GFDL, but the documentation is only available under the GFDL, put the
  46. documentaton in tm.texi.in, heading with @hook <hookname> and closing
  47. the paragraph with @end deftypefn / deftypevr as appropriate, and marking
  48. the next autogenerated hook with @hook <hookname>.
  49. In both these cases, leave the DOC string empty, i.e. "".
  50. Sometimes, for some historic reason the function declaration
  51. has to be documented differently
  52. than what it is. In that case, use DEFHOOK_UNDOC to suppress auto-generation
  53. of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so
  54. you can put GPLed documentation string there if you have hopes that you
  55. can clear the declaration & documentation for GFDL distribution later,
  56. in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
  57. to turn on the autogeneration of the documentation.
  58. A documentation string of "*" means not to emit any documentation at all,
  59. and is mainly used internally for DEFHOOK_UNDOC. It should generally not
  60. be used otherwise, but it has its use for exceptional cases where automatic
  61. documentation is not wanted, and the real documentation is elsewere, like
  62. for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
  63. purposes; they refer to structs, the components of which are documented as
  64. separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
  65. A DOC string of 0 is for internal use of DEFHOOKPODX and special table
  66. entries only. */
  67. /* Empty macro arguments are undefined in C90, so use an empty macro
  68. to close top-level hook structures. */
  69. #define C90_EMPTY_HACK