xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/target-hooks-macros.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Common macros for target hook definitions.
2*8feb0f0bSmrg    Copyright (C) 2001-2020 Free Software Foundation, Inc.
31debfc3dSmrg 
41debfc3dSmrg    This program is free software; you can redistribute it and/or modify it
51debfc3dSmrg    under the terms of the GNU General Public License as published by the
61debfc3dSmrg    Free Software Foundation; either version 3, or (at your option) any
71debfc3dSmrg    later version.
81debfc3dSmrg 
91debfc3dSmrg    This program is distributed in the hope that it will be useful,
101debfc3dSmrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
111debfc3dSmrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
121debfc3dSmrg    GNU General Public License for more details.
131debfc3dSmrg 
141debfc3dSmrg    You should have received a copy of the GNU General Public License
151debfc3dSmrg    along with this program; see the file COPYING3.  If not see
161debfc3dSmrg    <http://www.gnu.org/licenses/>.  */
171debfc3dSmrg 
181debfc3dSmrg /* The following macros should be provided by the including file:
191debfc3dSmrg 
201debfc3dSmrg    DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
211debfc3dSmrg    DEFHOOKPOD(NAME, DOC, TYPE, INIT): Define a piece-of-data 'hook'.  */
221debfc3dSmrg 
231debfc3dSmrg /* Defaults for optional macros:
241debfc3dSmrg    DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
251debfc3dSmrg    with the previous 'hook'.  */
261debfc3dSmrg #ifndef DEFHOOKPODX
271debfc3dSmrg #define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
281debfc3dSmrg #endif
291debfc3dSmrg 
301debfc3dSmrg /* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
311debfc3dSmrg    members into a struct gcc_target, which in turn contains several
321debfc3dSmrg    sub-structs.  */
331debfc3dSmrg #ifndef HOOKSTRUCT
341debfc3dSmrg #define HOOKSTRUCT(FRAGMENT)
351debfc3dSmrg #endif
361debfc3dSmrg /* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
371debfc3dSmrg    HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
381debfc3dSmrg                     name for nested use.  */
391debfc3dSmrg #ifndef HOOK_VECTOR_1
401debfc3dSmrg #define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT (FRAGMENT)
411debfc3dSmrg #endif
421debfc3dSmrg #define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
431debfc3dSmrg #define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
441debfc3dSmrg 
451debfc3dSmrg /* FIXME: For pre-existing hooks, we can't place the documentation in the
461debfc3dSmrg    documentation field here till we get permission from the FSF to include
471debfc3dSmrg    it in GPLed software - the target hook documentation is so far only
481debfc3dSmrg    available under the GFDL.  */
491debfc3dSmrg 
501debfc3dSmrg /* A hook should generally be documented by a string in the DOC parameter,
511debfc3dSmrg    which should contain texinfo markup.  If the documentation is only available
521debfc3dSmrg    under the GPL, but not under the GFDL, put it in a comment above the hook
531debfc3dSmrg    definition.  If the function declaration is available both under GPL and
541debfc3dSmrg    GFDL, but the documentation is only available under the GFDL, put the
551debfc3dSmrg    documentaton in tm.texi.in, heading with @hook <hookname> and closing
561debfc3dSmrg    the paragraph with @end deftypefn / deftypevr as appropriate, and marking
571debfc3dSmrg    the next autogenerated hook with @hook <hookname>.
581debfc3dSmrg    In both these cases, leave the DOC string empty, i.e. "".
591debfc3dSmrg    Sometimes, for some historic reason the function declaration
601debfc3dSmrg    has to be documented differently
611debfc3dSmrg    than what it is.  In that case, use DEFHOOK_UNDOC to suppress auto-generation
621debfc3dSmrg    of documentation.  DEFHOOK_UNDOC takes a DOC string which it ignores, so
631debfc3dSmrg    you can put GPLed documentation string there if you have hopes that you
641debfc3dSmrg    can clear the declaration & documentation for GFDL distribution later,
651debfc3dSmrg    in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
661debfc3dSmrg    to turn on the autogeneration of the documentation.
671debfc3dSmrg 
681debfc3dSmrg     A documentation string of "*" means not to emit any documentation at all,
691debfc3dSmrg    and is mainly used internally for DEFHOOK_UNDOC.  It should generally not
701debfc3dSmrg    be used otherwise, but it has its use for exceptional cases where automatic
711debfc3dSmrg    documentation is not wanted, and the real documentation is elsewere, like
721debfc3dSmrg    for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
731debfc3dSmrg    purposes; they refer to structs, the components of which are documented as
741debfc3dSmrg    separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
751debfc3dSmrg    A DOC string of 0 is for internal use of DEFHOOKPODX and special table
761debfc3dSmrg    entries only.  */
771debfc3dSmrg 
781debfc3dSmrg /* Empty macro arguments are undefined in C90, so use an empty macro
791debfc3dSmrg    to close top-level hook structures.  */
801debfc3dSmrg #define C90_EMPTY_HACK
81