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