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