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