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