xref: /dflybsd-src/contrib/gcc-4.7/gcc/doc/sourcebuild.texi (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino@c Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
2*e4b17023SJohn Marino@c Free Software Foundation, Inc.
3*e4b17023SJohn Marino@c This is part of the GCC manual.
4*e4b17023SJohn Marino@c For copying conditions, see the file gcc.texi.
5*e4b17023SJohn Marino
6*e4b17023SJohn Marino@node Source Tree
7*e4b17023SJohn Marino@chapter Source Tree Structure and Build System
8*e4b17023SJohn Marino
9*e4b17023SJohn MarinoThis chapter describes the structure of the GCC source tree, and how
10*e4b17023SJohn MarinoGCC is built.  The user documentation for building and installing GCC
11*e4b17023SJohn Marinois in a separate manual (@uref{http://gcc.gnu.org/install/}), with
12*e4b17023SJohn Marinowhich it is presumed that you are familiar.
13*e4b17023SJohn Marino
14*e4b17023SJohn Marino@menu
15*e4b17023SJohn Marino* Configure Terms:: Configuration terminology and history.
16*e4b17023SJohn Marino* Top Level::       The top level source directory.
17*e4b17023SJohn Marino* gcc Directory::   The @file{gcc} subdirectory.
18*e4b17023SJohn Marino@end menu
19*e4b17023SJohn Marino
20*e4b17023SJohn Marino@include configterms.texi
21*e4b17023SJohn Marino
22*e4b17023SJohn Marino@node Top Level
23*e4b17023SJohn Marino@section Top Level Source Directory
24*e4b17023SJohn Marino
25*e4b17023SJohn MarinoThe top level source directory in a GCC distribution contains several
26*e4b17023SJohn Marinofiles and directories that are shared with other software
27*e4b17023SJohn Marinodistributions such as that of GNU Binutils.  It also contains several
28*e4b17023SJohn Marinosubdirectories that contain parts of GCC and its runtime libraries:
29*e4b17023SJohn Marino
30*e4b17023SJohn Marino@table @file
31*e4b17023SJohn Marino@item boehm-gc
32*e4b17023SJohn MarinoThe Boehm conservative garbage collector, used as part of the Java
33*e4b17023SJohn Marinoruntime library.
34*e4b17023SJohn Marino
35*e4b17023SJohn Marino@item config
36*e4b17023SJohn MarinoAutoconf macros and Makefile fragments used throughout the tree.
37*e4b17023SJohn Marino
38*e4b17023SJohn Marino@item contrib
39*e4b17023SJohn MarinoContributed scripts that may be found useful in conjunction with GCC@.
40*e4b17023SJohn MarinoOne of these, @file{contrib/texi2pod.pl}, is used to generate man
41*e4b17023SJohn Marinopages from Texinfo manuals as part of the GCC build process.
42*e4b17023SJohn Marino
43*e4b17023SJohn Marino@item fixincludes
44*e4b17023SJohn MarinoThe support for fixing system headers to work with GCC@.  See
45*e4b17023SJohn Marino@file{fixincludes/README} for more information.  The headers fixed by
46*e4b17023SJohn Marinothis mechanism are installed in @file{@var{libsubdir}/include-fixed}.
47*e4b17023SJohn MarinoAlong with those headers, @file{README-fixinc} is also installed, as
48*e4b17023SJohn Marino@file{@var{libsubdir}/include-fixed/README}.
49*e4b17023SJohn Marino
50*e4b17023SJohn Marino@item gcc
51*e4b17023SJohn MarinoThe main sources of GCC itself (except for runtime libraries),
52*e4b17023SJohn Marinoincluding optimizers, support for different target architectures,
53*e4b17023SJohn Marinolanguage front ends, and testsuites.  @xref{gcc Directory, , The
54*e4b17023SJohn Marino@file{gcc} Subdirectory}, for details.
55*e4b17023SJohn Marino
56*e4b17023SJohn Marino@item gnattools
57*e4b17023SJohn MarinoSupport tools for GNAT.
58*e4b17023SJohn Marino
59*e4b17023SJohn Marino@item include
60*e4b17023SJohn MarinoHeaders for the @code{libiberty} library.
61*e4b17023SJohn Marino
62*e4b17023SJohn Marino@item intl
63*e4b17023SJohn MarinoGNU @code{libintl}, from GNU @code{gettext}, for systems which do not
64*e4b17023SJohn Marinoinclude it in @code{libc}.
65*e4b17023SJohn Marino
66*e4b17023SJohn Marino@item libada
67*e4b17023SJohn MarinoThe Ada runtime library.
68*e4b17023SJohn Marino
69*e4b17023SJohn Marino@item libcpp
70*e4b17023SJohn MarinoThe C preprocessor library.
71*e4b17023SJohn Marino
72*e4b17023SJohn Marino@item libdecnumber
73*e4b17023SJohn MarinoThe Decimal Float support library.
74*e4b17023SJohn Marino
75*e4b17023SJohn Marino@item libffi
76*e4b17023SJohn MarinoThe @code{libffi} library, used as part of the Java runtime library.
77*e4b17023SJohn Marino
78*e4b17023SJohn Marino@item libgcc
79*e4b17023SJohn MarinoThe GCC runtime library.
80*e4b17023SJohn Marino
81*e4b17023SJohn Marino@item libgfortran
82*e4b17023SJohn MarinoThe Fortran runtime library.
83*e4b17023SJohn Marino
84*e4b17023SJohn Marino@item libgo
85*e4b17023SJohn MarinoThe Go runtime library.  The bulk of this library is mirrored from the
86*e4b17023SJohn Marino@uref{http://code.google.com/@/p/@/go/, master Go repository}.
87*e4b17023SJohn Marino
88*e4b17023SJohn Marino@item libgomp
89*e4b17023SJohn MarinoThe GNU OpenMP runtime library.
90*e4b17023SJohn Marino
91*e4b17023SJohn Marino@item libiberty
92*e4b17023SJohn MarinoThe @code{libiberty} library, used for portability and for some
93*e4b17023SJohn Marinogenerally useful data structures and algorithms.  @xref{Top, ,
94*e4b17023SJohn MarinoIntroduction, libiberty, @sc{gnu} libiberty}, for more information
95*e4b17023SJohn Marinoabout this library.
96*e4b17023SJohn Marino
97*e4b17023SJohn Marino@item libjava
98*e4b17023SJohn MarinoThe Java runtime library.
99*e4b17023SJohn Marino
100*e4b17023SJohn Marino@item libmudflap
101*e4b17023SJohn MarinoThe @code{libmudflap} library, used for instrumenting pointer and array
102*e4b17023SJohn Marinodereferencing operations.
103*e4b17023SJohn Marino
104*e4b17023SJohn Marino@item libobjc
105*e4b17023SJohn MarinoThe Objective-C and Objective-C++ runtime library.
106*e4b17023SJohn Marino
107*e4b17023SJohn Marino@item libssp
108*e4b17023SJohn MarinoThe Stack protector runtime library.
109*e4b17023SJohn Marino
110*e4b17023SJohn Marino@item libstdc++-v3
111*e4b17023SJohn MarinoThe C++ runtime library.
112*e4b17023SJohn Marino
113*e4b17023SJohn Marino@item lto-plugin
114*e4b17023SJohn MarinoPlugin used by @command{gold} if link-time optimizations are enabled.
115*e4b17023SJohn Marino
116*e4b17023SJohn Marino@item maintainer-scripts
117*e4b17023SJohn MarinoScripts used by the @code{gccadmin} account on @code{gcc.gnu.org}.
118*e4b17023SJohn Marino
119*e4b17023SJohn Marino@item zlib
120*e4b17023SJohn MarinoThe @code{zlib} compression library, used by the Java front end, as
121*e4b17023SJohn Marinopart of the Java runtime library, and for compressing and uncompressing
122*e4b17023SJohn MarinoGCC's intermediate language in LTO object files.
123*e4b17023SJohn Marino@end table
124*e4b17023SJohn Marino
125*e4b17023SJohn MarinoThe build system in the top level directory, including how recursion
126*e4b17023SJohn Marinointo subdirectories works and how building runtime libraries for
127*e4b17023SJohn Marinomultilibs is handled, is documented in a separate manual, included
128*e4b17023SJohn Marinowith GNU Binutils.  @xref{Top, , GNU configure and build system,
129*e4b17023SJohn Marinoconfigure, The GNU configure and build system}, for details.
130*e4b17023SJohn Marino
131*e4b17023SJohn Marino@node gcc Directory
132*e4b17023SJohn Marino@section The @file{gcc} Subdirectory
133*e4b17023SJohn Marino
134*e4b17023SJohn MarinoThe @file{gcc} directory contains many files that are part of the C
135*e4b17023SJohn Marinosources of GCC, other files used as part of the configuration and
136*e4b17023SJohn Marinobuild process, and subdirectories including documentation and a
137*e4b17023SJohn Marinotestsuite.  The files that are sources of GCC are documented in a
138*e4b17023SJohn Marinoseparate chapter.  @xref{Passes, , Passes and Files of the Compiler}.
139*e4b17023SJohn Marino
140*e4b17023SJohn Marino@menu
141*e4b17023SJohn Marino* Subdirectories:: Subdirectories of @file{gcc}.
142*e4b17023SJohn Marino* Configuration::  The configuration process, and the files it uses.
143*e4b17023SJohn Marino* Build::          The build system in the @file{gcc} directory.
144*e4b17023SJohn Marino* Makefile::       Targets in @file{gcc/Makefile}.
145*e4b17023SJohn Marino* Library Files::  Library source files and headers under @file{gcc/}.
146*e4b17023SJohn Marino* Headers::        Headers installed by GCC.
147*e4b17023SJohn Marino* Documentation::  Building documentation in GCC.
148*e4b17023SJohn Marino* Front End::      Anatomy of a language front end.
149*e4b17023SJohn Marino* Back End::       Anatomy of a target back end.
150*e4b17023SJohn Marino@end menu
151*e4b17023SJohn Marino
152*e4b17023SJohn Marino@node Subdirectories
153*e4b17023SJohn Marino@subsection Subdirectories of @file{gcc}
154*e4b17023SJohn Marino
155*e4b17023SJohn MarinoThe @file{gcc} directory contains the following subdirectories:
156*e4b17023SJohn Marino
157*e4b17023SJohn Marino@table @file
158*e4b17023SJohn Marino@item @var{language}
159*e4b17023SJohn MarinoSubdirectories for various languages.  Directories containing a file
160*e4b17023SJohn Marino@file{config-lang.in} are language subdirectories.  The contents of
161*e4b17023SJohn Marinothe subdirectories @file{cp} (for C++), @file{lto} (for LTO),
162*e4b17023SJohn Marino@file{objc} (for Objective-C) and @file{objcp} (for Objective-C++) are
163*e4b17023SJohn Marinodocumented in this manual (@pxref{Passes, , Passes and Files of the
164*e4b17023SJohn MarinoCompiler}); those for other languages are not.  @xref{Front End, ,
165*e4b17023SJohn MarinoAnatomy of a Language Front End}, for details of the files in these
166*e4b17023SJohn Marinodirectories.
167*e4b17023SJohn Marino
168*e4b17023SJohn Marino@item config
169*e4b17023SJohn MarinoConfiguration files for supported architectures and operating
170*e4b17023SJohn Marinosystems.  @xref{Back End, , Anatomy of a Target Back End}, for
171*e4b17023SJohn Marinodetails of the files in this directory.
172*e4b17023SJohn Marino
173*e4b17023SJohn Marino@item doc
174*e4b17023SJohn MarinoTexinfo documentation for GCC, together with automatically generated
175*e4b17023SJohn Marinoman pages and support for converting the installation manual to
176*e4b17023SJohn MarinoHTML@.  @xref{Documentation}.
177*e4b17023SJohn Marino
178*e4b17023SJohn Marino@item ginclude
179*e4b17023SJohn MarinoSystem headers installed by GCC, mainly those required by the C
180*e4b17023SJohn Marinostandard of freestanding implementations.  @xref{Headers, , Headers
181*e4b17023SJohn MarinoInstalled by GCC}, for details of when these and other headers are
182*e4b17023SJohn Marinoinstalled.
183*e4b17023SJohn Marino
184*e4b17023SJohn Marino@item po
185*e4b17023SJohn MarinoMessage catalogs with translations of messages produced by GCC into
186*e4b17023SJohn Marinovarious languages, @file{@var{language}.po}.  This directory also
187*e4b17023SJohn Marinocontains @file{gcc.pot}, the template for these message catalogues,
188*e4b17023SJohn Marino@file{exgettext}, a wrapper around @command{gettext} to extract the
189*e4b17023SJohn Marinomessages from the GCC sources and create @file{gcc.pot}, which is run
190*e4b17023SJohn Marinoby @samp{make gcc.pot}, and @file{EXCLUDES}, a list of files from
191*e4b17023SJohn Marinowhich messages should not be extracted.
192*e4b17023SJohn Marino
193*e4b17023SJohn Marino@item testsuite
194*e4b17023SJohn MarinoThe GCC testsuites (except for those for runtime libraries).
195*e4b17023SJohn Marino@xref{Testsuites}.
196*e4b17023SJohn Marino@end table
197*e4b17023SJohn Marino
198*e4b17023SJohn Marino@node Configuration
199*e4b17023SJohn Marino@subsection Configuration in the @file{gcc} Directory
200*e4b17023SJohn Marino
201*e4b17023SJohn MarinoThe @file{gcc} directory is configured with an Autoconf-generated
202*e4b17023SJohn Marinoscript @file{configure}.  The @file{configure} script is generated
203*e4b17023SJohn Marinofrom @file{configure.ac} and @file{aclocal.m4}.  From the files
204*e4b17023SJohn Marino@file{configure.ac} and @file{acconfig.h}, Autoheader generates the
205*e4b17023SJohn Marinofile @file{config.in}.  The file @file{cstamp-h.in} is used as a
206*e4b17023SJohn Marinotimestamp.
207*e4b17023SJohn Marino
208*e4b17023SJohn Marino@menu
209*e4b17023SJohn Marino* Config Fragments::     Scripts used by @file{configure}.
210*e4b17023SJohn Marino* System Config::        The @file{config.build}, @file{config.host}, and
211*e4b17023SJohn Marino                         @file{config.gcc} files.
212*e4b17023SJohn Marino* Configuration Files::  Files created by running @file{configure}.
213*e4b17023SJohn Marino@end menu
214*e4b17023SJohn Marino
215*e4b17023SJohn Marino@node Config Fragments
216*e4b17023SJohn Marino@subsubsection Scripts Used by @file{configure}
217*e4b17023SJohn Marino
218*e4b17023SJohn Marino@file{configure} uses some other scripts to help in its work:
219*e4b17023SJohn Marino
220*e4b17023SJohn Marino@itemize @bullet
221*e4b17023SJohn Marino@item The standard GNU @file{config.sub} and @file{config.guess}
222*e4b17023SJohn Marinofiles, kept in the top level directory, are used.
223*e4b17023SJohn Marino
224*e4b17023SJohn Marino@item The file @file{config.gcc} is used to handle configuration
225*e4b17023SJohn Marinospecific to the particular target machine.  The file
226*e4b17023SJohn Marino@file{config.build} is used to handle configuration specific to the
227*e4b17023SJohn Marinoparticular build machine.  The file @file{config.host} is used to handle
228*e4b17023SJohn Marinoconfiguration specific to the particular host machine.  (In general,
229*e4b17023SJohn Marinothese should only be used for features that cannot reasonably be tested in
230*e4b17023SJohn MarinoAutoconf feature tests.)
231*e4b17023SJohn Marino@xref{System Config, , The @file{config.build}; @file{config.host};
232*e4b17023SJohn Marinoand @file{config.gcc} Files}, for details of the contents of these files.
233*e4b17023SJohn Marino
234*e4b17023SJohn Marino@item Each language subdirectory has a file
235*e4b17023SJohn Marino@file{@var{language}/config-lang.in} that is used for
236*e4b17023SJohn Marinofront-end-specific configuration.  @xref{Front End Config, , The Front
237*e4b17023SJohn MarinoEnd @file{config-lang.in} File}, for details of this file.
238*e4b17023SJohn Marino
239*e4b17023SJohn Marino@item A helper script @file{configure.frag} is used as part of
240*e4b17023SJohn Marinocreating the output of @file{configure}.
241*e4b17023SJohn Marino@end itemize
242*e4b17023SJohn Marino
243*e4b17023SJohn Marino@node System Config
244*e4b17023SJohn Marino@subsubsection The @file{config.build}; @file{config.host}; and @file{config.gcc} Files
245*e4b17023SJohn Marino
246*e4b17023SJohn MarinoThe @file{config.build} file contains specific rules for particular systems
247*e4b17023SJohn Marinowhich GCC is built on.  This should be used as rarely as possible, as the
248*e4b17023SJohn Marinobehavior of the build system can always be detected by autoconf.
249*e4b17023SJohn Marino
250*e4b17023SJohn MarinoThe @file{config.host} file contains specific rules for particular systems
251*e4b17023SJohn Marinowhich GCC will run on.  This is rarely needed.
252*e4b17023SJohn Marino
253*e4b17023SJohn MarinoThe @file{config.gcc} file contains specific rules for particular systems
254*e4b17023SJohn Marinowhich GCC will generate code for.  This is usually needed.
255*e4b17023SJohn Marino
256*e4b17023SJohn MarinoEach file has a list of the shell variables it sets, with descriptions, at the
257*e4b17023SJohn Marinotop of the file.
258*e4b17023SJohn Marino
259*e4b17023SJohn MarinoFIXME: document the contents of these files, and what variables should
260*e4b17023SJohn Marinobe set to control build, host and target configuration.
261*e4b17023SJohn Marino
262*e4b17023SJohn Marino@include configfiles.texi
263*e4b17023SJohn Marino
264*e4b17023SJohn Marino@node Build
265*e4b17023SJohn Marino@subsection Build System in the @file{gcc} Directory
266*e4b17023SJohn Marino
267*e4b17023SJohn MarinoFIXME: describe the build system, including what is built in what
268*e4b17023SJohn Marinostages.  Also list the various source files that are used in the build
269*e4b17023SJohn Marinoprocess but aren't source files of GCC itself and so aren't documented
270*e4b17023SJohn Marinobelow (@pxref{Passes}).
271*e4b17023SJohn Marino
272*e4b17023SJohn Marino@include makefile.texi
273*e4b17023SJohn Marino
274*e4b17023SJohn Marino@node Library Files
275*e4b17023SJohn Marino@subsection Library Source Files and Headers under the @file{gcc} Directory
276*e4b17023SJohn Marino
277*e4b17023SJohn MarinoFIXME: list here, with explanation, all the C source files and headers
278*e4b17023SJohn Marinounder the @file{gcc} directory that aren't built into the GCC
279*e4b17023SJohn Marinoexecutable but rather are part of runtime libraries and object files,
280*e4b17023SJohn Marinosuch as @file{crtstuff.c} and @file{unwind-dw2.c}.  @xref{Headers, ,
281*e4b17023SJohn MarinoHeaders Installed by GCC}, for more information about the
282*e4b17023SJohn Marino@file{ginclude} directory.
283*e4b17023SJohn Marino
284*e4b17023SJohn Marino@node Headers
285*e4b17023SJohn Marino@subsection Headers Installed by GCC
286*e4b17023SJohn Marino
287*e4b17023SJohn MarinoIn general, GCC expects the system C library to provide most of the
288*e4b17023SJohn Marinoheaders to be used with it.  However, GCC will fix those headers if
289*e4b17023SJohn Marinonecessary to make them work with GCC, and will install some headers
290*e4b17023SJohn Marinorequired of freestanding implementations.  These headers are installed
291*e4b17023SJohn Marinoin @file{@var{libsubdir}/include}.  Headers for non-C runtime
292*e4b17023SJohn Marinolibraries are also installed by GCC; these are not documented here.
293*e4b17023SJohn Marino(FIXME: document them somewhere.)
294*e4b17023SJohn Marino
295*e4b17023SJohn MarinoSeveral of the headers GCC installs are in the @file{ginclude}
296*e4b17023SJohn Marinodirectory.  These headers, @file{iso646.h},
297*e4b17023SJohn Marino@file{stdarg.h}, @file{stdbool.h}, and @file{stddef.h},
298*e4b17023SJohn Marinoare installed in @file{@var{libsubdir}/include},
299*e4b17023SJohn Marinounless the target Makefile fragment (@pxref{Target Fragment})
300*e4b17023SJohn Marinooverrides this by setting @code{USER_H}.
301*e4b17023SJohn Marino
302*e4b17023SJohn MarinoIn addition to these headers and those generated by fixing system
303*e4b17023SJohn Marinoheaders to work with GCC, some other headers may also be installed in
304*e4b17023SJohn Marino@file{@var{libsubdir}/include}.  @file{config.gcc} may set
305*e4b17023SJohn Marino@code{extra_headers}; this specifies additional headers under
306*e4b17023SJohn Marino@file{config} to be installed on some systems.
307*e4b17023SJohn Marino
308*e4b17023SJohn MarinoGCC installs its own version of @code{<float.h>}, from @file{ginclude/float.h}.
309*e4b17023SJohn MarinoThis is done to cope with command-line options that change the
310*e4b17023SJohn Marinorepresentation of floating point numbers.
311*e4b17023SJohn Marino
312*e4b17023SJohn MarinoGCC also installs its own version of @code{<limits.h>}; this is generated
313*e4b17023SJohn Marinofrom @file{glimits.h}, together with @file{limitx.h} and
314*e4b17023SJohn Marino@file{limity.h} if the system also has its own version of
315*e4b17023SJohn Marino@code{<limits.h>}.  (GCC provides its own header because it is
316*e4b17023SJohn Marinorequired of ISO C freestanding implementations, but needs to include
317*e4b17023SJohn Marinothe system header from its own header as well because other standards
318*e4b17023SJohn Marinosuch as POSIX specify additional values to be defined in
319*e4b17023SJohn Marino@code{<limits.h>}.)  The system's @code{<limits.h>} header is used via
320*e4b17023SJohn Marino@file{@var{libsubdir}/include/syslimits.h}, which is copied from
321*e4b17023SJohn Marino@file{gsyslimits.h} if it does not need fixing to work with GCC; if it
322*e4b17023SJohn Marinoneeds fixing, @file{syslimits.h} is the fixed copy.
323*e4b17023SJohn Marino
324*e4b17023SJohn MarinoGCC can also install @code{<tgmath.h>}.  It will do this when
325*e4b17023SJohn Marino@file{config.gcc} sets @code{use_gcc_tgmath} to @code{yes}.
326*e4b17023SJohn Marino
327*e4b17023SJohn Marino@node Documentation
328*e4b17023SJohn Marino@subsection Building Documentation
329*e4b17023SJohn Marino
330*e4b17023SJohn MarinoThe main GCC documentation is in the form of manuals in Texinfo
331*e4b17023SJohn Marinoformat.  These are installed in Info format; DVI versions may be
332*e4b17023SJohn Marinogenerated by @samp{make dvi}, PDF versions by @samp{make pdf}, and
333*e4b17023SJohn MarinoHTML versions by @samp{make html}.  In addition, some man pages are
334*e4b17023SJohn Marinogenerated from the Texinfo manuals, there are some other text files
335*e4b17023SJohn Marinowith miscellaneous documentation, and runtime libraries have their own
336*e4b17023SJohn Marinodocumentation outside the @file{gcc} directory.  FIXME: document the
337*e4b17023SJohn Marinodocumentation for runtime libraries somewhere.
338*e4b17023SJohn Marino
339*e4b17023SJohn Marino@menu
340*e4b17023SJohn Marino* Texinfo Manuals::      GCC manuals in Texinfo format.
341*e4b17023SJohn Marino* Man Page Generation::  Generating man pages from Texinfo manuals.
342*e4b17023SJohn Marino* Miscellaneous Docs::   Miscellaneous text files with documentation.
343*e4b17023SJohn Marino@end menu
344*e4b17023SJohn Marino
345*e4b17023SJohn Marino@node Texinfo Manuals
346*e4b17023SJohn Marino@subsubsection Texinfo Manuals
347*e4b17023SJohn Marino
348*e4b17023SJohn MarinoThe manuals for GCC as a whole, and the C and C++ front ends, are in
349*e4b17023SJohn Marinofiles @file{doc/*.texi}.  Other front ends have their own manuals in
350*e4b17023SJohn Marinofiles @file{@var{language}/*.texi}.  Common files
351*e4b17023SJohn Marino@file{doc/include/*.texi} are provided which may be included in
352*e4b17023SJohn Marinomultiple manuals; the following files are in @file{doc/include}:
353*e4b17023SJohn Marino
354*e4b17023SJohn Marino@table @file
355*e4b17023SJohn Marino@item fdl.texi
356*e4b17023SJohn MarinoThe GNU Free Documentation License.
357*e4b17023SJohn Marino@item funding.texi
358*e4b17023SJohn MarinoThe section ``Funding Free Software''.
359*e4b17023SJohn Marino@item gcc-common.texi
360*e4b17023SJohn MarinoCommon definitions for manuals.
361*e4b17023SJohn Marino@item gpl.texi
362*e4b17023SJohn Marino@itemx gpl_v3.texi
363*e4b17023SJohn MarinoThe GNU General Public License.
364*e4b17023SJohn Marino@item texinfo.tex
365*e4b17023SJohn MarinoA copy of @file{texinfo.tex} known to work with the GCC manuals.
366*e4b17023SJohn Marino@end table
367*e4b17023SJohn Marino
368*e4b17023SJohn MarinoDVI-formatted manuals are generated by @samp{make dvi}, which uses
369*e4b17023SJohn Marino@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}).
370*e4b17023SJohn MarinoPDF-formatted manuals are generated by @samp{make pdf}, which uses
371*e4b17023SJohn Marino@command{texi2pdf} (via the Makefile macro @code{$(TEXI2PDF)}).  HTML
372*e4b17023SJohn Marinoformatted manuals are generated by @samp{make html}.  Info
373*e4b17023SJohn Marinomanuals are generated by @samp{make info} (which is run as part of
374*e4b17023SJohn Marinoa bootstrap); this generates the manuals in the source directory,
375*e4b17023SJohn Marinousing @command{makeinfo} via the Makefile macro @code{$(MAKEINFO)},
376*e4b17023SJohn Marinoand they are included in release distributions.
377*e4b17023SJohn Marino
378*e4b17023SJohn MarinoManuals are also provided on the GCC web site, in both HTML and
379*e4b17023SJohn MarinoPostScript forms.  This is done via the script
380*e4b17023SJohn Marino@file{maintainer-scripts/update_web_docs_svn}.  Each manual to be
381*e4b17023SJohn Marinoprovided online must be listed in the definition of @code{MANUALS} in
382*e4b17023SJohn Marinothat file; a file @file{@var{name}.texi} must only appear once in the
383*e4b17023SJohn Marinosource tree, and the output manual must have the same name as the
384*e4b17023SJohn Marinosource file.  (However, other Texinfo files, included in manuals but
385*e4b17023SJohn Marinonot themselves the root files of manuals, may have names that appear
386*e4b17023SJohn Marinomore than once in the source tree.)  The manual file
387*e4b17023SJohn Marino@file{@var{name}.texi} should only include other files in its own
388*e4b17023SJohn Marinodirectory or in @file{doc/include}.  HTML manuals will be generated by
389*e4b17023SJohn Marino@samp{makeinfo --html}, PostScript manuals by @command{texi2dvi}
390*e4b17023SJohn Marinoand @command{dvips}, and PDF manuals by @command{texi2pdf}.
391*e4b17023SJohn MarinoAll Texinfo files that are parts of manuals must
392*e4b17023SJohn Marinobe version-controlled, even if they are generated files, for the
393*e4b17023SJohn Marinogeneration of online manuals to work.
394*e4b17023SJohn Marino
395*e4b17023SJohn MarinoThe installation manual, @file{doc/install.texi}, is also provided on
396*e4b17023SJohn Marinothe GCC web site.  The HTML version is generated by the script
397*e4b17023SJohn Marino@file{doc/install.texi2html}.
398*e4b17023SJohn Marino
399*e4b17023SJohn Marino@node Man Page Generation
400*e4b17023SJohn Marino@subsubsection Man Page Generation
401*e4b17023SJohn Marino
402*e4b17023SJohn MarinoBecause of user demand, in addition to full Texinfo manuals, man pages
403*e4b17023SJohn Marinoare provided which contain extracts from those manuals.  These man
404*e4b17023SJohn Marinopages are generated from the Texinfo manuals using
405*e4b17023SJohn Marino@file{contrib/texi2pod.pl} and @command{pod2man}.  (The man page for
406*e4b17023SJohn Marino@command{g++}, @file{cp/g++.1}, just contains a @samp{.so} reference
407*e4b17023SJohn Marinoto @file{gcc.1}, but all the other man pages are generated from
408*e4b17023SJohn MarinoTexinfo manuals.)
409*e4b17023SJohn Marino
410*e4b17023SJohn MarinoBecause many systems may not have the necessary tools installed to
411*e4b17023SJohn Marinogenerate the man pages, they are only generated if the
412*e4b17023SJohn Marino@file{configure} script detects that recent enough tools are
413*e4b17023SJohn Marinoinstalled, and the Makefiles allow generating man pages to fail
414*e4b17023SJohn Marinowithout aborting the build.  Man pages are also included in release
415*e4b17023SJohn Marinodistributions.  They are generated in the source directory.
416*e4b17023SJohn Marino
417*e4b17023SJohn MarinoMagic comments in Texinfo files starting @samp{@@c man} control what
418*e4b17023SJohn Marinoparts of a Texinfo file go into a man page.  Only a subset of Texinfo
419*e4b17023SJohn Marinois supported by @file{texi2pod.pl}, and it may be necessary to add
420*e4b17023SJohn Marinosupport for more Texinfo features to this script when generating new
421*e4b17023SJohn Marinoman pages.  To improve the man page output, some special Texinfo
422*e4b17023SJohn Marinomacros are provided in @file{doc/include/gcc-common.texi} which
423*e4b17023SJohn Marino@file{texi2pod.pl} understands:
424*e4b17023SJohn Marino
425*e4b17023SJohn Marino@table @code
426*e4b17023SJohn Marino@item @@gcctabopt
427*e4b17023SJohn MarinoUse in the form @samp{@@table @@gcctabopt} for tables of options,
428*e4b17023SJohn Marinowhere for printed output the effect of @samp{@@code} is better than
429*e4b17023SJohn Marinothat of @samp{@@option} but for man page output a different effect is
430*e4b17023SJohn Marinowanted.
431*e4b17023SJohn Marino@item @@gccoptlist
432*e4b17023SJohn MarinoUse for summary lists of options in manuals.
433*e4b17023SJohn Marino@item @@gol
434*e4b17023SJohn MarinoUse at the end of each line inside @samp{@@gccoptlist}.  This is
435*e4b17023SJohn Marinonecessary to avoid problems with differences in how the
436*e4b17023SJohn Marino@samp{@@gccoptlist} macro is handled by different Texinfo formatters.
437*e4b17023SJohn Marino@end table
438*e4b17023SJohn Marino
439*e4b17023SJohn MarinoFIXME: describe the @file{texi2pod.pl} input language and magic
440*e4b17023SJohn Marinocomments in more detail.
441*e4b17023SJohn Marino
442*e4b17023SJohn Marino@node Miscellaneous Docs
443*e4b17023SJohn Marino@subsubsection Miscellaneous Documentation
444*e4b17023SJohn Marino
445*e4b17023SJohn MarinoIn addition to the formal documentation that is installed by GCC,
446*e4b17023SJohn Marinothere are several other text files in the @file{gcc} subdirectory
447*e4b17023SJohn Marinowith miscellaneous documentation:
448*e4b17023SJohn Marino
449*e4b17023SJohn Marino@table @file
450*e4b17023SJohn Marino@item ABOUT-GCC-NLS
451*e4b17023SJohn MarinoNotes on GCC's Native Language Support.  FIXME: this should be part of
452*e4b17023SJohn Marinothis manual rather than a separate file.
453*e4b17023SJohn Marino@item ABOUT-NLS
454*e4b17023SJohn MarinoNotes on the Free Translation Project.
455*e4b17023SJohn Marino@item COPYING
456*e4b17023SJohn Marino@itemx COPYING3
457*e4b17023SJohn MarinoThe GNU General Public License, Versions 2 and 3.
458*e4b17023SJohn Marino@item COPYING.LIB
459*e4b17023SJohn Marino@itemx COPYING3.LIB
460*e4b17023SJohn MarinoThe GNU Lesser General Public License, Versions 2.1 and 3.
461*e4b17023SJohn Marino@item *ChangeLog*
462*e4b17023SJohn Marino@itemx */ChangeLog*
463*e4b17023SJohn MarinoChange log files for various parts of GCC@.
464*e4b17023SJohn Marino@item LANGUAGES
465*e4b17023SJohn MarinoDetails of a few changes to the GCC front-end interface.  FIXME: the
466*e4b17023SJohn Marinoinformation in this file should be part of general documentation of
467*e4b17023SJohn Marinothe front-end interface in this manual.
468*e4b17023SJohn Marino@item ONEWS
469*e4b17023SJohn MarinoInformation about new features in old versions of GCC@.  (For recent
470*e4b17023SJohn Marinoversions, the information is on the GCC web site.)
471*e4b17023SJohn Marino@item README.Portability
472*e4b17023SJohn MarinoInformation about portability issues when writing code in GCC@.  FIXME:
473*e4b17023SJohn Marinowhy isn't this part of this manual or of the GCC Coding Conventions?
474*e4b17023SJohn Marino@end table
475*e4b17023SJohn Marino
476*e4b17023SJohn MarinoFIXME: document such files in subdirectories, at least @file{config},
477*e4b17023SJohn Marino@file{cp}, @file{objc}, @file{testsuite}.
478*e4b17023SJohn Marino
479*e4b17023SJohn Marino@node Front End
480*e4b17023SJohn Marino@subsection Anatomy of a Language Front End
481*e4b17023SJohn Marino
482*e4b17023SJohn MarinoA front end for a language in GCC has the following parts:
483*e4b17023SJohn Marino
484*e4b17023SJohn Marino@itemize @bullet
485*e4b17023SJohn Marino@item
486*e4b17023SJohn MarinoA directory @file{@var{language}} under @file{gcc} containing source
487*e4b17023SJohn Marinofiles for that front end.  @xref{Front End Directory, , The Front End
488*e4b17023SJohn Marino@file{@var{language}} Directory}, for details.
489*e4b17023SJohn Marino@item
490*e4b17023SJohn MarinoA mention of the language in the list of supported languages in
491*e4b17023SJohn Marino@file{gcc/doc/install.texi}.
492*e4b17023SJohn Marino@item
493*e4b17023SJohn MarinoA mention of the name under which the language's runtime library is
494*e4b17023SJohn Marinorecognized by @option{--enable-shared=@var{package}} in the
495*e4b17023SJohn Marinodocumentation of that option in @file{gcc/doc/install.texi}.
496*e4b17023SJohn Marino@item
497*e4b17023SJohn MarinoA mention of any special prerequisites for building the front end in
498*e4b17023SJohn Marinothe documentation of prerequisites in @file{gcc/doc/install.texi}.
499*e4b17023SJohn Marino@item
500*e4b17023SJohn MarinoDetails of contributors to that front end in
501*e4b17023SJohn Marino@file{gcc/doc/contrib.texi}.  If the details are in that front end's
502*e4b17023SJohn Marinoown manual then there should be a link to that manual's list in
503*e4b17023SJohn Marino@file{contrib.texi}.
504*e4b17023SJohn Marino@item
505*e4b17023SJohn MarinoInformation about support for that language in
506*e4b17023SJohn Marino@file{gcc/doc/frontends.texi}.
507*e4b17023SJohn Marino@item
508*e4b17023SJohn MarinoInformation about standards for that language, and the front end's
509*e4b17023SJohn Marinosupport for them, in @file{gcc/doc/standards.texi}.  This may be a
510*e4b17023SJohn Marinolink to such information in the front end's own manual.
511*e4b17023SJohn Marino@item
512*e4b17023SJohn MarinoDetails of source file suffixes for that language and @option{-x
513*e4b17023SJohn Marino@var{lang}} options supported, in @file{gcc/doc/invoke.texi}.
514*e4b17023SJohn Marino@item
515*e4b17023SJohn MarinoEntries in @code{default_compilers} in @file{gcc.c} for source file
516*e4b17023SJohn Marinosuffixes for that language.
517*e4b17023SJohn Marino@item
518*e4b17023SJohn MarinoPreferably testsuites, which may be under @file{gcc/testsuite} or
519*e4b17023SJohn Marinoruntime library directories.  FIXME: document somewhere how to write
520*e4b17023SJohn Marinotestsuite harnesses.
521*e4b17023SJohn Marino@item
522*e4b17023SJohn MarinoProbably a runtime library for the language, outside the @file{gcc}
523*e4b17023SJohn Marinodirectory.  FIXME: document this further.
524*e4b17023SJohn Marino@item
525*e4b17023SJohn MarinoDetails of the directories of any runtime libraries in
526*e4b17023SJohn Marino@file{gcc/doc/sourcebuild.texi}.
527*e4b17023SJohn Marino@item
528*e4b17023SJohn MarinoCheck targets in @file{Makefile.def} for the top-level @file{Makefile}
529*e4b17023SJohn Marinoto check just the compiler or the compiler and runtime library for the
530*e4b17023SJohn Marinolanguage.
531*e4b17023SJohn Marino@end itemize
532*e4b17023SJohn Marino
533*e4b17023SJohn MarinoIf the front end is added to the official GCC source repository, the
534*e4b17023SJohn Marinofollowing are also necessary:
535*e4b17023SJohn Marino
536*e4b17023SJohn Marino@itemize @bullet
537*e4b17023SJohn Marino@item
538*e4b17023SJohn MarinoAt least one Bugzilla component for bugs in that front end and runtime
539*e4b17023SJohn Marinolibraries.  This category needs to be added to the Bugzilla database.
540*e4b17023SJohn Marino@item
541*e4b17023SJohn MarinoNormally, one or more maintainers of that front end listed in
542*e4b17023SJohn Marino@file{MAINTAINERS}.
543*e4b17023SJohn Marino@item
544*e4b17023SJohn MarinoMentions on the GCC web site in @file{index.html} and
545*e4b17023SJohn Marino@file{frontends.html}, with any relevant links on
546*e4b17023SJohn Marino@file{readings.html}.  (Front ends that are not an official part of
547*e4b17023SJohn MarinoGCC may also be listed on @file{frontends.html}, with relevant links.)
548*e4b17023SJohn Marino@item
549*e4b17023SJohn MarinoA news item on @file{index.html}, and possibly an announcement on the
550*e4b17023SJohn Marino@email{gcc-announce@@gcc.gnu.org} mailing list.
551*e4b17023SJohn Marino@item
552*e4b17023SJohn MarinoThe front end's manuals should be mentioned in
553*e4b17023SJohn Marino@file{maintainer-scripts/update_web_docs_svn} (@pxref{Texinfo Manuals})
554*e4b17023SJohn Marinoand the online manuals should be linked to from
555*e4b17023SJohn Marino@file{onlinedocs/index.html}.
556*e4b17023SJohn Marino@item
557*e4b17023SJohn MarinoAny old releases or CVS repositories of the front end, before its
558*e4b17023SJohn Marinoinclusion in GCC, should be made available on the GCC FTP site
559*e4b17023SJohn Marino@uref{ftp://gcc.gnu.org/pub/gcc/old-releases/}.
560*e4b17023SJohn Marino@item
561*e4b17023SJohn MarinoThe release and snapshot script @file{maintainer-scripts/gcc_release}
562*e4b17023SJohn Marinoshould be updated to generate appropriate tarballs for this front end.
563*e4b17023SJohn Marino@item
564*e4b17023SJohn MarinoIf this front end includes its own version files that include the
565*e4b17023SJohn Marinocurrent date, @file{maintainer-scripts/update_version} should be
566*e4b17023SJohn Marinoupdated accordingly.
567*e4b17023SJohn Marino@end itemize
568*e4b17023SJohn Marino
569*e4b17023SJohn Marino@menu
570*e4b17023SJohn Marino* Front End Directory::  The front end @file{@var{language}} directory.
571*e4b17023SJohn Marino* Front End Config::     The front end @file{config-lang.in} file.
572*e4b17023SJohn Marino* Front End Makefile::   The front end @file{Make-lang.in} file.
573*e4b17023SJohn Marino@end menu
574*e4b17023SJohn Marino
575*e4b17023SJohn Marino@node Front End Directory
576*e4b17023SJohn Marino@subsubsection The Front End @file{@var{language}} Directory
577*e4b17023SJohn Marino
578*e4b17023SJohn MarinoA front end @file{@var{language}} directory contains the source files
579*e4b17023SJohn Marinoof that front end (but not of any runtime libraries, which should be
580*e4b17023SJohn Marinooutside the @file{gcc} directory).  This includes documentation, and
581*e4b17023SJohn Marinopossibly some subsidiary programs built alongside the front end.
582*e4b17023SJohn MarinoCertain files are special and other parts of the compiler depend on
583*e4b17023SJohn Marinotheir names:
584*e4b17023SJohn Marino
585*e4b17023SJohn Marino@table @file
586*e4b17023SJohn Marino@item config-lang.in
587*e4b17023SJohn MarinoThis file is required in all language subdirectories.  @xref{Front End
588*e4b17023SJohn MarinoConfig, , The Front End @file{config-lang.in} File}, for details of
589*e4b17023SJohn Marinoits contents
590*e4b17023SJohn Marino@item Make-lang.in
591*e4b17023SJohn MarinoThis file is required in all language subdirectories.  @xref{Front End
592*e4b17023SJohn MarinoMakefile, , The Front End @file{Make-lang.in} File}, for details of its
593*e4b17023SJohn Marinocontents.
594*e4b17023SJohn Marino@item lang.opt
595*e4b17023SJohn MarinoThis file registers the set of switches that the front end accepts on
596*e4b17023SJohn Marinothe command line, and their @option{--help} text.  @xref{Options}.
597*e4b17023SJohn Marino@item lang-specs.h
598*e4b17023SJohn MarinoThis file provides entries for @code{default_compilers} in
599*e4b17023SJohn Marino@file{gcc.c} which override the default of giving an error that a
600*e4b17023SJohn Marinocompiler for that language is not installed.
601*e4b17023SJohn Marino@item @var{language}-tree.def
602*e4b17023SJohn MarinoThis file, which need not exist, defines any language-specific tree
603*e4b17023SJohn Marinocodes.
604*e4b17023SJohn Marino@end table
605*e4b17023SJohn Marino
606*e4b17023SJohn Marino@node Front End Config
607*e4b17023SJohn Marino@subsubsection The Front End @file{config-lang.in} File
608*e4b17023SJohn Marino
609*e4b17023SJohn MarinoEach language subdirectory contains a @file{config-lang.in} file.  In
610*e4b17023SJohn Marinoaddition the main directory contains @file{c-config-lang.in}, which
611*e4b17023SJohn Marinocontains limited information for the C language.  This file is a shell
612*e4b17023SJohn Marinoscript that may define some variables describing the language:
613*e4b17023SJohn Marino
614*e4b17023SJohn Marino@table @code
615*e4b17023SJohn Marino@item language
616*e4b17023SJohn MarinoThis definition must be present, and gives the name of the language
617*e4b17023SJohn Marinofor some purposes such as arguments to @option{--enable-languages}.
618*e4b17023SJohn Marino@item lang_requires
619*e4b17023SJohn MarinoIf defined, this variable lists (space-separated) language front ends
620*e4b17023SJohn Marinoother than C that this front end requires to be enabled (with the
621*e4b17023SJohn Marinonames given being their @code{language} settings).  For example, the
622*e4b17023SJohn MarinoJava front end depends on the C++ front end, so sets
623*e4b17023SJohn Marino@samp{lang_requires=c++}.
624*e4b17023SJohn Marino@item subdir_requires
625*e4b17023SJohn MarinoIf defined, this variable lists (space-separated) front end directories
626*e4b17023SJohn Marinoother than C that this front end requires to be present.  For example,
627*e4b17023SJohn Marinothe Objective-C++ front end uses source files from the C++ and
628*e4b17023SJohn MarinoObjective-C front ends, so sets @samp{subdir_requires="cp objc"}.
629*e4b17023SJohn Marino@item target_libs
630*e4b17023SJohn MarinoIf defined, this variable lists (space-separated) targets in the top
631*e4b17023SJohn Marinolevel @file{Makefile} to build the runtime libraries for this
632*e4b17023SJohn Marinolanguage, such as @code{target-libobjc}.
633*e4b17023SJohn Marino@item lang_dirs
634*e4b17023SJohn MarinoIf defined, this variable lists (space-separated) top level
635*e4b17023SJohn Marinodirectories (parallel to @file{gcc}), apart from the runtime libraries,
636*e4b17023SJohn Marinothat should not be configured if this front end is not built.
637*e4b17023SJohn Marino@item build_by_default
638*e4b17023SJohn MarinoIf defined to @samp{no}, this language front end is not built unless
639*e4b17023SJohn Marinoenabled in a @option{--enable-languages} argument.  Otherwise, front
640*e4b17023SJohn Marinoends are built by default, subject to any special logic in
641*e4b17023SJohn Marino@file{configure.ac} (as is present to disable the Ada front end if the
642*e4b17023SJohn MarinoAda compiler is not already installed).
643*e4b17023SJohn Marino@item boot_language
644*e4b17023SJohn MarinoIf defined to @samp{yes}, this front end is built in stage1 of the
645*e4b17023SJohn Marinobootstrap.  This is only relevant to front ends written in their own
646*e4b17023SJohn Marinolanguages.
647*e4b17023SJohn Marino@item compilers
648*e4b17023SJohn MarinoIf defined, a space-separated list of compiler executables that will
649*e4b17023SJohn Marinobe run by the driver.  The names here will each end
650*e4b17023SJohn Marinowith @samp{\$(exeext)}.
651*e4b17023SJohn Marino@item outputs
652*e4b17023SJohn MarinoIf defined, a space-separated list of files that should be generated
653*e4b17023SJohn Marinoby @file{configure} substituting values in them.  This mechanism can
654*e4b17023SJohn Marinobe used to create a file @file{@var{language}/Makefile} from
655*e4b17023SJohn Marino@file{@var{language}/Makefile.in}, but this is deprecated, building
656*e4b17023SJohn Marinoeverything from the single @file{gcc/Makefile} is preferred.
657*e4b17023SJohn Marino@item gtfiles
658*e4b17023SJohn MarinoIf defined, a space-separated list of files that should be scanned by
659*e4b17023SJohn Marino@file{gengtype.c} to generate the garbage collection tables and routines for
660*e4b17023SJohn Marinothis language.  This excludes the files that are common to all front
661*e4b17023SJohn Marinoends.  @xref{Type Information}.
662*e4b17023SJohn Marino
663*e4b17023SJohn Marino@end table
664*e4b17023SJohn Marino
665*e4b17023SJohn Marino@node Front End Makefile
666*e4b17023SJohn Marino@subsubsection The Front End @file{Make-lang.in} File
667*e4b17023SJohn Marino
668*e4b17023SJohn MarinoEach language subdirectory contains a @file{Make-lang.in} file.  It contains
669*e4b17023SJohn Marinotargets @code{@var{lang}.@var{hook}} (where @code{@var{lang}} is the
670*e4b17023SJohn Marinosetting of @code{language} in @file{config-lang.in}) for the following
671*e4b17023SJohn Marinovalues of @code{@var{hook}}, and any other Makefile rules required to
672*e4b17023SJohn Marinobuild those targets (which may if necessary use other Makefiles
673*e4b17023SJohn Marinospecified in @code{outputs} in @file{config-lang.in}, although this is
674*e4b17023SJohn Marinodeprecated).  It also adds any testsuite targets that can use the
675*e4b17023SJohn Marinostandard rule in @file{gcc/Makefile.in} to the variable
676*e4b17023SJohn Marino@code{lang_checks}.
677*e4b17023SJohn Marino
678*e4b17023SJohn Marino@table @code
679*e4b17023SJohn Marino@itemx all.cross
680*e4b17023SJohn Marino@itemx start.encap
681*e4b17023SJohn Marino@itemx rest.encap
682*e4b17023SJohn MarinoFIXME: exactly what goes in each of these targets?
683*e4b17023SJohn Marino@item tags
684*e4b17023SJohn MarinoBuild an @command{etags} @file{TAGS} file in the language subdirectory
685*e4b17023SJohn Marinoin the source tree.
686*e4b17023SJohn Marino@item info
687*e4b17023SJohn MarinoBuild info documentation for the front end, in the build directory.
688*e4b17023SJohn MarinoThis target is only called by @samp{make bootstrap} if a suitable
689*e4b17023SJohn Marinoversion of @command{makeinfo} is available, so does not need to check
690*e4b17023SJohn Marinofor this, and should fail if an error occurs.
691*e4b17023SJohn Marino@item dvi
692*e4b17023SJohn MarinoBuild DVI documentation for the front end, in the build directory.
693*e4b17023SJohn MarinoThis should be done using @code{$(TEXI2DVI)}, with appropriate
694*e4b17023SJohn Marino@option{-I} arguments pointing to directories of included files.
695*e4b17023SJohn Marino@item pdf
696*e4b17023SJohn MarinoBuild PDF documentation for the front end, in the build directory.
697*e4b17023SJohn MarinoThis should be done using @code{$(TEXI2PDF)}, with appropriate
698*e4b17023SJohn Marino@option{-I} arguments pointing to directories of included files.
699*e4b17023SJohn Marino@item html
700*e4b17023SJohn MarinoBuild HTML documentation for the front end, in the build directory.
701*e4b17023SJohn Marino@item man
702*e4b17023SJohn MarinoBuild generated man pages for the front end from Texinfo manuals
703*e4b17023SJohn Marino(@pxref{Man Page Generation}), in the build directory.  This target
704*e4b17023SJohn Marinois only called if the necessary tools are available, but should ignore
705*e4b17023SJohn Marinoerrors so as not to stop the build if errors occur; man pages are
706*e4b17023SJohn Marinooptional and the tools involved may be installed in a broken way.
707*e4b17023SJohn Marino@item install-common
708*e4b17023SJohn MarinoInstall everything that is part of the front end, apart from the
709*e4b17023SJohn Marinocompiler executables listed in @code{compilers} in
710*e4b17023SJohn Marino@file{config-lang.in}.
711*e4b17023SJohn Marino@item install-info
712*e4b17023SJohn MarinoInstall info documentation for the front end, if it is present in the
713*e4b17023SJohn Marinosource directory.  This target should have dependencies on info files
714*e4b17023SJohn Marinothat should be installed.
715*e4b17023SJohn Marino@item install-man
716*e4b17023SJohn MarinoInstall man pages for the front end.  This target should ignore
717*e4b17023SJohn Marinoerrors.
718*e4b17023SJohn Marino@item install-plugin
719*e4b17023SJohn MarinoInstall headers needed for plugins.
720*e4b17023SJohn Marino@item srcextra
721*e4b17023SJohn MarinoCopies its dependencies into the source directory.  This generally should
722*e4b17023SJohn Marinobe used for generated files such as Bison output files which are not
723*e4b17023SJohn Marinoversion-controlled, but should be included in any release tarballs.  This
724*e4b17023SJohn Marinotarget will be executed during a bootstrap if
725*e4b17023SJohn Marino@samp{--enable-generated-files-in-srcdir} was specified as a
726*e4b17023SJohn Marino@file{configure} option.
727*e4b17023SJohn Marino@item srcinfo
728*e4b17023SJohn Marino@itemx srcman
729*e4b17023SJohn MarinoCopies its dependencies into the source directory.  These targets will be
730*e4b17023SJohn Marinoexecuted during a bootstrap if @samp{--enable-generated-files-in-srcdir}
731*e4b17023SJohn Marinowas specified as a @file{configure} option.
732*e4b17023SJohn Marino@item uninstall
733*e4b17023SJohn MarinoUninstall files installed by installing the compiler.  This is
734*e4b17023SJohn Marinocurrently documented not to be supported, so the hook need not do
735*e4b17023SJohn Marinoanything.
736*e4b17023SJohn Marino@item mostlyclean
737*e4b17023SJohn Marino@itemx clean
738*e4b17023SJohn Marino@itemx distclean
739*e4b17023SJohn Marino@itemx maintainer-clean
740*e4b17023SJohn MarinoThe language parts of the standard GNU
741*e4b17023SJohn Marino@samp{*clean} targets.  @xref{Standard Targets, , Standard Targets for
742*e4b17023SJohn MarinoUsers, standards, GNU Coding Standards}, for details of the standard
743*e4b17023SJohn Marinotargets.  For GCC, @code{maintainer-clean} should delete
744*e4b17023SJohn Marinoall generated files in the source directory that are not version-controlled,
745*e4b17023SJohn Marinobut should not delete anything that is.
746*e4b17023SJohn Marino@end table
747*e4b17023SJohn Marino
748*e4b17023SJohn Marino@file{Make-lang.in} must also define a variable @code{@var{lang}_OBJS}
749*e4b17023SJohn Marinoto a list of host object files that are used by that language.
750*e4b17023SJohn Marino
751*e4b17023SJohn Marino@node Back End
752*e4b17023SJohn Marino@subsection Anatomy of a Target Back End
753*e4b17023SJohn Marino
754*e4b17023SJohn MarinoA back end for a target architecture in GCC has the following parts:
755*e4b17023SJohn Marino
756*e4b17023SJohn Marino@itemize @bullet
757*e4b17023SJohn Marino@item
758*e4b17023SJohn MarinoA directory @file{@var{machine}} under @file{gcc/config}, containing a
759*e4b17023SJohn Marinomachine description @file{@var{machine}.md} file (@pxref{Machine Desc,
760*e4b17023SJohn Marino, Machine Descriptions}), header files @file{@var{machine}.h} and
761*e4b17023SJohn Marino@file{@var{machine}-protos.h} and a source file @file{@var{machine}.c}
762*e4b17023SJohn Marino(@pxref{Target Macros, , Target Description Macros and Functions}),
763*e4b17023SJohn Marinopossibly a target Makefile fragment @file{t-@var{machine}}
764*e4b17023SJohn Marino(@pxref{Target Fragment, , The Target Makefile Fragment}), and maybe
765*e4b17023SJohn Marinosome other files.  The names of these files may be changed from the
766*e4b17023SJohn Marinodefaults given by explicit specifications in @file{config.gcc}.
767*e4b17023SJohn Marino@item
768*e4b17023SJohn MarinoIf necessary, a file @file{@var{machine}-modes.def} in the
769*e4b17023SJohn Marino@file{@var{machine}} directory, containing additional machine modes to
770*e4b17023SJohn Marinorepresent condition codes.  @xref{Condition Code}, for further details.
771*e4b17023SJohn Marino@item
772*e4b17023SJohn MarinoAn optional @file{@var{machine}.opt} file in the @file{@var{machine}}
773*e4b17023SJohn Marinodirectory, containing a list of target-specific options.  You can also
774*e4b17023SJohn Marinoadd other option files using the @code{extra_options} variable in
775*e4b17023SJohn Marino@file{config.gcc}.  @xref{Options}.
776*e4b17023SJohn Marino@item
777*e4b17023SJohn MarinoEntries in @file{config.gcc} (@pxref{System Config, , The
778*e4b17023SJohn Marino@file{config.gcc} File}) for the systems with this target
779*e4b17023SJohn Marinoarchitecture.
780*e4b17023SJohn Marino@item
781*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/invoke.texi} for any command-line
782*e4b17023SJohn Marinooptions supported by this target (@pxref{Run-time Target, , Run-time
783*e4b17023SJohn MarinoTarget Specification}).  This means both entries in the summary table
784*e4b17023SJohn Marinoof options and details of the individual options.
785*e4b17023SJohn Marino@item
786*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/extend.texi} for any target-specific
787*e4b17023SJohn Marinoattributes supported (@pxref{Target Attributes, , Defining
788*e4b17023SJohn Marinotarget-specific uses of @code{__attribute__}}), including where the
789*e4b17023SJohn Marinosame attribute is already supported on some targets, which are
790*e4b17023SJohn Marinoenumerated in the manual.
791*e4b17023SJohn Marino@item
792*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/extend.texi} for any target-specific
793*e4b17023SJohn Marinopragmas supported.
794*e4b17023SJohn Marino@item
795*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/extend.texi} of any target-specific
796*e4b17023SJohn Marinobuilt-in functions supported.
797*e4b17023SJohn Marino@item
798*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/extend.texi} of any target-specific
799*e4b17023SJohn Marinoformat checking styles supported.
800*e4b17023SJohn Marino@item
801*e4b17023SJohn MarinoDocumentation in @file{gcc/doc/md.texi} of any target-specific
802*e4b17023SJohn Marinoconstraint letters (@pxref{Machine Constraints, , Constraints for
803*e4b17023SJohn MarinoParticular Machines}).
804*e4b17023SJohn Marino@item
805*e4b17023SJohn MarinoA note in @file{gcc/doc/contrib.texi} under the person or people who
806*e4b17023SJohn Marinocontributed the target support.
807*e4b17023SJohn Marino@item
808*e4b17023SJohn MarinoEntries in @file{gcc/doc/install.texi} for all target triplets
809*e4b17023SJohn Marinosupported with this target architecture, giving details of any special
810*e4b17023SJohn Marinonotes about installation for this target, or saying that there are no
811*e4b17023SJohn Marinospecial notes if there are none.
812*e4b17023SJohn Marino@item
813*e4b17023SJohn MarinoPossibly other support outside the @file{gcc} directory for runtime
814*e4b17023SJohn Marinolibraries.  FIXME: reference docs for this.  The @code{libstdc++} porting
815*e4b17023SJohn Marinomanual needs to be installed as info for this to work, or to be a
816*e4b17023SJohn Marinochapter of this manual.
817*e4b17023SJohn Marino@end itemize
818*e4b17023SJohn Marino
819*e4b17023SJohn MarinoIf the back end is added to the official GCC source repository, the
820*e4b17023SJohn Marinofollowing are also necessary:
821*e4b17023SJohn Marino
822*e4b17023SJohn Marino@itemize @bullet
823*e4b17023SJohn Marino@item
824*e4b17023SJohn MarinoAn entry for the target architecture in @file{readings.html} on the
825*e4b17023SJohn MarinoGCC web site, with any relevant links.
826*e4b17023SJohn Marino@item
827*e4b17023SJohn MarinoDetails of the properties of the back end and target architecture in
828*e4b17023SJohn Marino@file{backends.html} on the GCC web site.
829*e4b17023SJohn Marino@item
830*e4b17023SJohn MarinoA news item about the contribution of support for that target
831*e4b17023SJohn Marinoarchitecture, in @file{index.html} on the GCC web site.
832*e4b17023SJohn Marino@item
833*e4b17023SJohn MarinoNormally, one or more maintainers of that target listed in
834*e4b17023SJohn Marino@file{MAINTAINERS}.  Some existing architectures may be unmaintained,
835*e4b17023SJohn Marinobut it would be unusual to add support for a target that does not have
836*e4b17023SJohn Marinoa maintainer when support is added.
837*e4b17023SJohn Marino@item
838*e4b17023SJohn MarinoTarget triplets covering all @file{config.gcc} stanzas for the target,
839*e4b17023SJohn Marinoin the list in @file{contrib/config-list.mk}.
840*e4b17023SJohn Marino@end itemize
841*e4b17023SJohn Marino
842*e4b17023SJohn Marino@node Testsuites
843*e4b17023SJohn Marino@chapter Testsuites
844*e4b17023SJohn Marino
845*e4b17023SJohn MarinoGCC contains several testsuites to help maintain compiler quality.
846*e4b17023SJohn MarinoMost of the runtime libraries and language front ends in GCC have
847*e4b17023SJohn Marinotestsuites.  Currently only the C language testsuites are documented
848*e4b17023SJohn Marinohere; FIXME: document the others.
849*e4b17023SJohn Marino
850*e4b17023SJohn Marino@menu
851*e4b17023SJohn Marino* Test Idioms::     Idioms used in testsuite code.
852*e4b17023SJohn Marino* Test Directives:: Directives used within DejaGnu tests.
853*e4b17023SJohn Marino* Ada Tests::       The Ada language testsuites.
854*e4b17023SJohn Marino* C Tests::         The C language testsuites.
855*e4b17023SJohn Marino* libgcj Tests::    The Java library testsuites.
856*e4b17023SJohn Marino* LTO Testing::     Support for testing link-time optimizations.
857*e4b17023SJohn Marino* gcov Testing::    Support for testing gcov.
858*e4b17023SJohn Marino* profopt Testing:: Support for testing profile-directed optimizations.
859*e4b17023SJohn Marino* compat Testing::  Support for testing binary compatibility.
860*e4b17023SJohn Marino* Torture Tests::   Support for torture testing using multiple options.
861*e4b17023SJohn Marino@end menu
862*e4b17023SJohn Marino
863*e4b17023SJohn Marino@node Test Idioms
864*e4b17023SJohn Marino@section Idioms Used in Testsuite Code
865*e4b17023SJohn Marino
866*e4b17023SJohn MarinoIn general, C testcases have a trailing @file{-@var{n}.c}, starting
867*e4b17023SJohn Marinowith @file{-1.c}, in case other testcases with similar names are added
868*e4b17023SJohn Marinolater.  If the test is a test of some well-defined feature, it should
869*e4b17023SJohn Marinohave a name referring to that feature such as
870*e4b17023SJohn Marino@file{@var{feature}-1.c}.  If it does not test a well-defined feature
871*e4b17023SJohn Marinobut just happens to exercise a bug somewhere in the compiler, and a
872*e4b17023SJohn Marinobug report has been filed for this bug in the GCC bug database,
873*e4b17023SJohn Marino@file{pr@var{bug-number}-1.c} is the appropriate form of name.
874*e4b17023SJohn MarinoOtherwise (for miscellaneous bugs not filed in the GCC bug database),
875*e4b17023SJohn Marinoand previously more generally, test cases are named after the date on
876*e4b17023SJohn Marinowhich they were added.  This allows people to tell at a glance whether
877*e4b17023SJohn Marinoa test failure is because of a recently found bug that has not yet
878*e4b17023SJohn Marinobeen fixed, or whether it may be a regression, but does not give any
879*e4b17023SJohn Marinoother information about the bug or where discussion of it may be
880*e4b17023SJohn Marinofound.  Some other language testsuites follow similar conventions.
881*e4b17023SJohn Marino
882*e4b17023SJohn MarinoIn the @file{gcc.dg} testsuite, it is often necessary to test that an
883*e4b17023SJohn Marinoerror is indeed a hard error and not just a warning---for example,
884*e4b17023SJohn Marinowhere it is a constraint violation in the C standard, which must
885*e4b17023SJohn Marinobecome an error with @option{-pedantic-errors}.  The following idiom,
886*e4b17023SJohn Marinowhere the first line shown is line @var{line} of the file and the line
887*e4b17023SJohn Marinothat generates the error, is used for this:
888*e4b17023SJohn Marino
889*e4b17023SJohn Marino@smallexample
890*e4b17023SJohn Marino/* @{ dg-bogus "warning" "warning in place of error" @} */
891*e4b17023SJohn Marino/* @{ dg-error "@var{regexp}" "@var{message}" @{ target *-*-* @} @var{line} @} */
892*e4b17023SJohn Marino@end smallexample
893*e4b17023SJohn Marino
894*e4b17023SJohn MarinoIt may be necessary to check that an expression is an integer constant
895*e4b17023SJohn Marinoexpression and has a certain value.  To check that @code{@var{E}} has
896*e4b17023SJohn Marinovalue @code{@var{V}}, an idiom similar to the following is used:
897*e4b17023SJohn Marino
898*e4b17023SJohn Marino@smallexample
899*e4b17023SJohn Marinochar x[((E) == (V) ? 1 : -1)];
900*e4b17023SJohn Marino@end smallexample
901*e4b17023SJohn Marino
902*e4b17023SJohn MarinoIn @file{gcc.dg} tests, @code{__typeof__} is sometimes used to make
903*e4b17023SJohn Marinoassertions about the types of expressions.  See, for example,
904*e4b17023SJohn Marino@file{gcc.dg/c99-condexpr-1.c}.  The more subtle uses depend on the
905*e4b17023SJohn Marinoexact rules for the types of conditional expressions in the C
906*e4b17023SJohn Marinostandard; see, for example, @file{gcc.dg/c99-intconst-1.c}.
907*e4b17023SJohn Marino
908*e4b17023SJohn MarinoIt is useful to be able to test that optimizations are being made
909*e4b17023SJohn Marinoproperly.  This cannot be done in all cases, but it can be done where
910*e4b17023SJohn Marinothe optimization will lead to code being optimized away (for example,
911*e4b17023SJohn Marinowhere flow analysis or alias analysis should show that certain code
912*e4b17023SJohn Marinocannot be called) or to functions not being called because they have
913*e4b17023SJohn Marinobeen expanded as built-in functions.  Such tests go in
914*e4b17023SJohn Marino@file{gcc.c-torture/execute}.  Where code should be optimized away, a
915*e4b17023SJohn Marinocall to a nonexistent function such as @code{link_failure ()} may be
916*e4b17023SJohn Marinoinserted; a definition
917*e4b17023SJohn Marino
918*e4b17023SJohn Marino@smallexample
919*e4b17023SJohn Marino#ifndef __OPTIMIZE__
920*e4b17023SJohn Marinovoid
921*e4b17023SJohn Marinolink_failure (void)
922*e4b17023SJohn Marino@{
923*e4b17023SJohn Marino  abort ();
924*e4b17023SJohn Marino@}
925*e4b17023SJohn Marino#endif
926*e4b17023SJohn Marino@end smallexample
927*e4b17023SJohn Marino
928*e4b17023SJohn Marino@noindent
929*e4b17023SJohn Marinowill also be needed so that linking still succeeds when the test is
930*e4b17023SJohn Marinorun without optimization.  When all calls to a built-in function
931*e4b17023SJohn Marinoshould have been optimized and no calls to the non-built-in version of
932*e4b17023SJohn Marinothe function should remain, that function may be defined as
933*e4b17023SJohn Marino@code{static} to call @code{abort ()} (although redeclaring a function
934*e4b17023SJohn Marinoas static may not work on all targets).
935*e4b17023SJohn Marino
936*e4b17023SJohn MarinoAll testcases must be portable.  Target-specific testcases must have
937*e4b17023SJohn Marinoappropriate code to avoid causing failures on unsupported systems;
938*e4b17023SJohn Marinounfortunately, the mechanisms for this differ by directory.
939*e4b17023SJohn Marino
940*e4b17023SJohn MarinoFIXME: discuss non-C testsuites here.
941*e4b17023SJohn Marino
942*e4b17023SJohn Marino@node Test Directives
943*e4b17023SJohn Marino@section Directives used within DejaGnu tests
944*e4b17023SJohn Marino
945*e4b17023SJohn Marino@menu
946*e4b17023SJohn Marino* Directives::  Syntax and descriptions of test directives.
947*e4b17023SJohn Marino* Selectors:: Selecting targets to which a test applies.
948*e4b17023SJohn Marino* Effective-Target Keywords:: Keywords describing target attributes.
949*e4b17023SJohn Marino* Add Options:: Features for @code{dg-add-options}
950*e4b17023SJohn Marino* Require Support:: Variants of @code{dg-require-@var{support}}
951*e4b17023SJohn Marino* Final Actions:: Commands for use in @code{dg-final}
952*e4b17023SJohn Marino@end menu
953*e4b17023SJohn Marino
954*e4b17023SJohn Marino@node Directives
955*e4b17023SJohn Marino@subsection Syntax and Descriptions of test directives
956*e4b17023SJohn Marino
957*e4b17023SJohn MarinoTest directives appear within comments in a test source file and begin
958*e4b17023SJohn Marinowith @code{dg-}.  Some of these are defined within DejaGnu and others
959*e4b17023SJohn Marinoare local to the GCC testsuite.
960*e4b17023SJohn Marino
961*e4b17023SJohn MarinoThe order in which test directives appear in a test can be important:
962*e4b17023SJohn Marinodirectives local to GCC sometimes override information used by the
963*e4b17023SJohn MarinoDejaGnu directives, which know nothing about the GCC directives, so the
964*e4b17023SJohn MarinoDejaGnu directives must precede GCC directives.
965*e4b17023SJohn Marino
966*e4b17023SJohn MarinoSeveral test directives include selectors (@pxref{Selectors, , })
967*e4b17023SJohn Marinowhich are usually preceded by the keyword @code{target} or @code{xfail}.
968*e4b17023SJohn Marino
969*e4b17023SJohn Marino@subsubsection Specify how to build the test
970*e4b17023SJohn Marino
971*e4b17023SJohn Marino@table @code
972*e4b17023SJohn Marino@item @{ dg-do @var{do-what-keyword} [@{ target/xfail @var{selector} @}] @}
973*e4b17023SJohn Marino@var{do-what-keyword} specifies how the test is compiled and whether
974*e4b17023SJohn Marinoit is executed.  It is one of:
975*e4b17023SJohn Marino
976*e4b17023SJohn Marino@table @code
977*e4b17023SJohn Marino@item preprocess
978*e4b17023SJohn MarinoCompile with @option{-E} to run only the preprocessor.
979*e4b17023SJohn Marino@item compile
980*e4b17023SJohn MarinoCompile with @option{-S} to produce an assembly code file.
981*e4b17023SJohn Marino@item assemble
982*e4b17023SJohn MarinoCompile with @option{-c} to produce a relocatable object file.
983*e4b17023SJohn Marino@item link
984*e4b17023SJohn MarinoCompile, assemble, and link to produce an executable file.
985*e4b17023SJohn Marino@item run
986*e4b17023SJohn MarinoProduce and run an executable file, which is expected to return
987*e4b17023SJohn Marinoan exit code of 0.
988*e4b17023SJohn Marino@end table
989*e4b17023SJohn Marino
990*e4b17023SJohn MarinoThe default is @code{compile}.  That can be overridden for a set of
991*e4b17023SJohn Marinotests by redefining @code{dg-do-what-default} within the @code{.exp}
992*e4b17023SJohn Marinofile for those tests.
993*e4b17023SJohn Marino
994*e4b17023SJohn MarinoIf the directive includes the optional @samp{@{ target @var{selector} @}}
995*e4b17023SJohn Marinothen the test is skipped unless the target system matches the
996*e4b17023SJohn Marino@var{selector}.
997*e4b17023SJohn Marino
998*e4b17023SJohn MarinoIf @var{do-what-keyword} is @code{run} and the directive includes
999*e4b17023SJohn Marinothe optional @samp{@{ xfail @var{selector} @}} and the selector is met
1000*e4b17023SJohn Marinothen the test is expected to fail.  The @code{xfail} clause is ignored
1001*e4b17023SJohn Marinofor other values of @var{do-what-keyword}; those tests can use
1002*e4b17023SJohn Marinodirective @code{dg-xfail-if}.
1003*e4b17023SJohn Marino@end table
1004*e4b17023SJohn Marino
1005*e4b17023SJohn Marino@subsubsection Specify additional compiler options
1006*e4b17023SJohn Marino
1007*e4b17023SJohn Marino@table @code
1008*e4b17023SJohn Marino@item @{ dg-options @var{options} [@{ target @var{selector} @}] @}
1009*e4b17023SJohn MarinoThis DejaGnu directive provides a list of compiler options, to be used
1010*e4b17023SJohn Marinoif the target system matches @var{selector}, that replace the default
1011*e4b17023SJohn Marinooptions used for this set of tests.
1012*e4b17023SJohn Marino
1013*e4b17023SJohn Marino@item @{ dg-add-options @var{feature} @dots{} @}
1014*e4b17023SJohn MarinoAdd any compiler options that are needed to access certain features.
1015*e4b17023SJohn MarinoThis directive does nothing on targets that enable the features by
1016*e4b17023SJohn Marinodefault, or that don't provide them at all.  It must come after
1017*e4b17023SJohn Marinoall @code{dg-options} directives.
1018*e4b17023SJohn MarinoFor supported values of @var{feature} see @ref{Add Options, ,}.
1019*e4b17023SJohn Marino
1020*e4b17023SJohn Marino@item @{ dg-additional-options @var{options} [@{ target @var{selector} @}] @}
1021*e4b17023SJohn MarinoThis directive provides a list of compiler options, to be used
1022*e4b17023SJohn Marinoif the target system matches @var{selector}, that are added to the default
1023*e4b17023SJohn Marinooptions used for this set of tests.
1024*e4b17023SJohn Marino@end table
1025*e4b17023SJohn Marino
1026*e4b17023SJohn Marino@subsubsection Modify the test timeout value
1027*e4b17023SJohn Marino
1028*e4b17023SJohn MarinoThe normal timeout limit, in seconds, is found by searching the
1029*e4b17023SJohn Marinofollowing in order:
1030*e4b17023SJohn Marino
1031*e4b17023SJohn Marino@itemize @bullet
1032*e4b17023SJohn Marino@item the value defined by an earlier @code{dg-timeout} directive in
1033*e4b17023SJohn Marinothe test
1034*e4b17023SJohn Marino
1035*e4b17023SJohn Marino@item variable @var{tool_timeout} defined by the set of tests
1036*e4b17023SJohn Marino
1037*e4b17023SJohn Marino@item @var{gcc},@var{timeout} set in the target board
1038*e4b17023SJohn Marino
1039*e4b17023SJohn Marino@item 300
1040*e4b17023SJohn Marino@end itemize
1041*e4b17023SJohn Marino
1042*e4b17023SJohn Marino@table @code
1043*e4b17023SJohn Marino@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @}
1044*e4b17023SJohn MarinoSet the time limit for the compilation and for the execution of the test
1045*e4b17023SJohn Marinoto the specified number of seconds.
1046*e4b17023SJohn Marino
1047*e4b17023SJohn Marino@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @}
1048*e4b17023SJohn MarinoMultiply the normal time limit for compilation and execution of the test
1049*e4b17023SJohn Marinoby the specified floating-point factor.
1050*e4b17023SJohn Marino@end table
1051*e4b17023SJohn Marino
1052*e4b17023SJohn Marino@subsubsection Skip a test for some targets
1053*e4b17023SJohn Marino
1054*e4b17023SJohn Marino@table @code
1055*e4b17023SJohn Marino@item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
1056*e4b17023SJohn MarinoArguments @var{include-opts} and @var{exclude-opts} are lists in which
1057*e4b17023SJohn Marinoeach element is a string of zero or more GCC options.
1058*e4b17023SJohn MarinoSkip the test if all of the following conditions are met:
1059*e4b17023SJohn Marino@itemize @bullet
1060*e4b17023SJohn Marino@item the test system is included in @var{selector}
1061*e4b17023SJohn Marino
1062*e4b17023SJohn Marino@item for at least one of the option strings in @var{include-opts},
1063*e4b17023SJohn Marinoevery option from that string is in the set of options with which
1064*e4b17023SJohn Marinothe test would be compiled; use @samp{"*"} for an @var{include-opts} list
1065*e4b17023SJohn Marinothat matches any options; that is the default if @var{include-opts} is
1066*e4b17023SJohn Marinonot specified
1067*e4b17023SJohn Marino
1068*e4b17023SJohn Marino@item for each of the option strings in @var{exclude-opts}, at least one
1069*e4b17023SJohn Marinooption from that string is not in the set of options with which the test
1070*e4b17023SJohn Marinowould be compiled; use @samp{""} for an empty @var{exclude-opts} list;
1071*e4b17023SJohn Marinothat is the default if @var{exclude-opts} is not specified
1072*e4b17023SJohn Marino@end itemize
1073*e4b17023SJohn Marino
1074*e4b17023SJohn MarinoFor example, to skip a test if option @code{-Os} is present:
1075*e4b17023SJohn Marino
1076*e4b17023SJohn Marino@smallexample
1077*e4b17023SJohn Marino/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-Os" @} @{ "" @} @} */
1078*e4b17023SJohn Marino@end smallexample
1079*e4b17023SJohn Marino
1080*e4b17023SJohn MarinoTo skip a test if both options @code{-O2} and @code{-g} are present:
1081*e4b17023SJohn Marino
1082*e4b17023SJohn Marino@smallexample
1083*e4b17023SJohn Marino/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" @} @{ "" @} @} */
1084*e4b17023SJohn Marino@end smallexample
1085*e4b17023SJohn Marino
1086*e4b17023SJohn MarinoTo skip a test if either @code{-O2} or @code{-O3} is present:
1087*e4b17023SJohn Marino
1088*e4b17023SJohn Marino@smallexample
1089*e4b17023SJohn Marino/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2" "-O3" @} @{ "" @} @} */
1090*e4b17023SJohn Marino@end smallexample
1091*e4b17023SJohn Marino
1092*e4b17023SJohn MarinoTo skip a test unless option @code{-Os} is present:
1093*e4b17023SJohn Marino
1094*e4b17023SJohn Marino@smallexample
1095*e4b17023SJohn Marino/* @{ dg-skip-if "" @{ *-*-* @}  @{ "*" @} @{ "-Os" @} @} */
1096*e4b17023SJohn Marino@end smallexample
1097*e4b17023SJohn Marino
1098*e4b17023SJohn MarinoTo skip a test if either @code{-O2} or @code{-O3} is used with @code{-g}
1099*e4b17023SJohn Marinobut not if @code{-fpic} is also present:
1100*e4b17023SJohn Marino
1101*e4b17023SJohn Marino@smallexample
1102*e4b17023SJohn Marino/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */
1103*e4b17023SJohn Marino@end smallexample
1104*e4b17023SJohn Marino
1105*e4b17023SJohn Marino@item @{ dg-require-effective-target @var{keyword} [@{ @var{selector} @}] @}
1106*e4b17023SJohn MarinoSkip the test if the test target, including current multilib flags,
1107*e4b17023SJohn Marinois not covered by the effective-target keyword.
1108*e4b17023SJohn MarinoIf the directive includes the optional @samp{@{ @var{selector} @}}
1109*e4b17023SJohn Marinothen the effective-target test is only performed if the target system
1110*e4b17023SJohn Marinomatches the @var{selector}.
1111*e4b17023SJohn MarinoThis directive must appear after any @code{dg-do} directive in the test
1112*e4b17023SJohn Marinoand before any @code{dg-additional-sources} directive.
1113*e4b17023SJohn Marino@xref{Effective-Target Keywords, , }.
1114*e4b17023SJohn Marino
1115*e4b17023SJohn Marino@item @{ dg-require-@var{support} args @}
1116*e4b17023SJohn MarinoSkip the test if the target does not provide the required support.
1117*e4b17023SJohn MarinoThese directives must appear after any @code{dg-do} directive in the test
1118*e4b17023SJohn Marinoand before any @code{dg-additional-sources} directive.
1119*e4b17023SJohn MarinoThey require at least one argument, which can be an empty string if the
1120*e4b17023SJohn Marinospecific procedure does not examine the argument.
1121*e4b17023SJohn Marino@xref{Require Support, , }, for a complete list of these directives.
1122*e4b17023SJohn Marino@end table
1123*e4b17023SJohn Marino
1124*e4b17023SJohn Marino@subsubsection Expect a test to fail for some targets
1125*e4b17023SJohn Marino
1126*e4b17023SJohn Marino@table @code
1127*e4b17023SJohn Marino@item  @{ dg-xfail-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
1128*e4b17023SJohn MarinoExpect the test to fail if the conditions (which are the same as for
1129*e4b17023SJohn Marino@code{dg-skip-if}) are met.  This does not affect the execute step.
1130*e4b17023SJohn Marino
1131*e4b17023SJohn Marino@item  @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
1132*e4b17023SJohn MarinoExpect the execute step of a test to fail if the conditions (which are
1133*e4b17023SJohn Marinothe same as for @code{dg-skip-if}) are met.
1134*e4b17023SJohn Marino@end table
1135*e4b17023SJohn Marino
1136*e4b17023SJohn Marino@subsubsection Expect the test executable to fail
1137*e4b17023SJohn Marino
1138*e4b17023SJohn Marino@table @code
1139*e4b17023SJohn Marino@item  @{ dg-shouldfail @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @}
1140*e4b17023SJohn MarinoExpect the test executable to return a nonzero exit status if the
1141*e4b17023SJohn Marinoconditions (which are the same as for @code{dg-skip-if}) are met.
1142*e4b17023SJohn Marino@end table
1143*e4b17023SJohn Marino
1144*e4b17023SJohn Marino@subsubsection Verify compiler messages
1145*e4b17023SJohn Marino
1146*e4b17023SJohn Marino@table @code
1147*e4b17023SJohn Marino@item @{ dg-error @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
1148*e4b17023SJohn MarinoThis DejaGnu directive appears on a source line that is expected to get
1149*e4b17023SJohn Marinoan error message, or else specifies the source line associated with the
1150*e4b17023SJohn Marinomessage.  If there is no message for that line or if the text of that
1151*e4b17023SJohn Marinomessage is not matched by @var{regexp} then the check fails and
1152*e4b17023SJohn Marino@var{comment} is included in the @code{FAIL} message.  The check does
1153*e4b17023SJohn Marinonot look for the string @samp{error} unless it is part of @var{regexp}.
1154*e4b17023SJohn Marino
1155*e4b17023SJohn Marino@item @{ dg-warning @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
1156*e4b17023SJohn MarinoThis DejaGnu directive appears on a source line that is expected to get
1157*e4b17023SJohn Marinoa warning message, or else specifies the source line associated with the
1158*e4b17023SJohn Marinomessage.  If there is no message for that line or if the text of that
1159*e4b17023SJohn Marinomessage is not matched by @var{regexp} then the check fails and
1160*e4b17023SJohn Marino@var{comment} is included in the @code{FAIL} message.  The check does
1161*e4b17023SJohn Marinonot look for the string @samp{warning} unless it is part of @var{regexp}.
1162*e4b17023SJohn Marino
1163*e4b17023SJohn Marino@item @{ dg-message @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
1164*e4b17023SJohn MarinoThe line is expected to get a message other than an error or warning.
1165*e4b17023SJohn MarinoIf there is no message for that line or if the text of that message is
1166*e4b17023SJohn Marinonot matched by @var{regexp} then the check fails and @var{comment} is
1167*e4b17023SJohn Marinoincluded in the @code{FAIL} message.
1168*e4b17023SJohn Marino
1169*e4b17023SJohn Marino@item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
1170*e4b17023SJohn MarinoThis DejaGnu directive appears on a source line that should not get a
1171*e4b17023SJohn Marinomessage matching @var{regexp}, or else specifies the source line
1172*e4b17023SJohn Marinoassociated with the bogus message.  It is usually used with @samp{xfail}
1173*e4b17023SJohn Marinoto indicate that the message is a known problem for a particular set of
1174*e4b17023SJohn Marinotargets.
1175*e4b17023SJohn Marino
1176*e4b17023SJohn Marino@item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @}
1177*e4b17023SJohn MarinoThis DejaGnu directive indicates that the test is expected to fail due
1178*e4b17023SJohn Marinoto compiler messages that are not handled by @samp{dg-error},
1179*e4b17023SJohn Marino@samp{dg-warning} or @samp{dg-bogus}.  For this directive @samp{xfail}
1180*e4b17023SJohn Marinohas the same effect as @samp{target}.
1181*e4b17023SJohn Marino
1182*e4b17023SJohn Marino@item @{ dg-prune-output @var{regexp} @}
1183*e4b17023SJohn MarinoPrune messages matching @var{regexp} from the test output.
1184*e4b17023SJohn Marino@end table
1185*e4b17023SJohn Marino
1186*e4b17023SJohn Marino@subsubsection Verify output of the test executable
1187*e4b17023SJohn Marino
1188*e4b17023SJohn Marino@table @code
1189*e4b17023SJohn Marino@item @{ dg-output @var{regexp} [@{ target/xfail @var{selector} @}] @}
1190*e4b17023SJohn MarinoThis DejaGnu directive compares @var{regexp} to the combined output
1191*e4b17023SJohn Marinothat the test executable writes to @file{stdout} and @file{stderr}.
1192*e4b17023SJohn Marino@end table
1193*e4b17023SJohn Marino
1194*e4b17023SJohn Marino@subsubsection Specify additional files for a test
1195*e4b17023SJohn Marino
1196*e4b17023SJohn Marino@table @code
1197*e4b17023SJohn Marino@item @{ dg-additional-files "@var{filelist}" @}
1198*e4b17023SJohn MarinoSpecify additional files, other than source files, that must be copied
1199*e4b17023SJohn Marinoto the system where the compiler runs.
1200*e4b17023SJohn Marino
1201*e4b17023SJohn Marino@item @{ dg-additional-sources "@var{filelist}" @}
1202*e4b17023SJohn MarinoSpecify additional source files to appear in the compile line
1203*e4b17023SJohn Marinofollowing the main test file.
1204*e4b17023SJohn Marino@end table
1205*e4b17023SJohn Marino
1206*e4b17023SJohn Marino@subsubsection Add checks at the end of a test
1207*e4b17023SJohn Marino
1208*e4b17023SJohn Marino@table @code
1209*e4b17023SJohn Marino@item @{ dg-final @{ @var{local-directive} @} @}
1210*e4b17023SJohn MarinoThis DejaGnu directive is placed within a comment anywhere in the
1211*e4b17023SJohn Marinosource file and is processed after the test has been compiled and run.
1212*e4b17023SJohn MarinoMultiple @samp{dg-final} commands are processed in the order in which
1213*e4b17023SJohn Marinothey appear in the source file.  @xref{Final Actions, , }, for a list
1214*e4b17023SJohn Marinoof directives that can be used within @code{dg-final}.
1215*e4b17023SJohn Marino@end table
1216*e4b17023SJohn Marino
1217*e4b17023SJohn Marino@node Selectors
1218*e4b17023SJohn Marino@subsection Selecting targets to which a test applies
1219*e4b17023SJohn Marino
1220*e4b17023SJohn MarinoSeveral test directives include @var{selector}s to limit the targets
1221*e4b17023SJohn Marinofor which a test is run or to declare that a test is expected to fail
1222*e4b17023SJohn Marinoon particular targets.
1223*e4b17023SJohn Marino
1224*e4b17023SJohn MarinoA selector is:
1225*e4b17023SJohn Marino@itemize @bullet
1226*e4b17023SJohn Marino@item one or more target triplets, possibly including wildcard characters
1227*e4b17023SJohn Marino@item a single effective-target keyword (@pxref{Effective-Target Keywords})
1228*e4b17023SJohn Marino@item a logical expression
1229*e4b17023SJohn Marino@end itemize
1230*e4b17023SJohn Marino
1231*e4b17023SJohn MarinoDepending on the
1232*e4b17023SJohn Marinocontext, the selector specifies whether a test is skipped and reported
1233*e4b17023SJohn Marinoas unsupported or is expected to fail.  Use @samp{*-*-*} to match any
1234*e4b17023SJohn Marinotarget.
1235*e4b17023SJohn Marino
1236*e4b17023SJohn MarinoA selector expression appears within curly braces and uses a single
1237*e4b17023SJohn Marinological operator: one of @samp{!}, @samp{&&}, or @samp{||}.  An
1238*e4b17023SJohn Marinooperand is another selector expression, an effective-target keyword,
1239*e4b17023SJohn Marinoa single target triplet, or a list of target triplets within quotes or
1240*e4b17023SJohn Marinocurly braces.  For example:
1241*e4b17023SJohn Marino
1242*e4b17023SJohn Marino@smallexample
1243*e4b17023SJohn Marino@{ target @{ ! "hppa*-*-* ia64*-*-*" @} @}
1244*e4b17023SJohn Marino@{ target @{ powerpc*-*-* && lp64 @} @}
1245*e4b17023SJohn Marino@{ xfail @{ lp64 || vect_no_align @} @}
1246*e4b17023SJohn Marino@end smallexample
1247*e4b17023SJohn Marino
1248*e4b17023SJohn Marino@node Effective-Target Keywords
1249*e4b17023SJohn Marino@subsection Keywords describing target attributes
1250*e4b17023SJohn Marino
1251*e4b17023SJohn MarinoEffective-target keywords identify sets of targets that support
1252*e4b17023SJohn Marinoparticular functionality.  They are used to limit tests to be run only
1253*e4b17023SJohn Marinofor particular targets, or to specify that particular sets of targets
1254*e4b17023SJohn Marinoare expected to fail some tests.
1255*e4b17023SJohn Marino
1256*e4b17023SJohn MarinoEffective-target keywords are defined in @file{lib/target-supports.exp} in
1257*e4b17023SJohn Marinothe GCC testsuite, with the exception of those that are documented as
1258*e4b17023SJohn Marinobeing local to a particular test directory.
1259*e4b17023SJohn Marino
1260*e4b17023SJohn MarinoThe @samp{effective target} takes into account all of the compiler options
1261*e4b17023SJohn Marinowith which the test will be compiled, including the multilib options.
1262*e4b17023SJohn MarinoBy convention, keywords ending in @code{_nocache} can also include options
1263*e4b17023SJohn Marinospecified for the particular test in an earlier @code{dg-options} or
1264*e4b17023SJohn Marino@code{dg-add-options} directive.
1265*e4b17023SJohn Marino
1266*e4b17023SJohn Marino@subsubsection Data type sizes
1267*e4b17023SJohn Marino
1268*e4b17023SJohn Marino@table @code
1269*e4b17023SJohn Marino@item ilp32
1270*e4b17023SJohn MarinoTarget has 32-bit @code{int}, @code{long}, and pointers.
1271*e4b17023SJohn Marino
1272*e4b17023SJohn Marino@item lp64
1273*e4b17023SJohn MarinoTarget has 32-bit @code{int}, 64-bit @code{long} and pointers.
1274*e4b17023SJohn Marino
1275*e4b17023SJohn Marino@item llp64
1276*e4b17023SJohn MarinoTarget has 32-bit @code{int} and @code{long}, 64-bit @code{long long}
1277*e4b17023SJohn Marinoand pointers.
1278*e4b17023SJohn Marino
1279*e4b17023SJohn Marino@item double64
1280*e4b17023SJohn MarinoTarget has 64-bit @code{double}.
1281*e4b17023SJohn Marino
1282*e4b17023SJohn Marino@item double64plus
1283*e4b17023SJohn MarinoTarget has @code{double} that is 64 bits or longer.
1284*e4b17023SJohn Marino
1285*e4b17023SJohn Marino@item int32plus
1286*e4b17023SJohn MarinoTarget has @code{int} that is at 32 bits or longer.
1287*e4b17023SJohn Marino
1288*e4b17023SJohn Marino@item int16
1289*e4b17023SJohn MarinoTarget has @code{int} that is 16 bits or shorter.
1290*e4b17023SJohn Marino
1291*e4b17023SJohn Marino@item large_double
1292*e4b17023SJohn MarinoTarget supports @code{double} that is longer than @code{float}.
1293*e4b17023SJohn Marino
1294*e4b17023SJohn Marino@item large_long_double
1295*e4b17023SJohn MarinoTarget supports @code{long double} that is longer than @code{double}.
1296*e4b17023SJohn Marino
1297*e4b17023SJohn Marino@item ptr32plus
1298*e4b17023SJohn MarinoTarget has pointers that are 32 bits or longer.
1299*e4b17023SJohn Marino
1300*e4b17023SJohn Marino@item size32plus
1301*e4b17023SJohn MarinoTarget supports array and structure sizes that are 32 bits or longer.
1302*e4b17023SJohn Marino
1303*e4b17023SJohn Marino@item 4byte_wchar_t
1304*e4b17023SJohn MarinoTarget has @code{wchar_t} that is at least 4 bytes.
1305*e4b17023SJohn Marino@end table
1306*e4b17023SJohn Marino
1307*e4b17023SJohn Marino@subsubsection Fortran-specific attributes
1308*e4b17023SJohn Marino
1309*e4b17023SJohn Marino@table @code
1310*e4b17023SJohn Marino@item fortran_integer_16
1311*e4b17023SJohn MarinoTarget supports Fortran @code{integer} that is 16 bytes or longer.
1312*e4b17023SJohn Marino
1313*e4b17023SJohn Marino@item fortran_large_int
1314*e4b17023SJohn MarinoTarget supports Fortran @code{integer} kinds larger than @code{integer(8)}.
1315*e4b17023SJohn Marino
1316*e4b17023SJohn Marino@item fortran_large_real
1317*e4b17023SJohn MarinoTarget supports Fortran @code{real} kinds larger than @code{real(8)}.
1318*e4b17023SJohn Marino@end table
1319*e4b17023SJohn Marino
1320*e4b17023SJohn Marino@subsubsection Vector-specific attributes
1321*e4b17023SJohn Marino
1322*e4b17023SJohn Marino@table @code
1323*e4b17023SJohn Marino@item vect_condition
1324*e4b17023SJohn MarinoTarget supports vector conditional operations.
1325*e4b17023SJohn Marino
1326*e4b17023SJohn Marino@item vect_double
1327*e4b17023SJohn MarinoTarget supports hardware vectors of @code{double}.
1328*e4b17023SJohn Marino
1329*e4b17023SJohn Marino@item vect_float
1330*e4b17023SJohn MarinoTarget supports hardware vectors of @code{float}.
1331*e4b17023SJohn Marino
1332*e4b17023SJohn Marino@item vect_int
1333*e4b17023SJohn MarinoTarget supports hardware vectors of @code{int}.
1334*e4b17023SJohn Marino
1335*e4b17023SJohn Marino@item vect_long
1336*e4b17023SJohn MarinoTarget supports hardware vectors of @code{long}.
1337*e4b17023SJohn Marino
1338*e4b17023SJohn Marino@item vect_long_long
1339*e4b17023SJohn MarinoTarget supports hardware vectors of @code{long long}.
1340*e4b17023SJohn Marino
1341*e4b17023SJohn Marino@item vect_aligned_arrays
1342*e4b17023SJohn MarinoTarget aligns arrays to vector alignment boundary.
1343*e4b17023SJohn Marino
1344*e4b17023SJohn Marino@item vect_hw_misalign
1345*e4b17023SJohn MarinoTarget supports a vector misalign access.
1346*e4b17023SJohn Marino
1347*e4b17023SJohn Marino@item vect_no_align
1348*e4b17023SJohn MarinoTarget does not support a vector alignment mechanism.
1349*e4b17023SJohn Marino
1350*e4b17023SJohn Marino@item vect_no_int_max
1351*e4b17023SJohn MarinoTarget does not support a vector max instruction on @code{int}.
1352*e4b17023SJohn Marino
1353*e4b17023SJohn Marino@item vect_no_int_add
1354*e4b17023SJohn MarinoTarget does not support a vector add instruction on @code{int}.
1355*e4b17023SJohn Marino
1356*e4b17023SJohn Marino@item vect_no_bitwise
1357*e4b17023SJohn MarinoTarget does not support vector bitwise instructions.
1358*e4b17023SJohn Marino
1359*e4b17023SJohn Marino@item vect_char_mult
1360*e4b17023SJohn MarinoTarget supports @code{vector char} multiplication.
1361*e4b17023SJohn Marino
1362*e4b17023SJohn Marino@item vect_short_mult
1363*e4b17023SJohn MarinoTarget supports @code{vector short} multiplication.
1364*e4b17023SJohn Marino
1365*e4b17023SJohn Marino@item vect_int_mult
1366*e4b17023SJohn MarinoTarget supports @code{vector int} multiplication.
1367*e4b17023SJohn Marino
1368*e4b17023SJohn Marino@item vect_extract_even_odd
1369*e4b17023SJohn MarinoTarget supports vector even/odd element extraction.
1370*e4b17023SJohn Marino
1371*e4b17023SJohn Marino@item vect_extract_even_odd_wide
1372*e4b17023SJohn MarinoTarget supports vector even/odd element extraction of vectors with elements
1373*e4b17023SJohn Marino@code{SImode} or larger.
1374*e4b17023SJohn Marino
1375*e4b17023SJohn Marino@item vect_interleave
1376*e4b17023SJohn MarinoTarget supports vector interleaving.
1377*e4b17023SJohn Marino
1378*e4b17023SJohn Marino@item vect_strided
1379*e4b17023SJohn MarinoTarget supports vector interleaving and extract even/odd.
1380*e4b17023SJohn Marino
1381*e4b17023SJohn Marino@item vect_strided_wide
1382*e4b17023SJohn MarinoTarget supports vector interleaving and extract even/odd for wide
1383*e4b17023SJohn Marinoelement types.
1384*e4b17023SJohn Marino
1385*e4b17023SJohn Marino@item vect_perm
1386*e4b17023SJohn MarinoTarget supports vector permutation.
1387*e4b17023SJohn Marino
1388*e4b17023SJohn Marino@item vect_shift
1389*e4b17023SJohn MarinoTarget supports a hardware vector shift operation.
1390*e4b17023SJohn Marino
1391*e4b17023SJohn Marino@item vect_widen_sum_hi_to_si
1392*e4b17023SJohn MarinoTarget supports a vector widening summation of @code{short} operands
1393*e4b17023SJohn Marinointo @code{int} results, or can promote (unpack) from @code{short}
1394*e4b17023SJohn Marinoto @code{int}.
1395*e4b17023SJohn Marino
1396*e4b17023SJohn Marino@item vect_widen_sum_qi_to_hi
1397*e4b17023SJohn MarinoTarget supports a vector widening summation of @code{char} operands
1398*e4b17023SJohn Marinointo @code{short} results, or can promote (unpack) from @code{char}
1399*e4b17023SJohn Marinoto @code{short}.
1400*e4b17023SJohn Marino
1401*e4b17023SJohn Marino@item vect_widen_sum_qi_to_si
1402*e4b17023SJohn MarinoTarget supports a vector widening summation of @code{char} operands
1403*e4b17023SJohn Marinointo @code{int} results.
1404*e4b17023SJohn Marino
1405*e4b17023SJohn Marino@item vect_widen_mult_qi_to_hi
1406*e4b17023SJohn MarinoTarget supports a vector widening multiplication of @code{char} operands
1407*e4b17023SJohn Marinointo @code{short} results, or can promote (unpack) from @code{char} to
1408*e4b17023SJohn Marino@code{short} and perform non-widening multiplication of @code{short}.
1409*e4b17023SJohn Marino
1410*e4b17023SJohn Marino@item vect_widen_mult_hi_to_si
1411*e4b17023SJohn MarinoTarget supports a vector widening multiplication of @code{short} operands
1412*e4b17023SJohn Marinointo @code{int} results, or can promote (unpack) from @code{short} to
1413*e4b17023SJohn Marino@code{int} and perform non-widening multiplication of @code{int}.
1414*e4b17023SJohn Marino
1415*e4b17023SJohn Marino@item vect_sdot_qi
1416*e4b17023SJohn MarinoTarget supports a vector dot-product of @code{signed char}.
1417*e4b17023SJohn Marino
1418*e4b17023SJohn Marino@item vect_udot_qi
1419*e4b17023SJohn MarinoTarget supports a vector dot-product of @code{unsigned char}.
1420*e4b17023SJohn Marino
1421*e4b17023SJohn Marino@item vect_sdot_hi
1422*e4b17023SJohn MarinoTarget supports a vector dot-product of @code{signed short}.
1423*e4b17023SJohn Marino
1424*e4b17023SJohn Marino@item vect_udot_hi
1425*e4b17023SJohn MarinoTarget supports a vector dot-product of @code{unsigned short}.
1426*e4b17023SJohn Marino
1427*e4b17023SJohn Marino@item vect_pack_trunc
1428*e4b17023SJohn MarinoTarget supports a vector demotion (packing) of @code{short} to @code{char}
1429*e4b17023SJohn Marinoand from @code{int} to @code{short} using modulo arithmetic.
1430*e4b17023SJohn Marino
1431*e4b17023SJohn Marino@item vect_unpack
1432*e4b17023SJohn MarinoTarget supports a vector promotion (unpacking) of @code{char} to @code{short}
1433*e4b17023SJohn Marinoand from @code{char} to @code{int}.
1434*e4b17023SJohn Marino
1435*e4b17023SJohn Marino@item vect_intfloat_cvt
1436*e4b17023SJohn MarinoTarget supports conversion from @code{signed int} to @code{float}.
1437*e4b17023SJohn Marino
1438*e4b17023SJohn Marino@item vect_uintfloat_cvt
1439*e4b17023SJohn MarinoTarget supports conversion from @code{unsigned int} to @code{float}.
1440*e4b17023SJohn Marino
1441*e4b17023SJohn Marino@item vect_floatint_cvt
1442*e4b17023SJohn MarinoTarget supports conversion from @code{float} to @code{signed int}.
1443*e4b17023SJohn Marino
1444*e4b17023SJohn Marino@item vect_floatuint_cvt
1445*e4b17023SJohn MarinoTarget supports conversion from @code{float} to @code{unsigned int}.
1446*e4b17023SJohn Marino@end table
1447*e4b17023SJohn Marino
1448*e4b17023SJohn Marino@subsubsection Thread Local Storage attributes
1449*e4b17023SJohn Marino
1450*e4b17023SJohn Marino@table @code
1451*e4b17023SJohn Marino@item tls
1452*e4b17023SJohn MarinoTarget supports thread-local storage.
1453*e4b17023SJohn Marino
1454*e4b17023SJohn Marino@item tls_native
1455*e4b17023SJohn MarinoTarget supports native (rather than emulated) thread-local storage.
1456*e4b17023SJohn Marino
1457*e4b17023SJohn Marino@item tls_runtime
1458*e4b17023SJohn MarinoTest system supports executing TLS executables.
1459*e4b17023SJohn Marino@end table
1460*e4b17023SJohn Marino
1461*e4b17023SJohn Marino@subsubsection Decimal floating point attributes
1462*e4b17023SJohn Marino
1463*e4b17023SJohn Marino@table @code
1464*e4b17023SJohn Marino@item dfp
1465*e4b17023SJohn MarinoTargets supports compiling decimal floating point extension to C.
1466*e4b17023SJohn Marino
1467*e4b17023SJohn Marino@item dfp_nocache
1468*e4b17023SJohn MarinoIncluding the options used to compile this particular test, the
1469*e4b17023SJohn Marinotarget supports compiling decimal floating point extension to C.
1470*e4b17023SJohn Marino
1471*e4b17023SJohn Marino@item dfprt
1472*e4b17023SJohn MarinoTest system can execute decimal floating point tests.
1473*e4b17023SJohn Marino
1474*e4b17023SJohn Marino@item dfprt_nocache
1475*e4b17023SJohn MarinoIncluding the options used to compile this particular test, the
1476*e4b17023SJohn Marinotest system can execute decimal floating point tests.
1477*e4b17023SJohn Marino
1478*e4b17023SJohn Marino@item hard_dfp
1479*e4b17023SJohn MarinoTarget generates decimal floating point instructions with current options.
1480*e4b17023SJohn Marino@end table
1481*e4b17023SJohn Marino
1482*e4b17023SJohn Marino@subsubsection ARM-specific attributes
1483*e4b17023SJohn Marino
1484*e4b17023SJohn Marino@table @code
1485*e4b17023SJohn Marino@item arm32
1486*e4b17023SJohn MarinoARM target generates 32-bit code.
1487*e4b17023SJohn Marino
1488*e4b17023SJohn Marino@item arm_eabi
1489*e4b17023SJohn MarinoARM target adheres to the ABI for the ARM Architecture.
1490*e4b17023SJohn Marino
1491*e4b17023SJohn Marino@item arm_hard_vfp_ok
1492*e4b17023SJohn MarinoARM target supports @code{-mfpu=vfp -mfloat-abi=hard}.
1493*e4b17023SJohn MarinoSome multilibs may be incompatible with these options.
1494*e4b17023SJohn Marino
1495*e4b17023SJohn Marino@item arm_iwmmxt_ok
1496*e4b17023SJohn MarinoARM target supports @code{-mcpu=iwmmxt}.
1497*e4b17023SJohn MarinoSome multilibs may be incompatible with this option.
1498*e4b17023SJohn Marino
1499*e4b17023SJohn Marino@item arm_neon
1500*e4b17023SJohn MarinoARM target supports generating NEON instructions.
1501*e4b17023SJohn Marino
1502*e4b17023SJohn Marino@item arm_neon_hw
1503*e4b17023SJohn MarinoTest system supports executing NEON instructions.
1504*e4b17023SJohn Marino
1505*e4b17023SJohn Marino@item arm_neon_ok
1506*e4b17023SJohn Marino@anchor{arm_neon_ok}
1507*e4b17023SJohn MarinoARM Target supports @code{-mfpu=neon -mfloat-abi=softfp} or compatible
1508*e4b17023SJohn Marinooptions.  Some multilibs may be incompatible with these options.
1509*e4b17023SJohn Marino
1510*e4b17023SJohn Marino@item arm_neon_fp16_ok
1511*e4b17023SJohn Marino@anchor{arm_neon_fp16_ok}
1512*e4b17023SJohn MarinoARM Target supports @code{-mfpu=neon-fp16 -mfloat-abi=softfp} or compatible
1513*e4b17023SJohn Marinooptions.  Some multilibs may be incompatible with these options.
1514*e4b17023SJohn Marino
1515*e4b17023SJohn Marino@item arm_thumb1_ok
1516*e4b17023SJohn MarinoARM target generates Thumb-1 code for @code{-mthumb}.
1517*e4b17023SJohn Marino
1518*e4b17023SJohn Marino@item arm_thumb2_ok
1519*e4b17023SJohn MarinoARM target generates Thumb-2 code for @code{-mthumb}.
1520*e4b17023SJohn Marino
1521*e4b17023SJohn Marino@item arm_vfp_ok
1522*e4b17023SJohn MarinoARM target supports @code{-mfpu=vfp -mfloat-abi=softfp}.
1523*e4b17023SJohn MarinoSome multilibs may be incompatible with these options.
1524*e4b17023SJohn Marino@end table
1525*e4b17023SJohn Marino
1526*e4b17023SJohn Marino@subsubsection MIPS-specific attributes
1527*e4b17023SJohn Marino
1528*e4b17023SJohn Marino@table @code
1529*e4b17023SJohn Marino@item mips64
1530*e4b17023SJohn MarinoMIPS target supports 64-bit instructions.
1531*e4b17023SJohn Marino
1532*e4b17023SJohn Marino@item nomips16
1533*e4b17023SJohn MarinoMIPS target does not produce MIPS16 code.
1534*e4b17023SJohn Marino
1535*e4b17023SJohn Marino@item mips16_attribute
1536*e4b17023SJohn MarinoMIPS target can generate MIPS16 code.
1537*e4b17023SJohn Marino
1538*e4b17023SJohn Marino@item mips_loongson
1539*e4b17023SJohn MarinoMIPS target is a Loongson-2E or -2F target using an ABI that supports
1540*e4b17023SJohn Marinothe Loongson vector modes.
1541*e4b17023SJohn Marino
1542*e4b17023SJohn Marino@item mips_newabi_large_long_double
1543*e4b17023SJohn MarinoMIPS target supports @code{long double} larger than @code{double}
1544*e4b17023SJohn Marinowhen using the new ABI.
1545*e4b17023SJohn Marino
1546*e4b17023SJohn Marino@item mpaired_single
1547*e4b17023SJohn MarinoMIPS target supports @code{-mpaired-single}.
1548*e4b17023SJohn Marino@end table
1549*e4b17023SJohn Marino
1550*e4b17023SJohn Marino@subsubsection PowerPC-specific attributes
1551*e4b17023SJohn Marino
1552*e4b17023SJohn Marino@table @code
1553*e4b17023SJohn Marino@item powerpc64
1554*e4b17023SJohn MarinoTest system supports executing 64-bit instructions.
1555*e4b17023SJohn Marino
1556*e4b17023SJohn Marino@item powerpc_altivec
1557*e4b17023SJohn MarinoPowerPC target supports AltiVec.
1558*e4b17023SJohn Marino
1559*e4b17023SJohn Marino@item powerpc_altivec_ok
1560*e4b17023SJohn MarinoPowerPC target supports @code{-maltivec}.
1561*e4b17023SJohn Marino
1562*e4b17023SJohn Marino@item powerpc_fprs
1563*e4b17023SJohn MarinoPowerPC target supports floating-point registers.
1564*e4b17023SJohn Marino
1565*e4b17023SJohn Marino@item powerpc_hard_double
1566*e4b17023SJohn MarinoPowerPC target supports hardware double-precision floating-point.
1567*e4b17023SJohn Marino
1568*e4b17023SJohn Marino@item powerpc_ppu_ok
1569*e4b17023SJohn MarinoPowerPC target supports @code{-mcpu=cell}.
1570*e4b17023SJohn Marino
1571*e4b17023SJohn Marino@item powerpc_spe
1572*e4b17023SJohn MarinoPowerPC target supports PowerPC SPE.
1573*e4b17023SJohn Marino
1574*e4b17023SJohn Marino@item powerpc_spe_nocache
1575*e4b17023SJohn MarinoIncluding the options used to compile this particular test, the
1576*e4b17023SJohn MarinoPowerPC target supports PowerPC SPE.
1577*e4b17023SJohn Marino
1578*e4b17023SJohn Marino@item powerpc_spu
1579*e4b17023SJohn MarinoPowerPC target supports PowerPC SPU.
1580*e4b17023SJohn Marino
1581*e4b17023SJohn Marino@item spu_auto_overlay
1582*e4b17023SJohn MarinoSPU target has toolchain that supports automatic overlay generation.
1583*e4b17023SJohn Marino
1584*e4b17023SJohn Marino@item powerpc_vsx_ok
1585*e4b17023SJohn MarinoPowerPC target supports @code{-mvsx}.
1586*e4b17023SJohn Marino
1587*e4b17023SJohn Marino@item powerpc_405_nocache
1588*e4b17023SJohn MarinoIncluding the options used to compile this particular test, the
1589*e4b17023SJohn MarinoPowerPC target supports PowerPC 405.
1590*e4b17023SJohn Marino
1591*e4b17023SJohn Marino@item vmx_hw
1592*e4b17023SJohn MarinoPowerPC target supports executing AltiVec instructions.
1593*e4b17023SJohn Marino@end table
1594*e4b17023SJohn Marino
1595*e4b17023SJohn Marino@subsubsection Other hardware attributes
1596*e4b17023SJohn Marino
1597*e4b17023SJohn Marino@table @code
1598*e4b17023SJohn Marino@item avx
1599*e4b17023SJohn MarinoTarget supports compiling @code{avx} instructions.
1600*e4b17023SJohn Marino
1601*e4b17023SJohn Marino@item avx_runtime
1602*e4b17023SJohn MarinoTarget supports the execution of @code{avx} instructions.
1603*e4b17023SJohn Marino
1604*e4b17023SJohn Marino@item cell_hw
1605*e4b17023SJohn MarinoTest system can execute AltiVec and Cell PPU instructions.
1606*e4b17023SJohn Marino
1607*e4b17023SJohn Marino@item coldfire_fpu
1608*e4b17023SJohn MarinoTarget uses a ColdFire FPU.
1609*e4b17023SJohn Marino
1610*e4b17023SJohn Marino@item hard_float
1611*e4b17023SJohn MarinoTarget supports FPU instructions.
1612*e4b17023SJohn Marino
1613*e4b17023SJohn Marino@item sse
1614*e4b17023SJohn MarinoTarget supports compiling @code{sse} instructions.
1615*e4b17023SJohn Marino
1616*e4b17023SJohn Marino@item sse_runtime
1617*e4b17023SJohn MarinoTarget supports the execution of @code{sse} instructions.
1618*e4b17023SJohn Marino
1619*e4b17023SJohn Marino@item sse2
1620*e4b17023SJohn MarinoTarget supports compiling @code{sse2} instructions.
1621*e4b17023SJohn Marino
1622*e4b17023SJohn Marino@item sse2_runtime
1623*e4b17023SJohn MarinoTarget supports the execution of @code{sse2} instructions.
1624*e4b17023SJohn Marino
1625*e4b17023SJohn Marino@item sync_char_short
1626*e4b17023SJohn MarinoTarget supports atomic operations on @code{char} and @code{short}.
1627*e4b17023SJohn Marino
1628*e4b17023SJohn Marino@item sync_int_long
1629*e4b17023SJohn MarinoTarget supports atomic operations on @code{int} and @code{long}.
1630*e4b17023SJohn Marino
1631*e4b17023SJohn Marino@item ultrasparc_hw
1632*e4b17023SJohn MarinoTest environment appears to run executables on a simulator that
1633*e4b17023SJohn Marinoaccepts only @code{EM_SPARC} executables and chokes on @code{EM_SPARC32PLUS}
1634*e4b17023SJohn Marinoor @code{EM_SPARCV9} executables.
1635*e4b17023SJohn Marino
1636*e4b17023SJohn Marino@item vect_cmdline_needed
1637*e4b17023SJohn MarinoTarget requires a command line argument to enable a SIMD instruction set.
1638*e4b17023SJohn Marino@end table
1639*e4b17023SJohn Marino
1640*e4b17023SJohn Marino@subsubsection Environment attributes
1641*e4b17023SJohn Marino
1642*e4b17023SJohn Marino@table @code
1643*e4b17023SJohn Marino@item c
1644*e4b17023SJohn MarinoThe language for the compiler under test is C.
1645*e4b17023SJohn Marino
1646*e4b17023SJohn Marino@item c++
1647*e4b17023SJohn MarinoThe language for the compiler under test is C++.
1648*e4b17023SJohn Marino
1649*e4b17023SJohn Marino@item c99_runtime
1650*e4b17023SJohn MarinoTarget provides a full C99 runtime.
1651*e4b17023SJohn Marino
1652*e4b17023SJohn Marino@item correct_iso_cpp_string_wchar_protos
1653*e4b17023SJohn MarinoTarget @code{string.h} and @code{wchar.h} headers provide C++ required
1654*e4b17023SJohn Marinooverloads for @code{strchr} etc. functions.
1655*e4b17023SJohn Marino
1656*e4b17023SJohn Marino@item dummy_wcsftime
1657*e4b17023SJohn MarinoTarget uses a dummy @code{wcsftime} function that always returns zero.
1658*e4b17023SJohn Marino
1659*e4b17023SJohn Marino@item fd_truncate
1660*e4b17023SJohn MarinoTarget can truncate a file from a file descriptor, as used by
1661*e4b17023SJohn Marino@file{libgfortran/io/unix.c:fd_truncate}; i.e. @code{ftruncate} or
1662*e4b17023SJohn Marino@code{chsize}.
1663*e4b17023SJohn Marino
1664*e4b17023SJohn Marino@item freestanding
1665*e4b17023SJohn MarinoTarget is @samp{freestanding} as defined in section 4 of the C99 standard.
1666*e4b17023SJohn MarinoEffectively, it is a target which supports no extra headers or libraries
1667*e4b17023SJohn Marinoother than what is considered essential.
1668*e4b17023SJohn Marino
1669*e4b17023SJohn Marino@item init_priority
1670*e4b17023SJohn MarinoTarget supports constructors with initialization priority arguments.
1671*e4b17023SJohn Marino
1672*e4b17023SJohn Marino@item inttypes_types
1673*e4b17023SJohn MarinoTarget has the basic signed and unsigned types in @code{inttypes.h}.
1674*e4b17023SJohn MarinoThis is for tests that GCC's notions of these types agree with those
1675*e4b17023SJohn Marinoin the header, as some systems have only @code{inttypes.h}.
1676*e4b17023SJohn Marino
1677*e4b17023SJohn Marino@item lax_strtofp
1678*e4b17023SJohn MarinoTarget might have errors of a few ULP in string to floating-point
1679*e4b17023SJohn Marinoconversion functions and overflow is not always detected correctly by
1680*e4b17023SJohn Marinothose functions.
1681*e4b17023SJohn Marino
1682*e4b17023SJohn Marino@item mmap
1683*e4b17023SJohn MarinoTarget supports @code{mmap}.
1684*e4b17023SJohn Marino
1685*e4b17023SJohn Marino@item newlib
1686*e4b17023SJohn MarinoTarget supports Newlib.
1687*e4b17023SJohn Marino
1688*e4b17023SJohn Marino@item pow10
1689*e4b17023SJohn MarinoTarget provides @code{pow10} function.
1690*e4b17023SJohn Marino
1691*e4b17023SJohn Marino@item pthread
1692*e4b17023SJohn MarinoTarget can compile using @code{pthread.h} with no errors or warnings.
1693*e4b17023SJohn Marino
1694*e4b17023SJohn Marino@item pthread_h
1695*e4b17023SJohn MarinoTarget has @code{pthread.h}.
1696*e4b17023SJohn Marino
1697*e4b17023SJohn Marino@item run_expensive_tests
1698*e4b17023SJohn MarinoExpensive testcases (usually those that consume excessive amounts of CPU
1699*e4b17023SJohn Marinotime) should be run on this target.  This can be enabled by setting the
1700*e4b17023SJohn Marino@env{GCC_TEST_RUN_EXPENSIVE} environment variable to a non-empty string.
1701*e4b17023SJohn Marino
1702*e4b17023SJohn Marino@item simulator
1703*e4b17023SJohn MarinoTest system runs executables on a simulator (i.e. slowly) rather than
1704*e4b17023SJohn Marinohardware (i.e. fast).
1705*e4b17023SJohn Marino
1706*e4b17023SJohn Marino@item stdint_types
1707*e4b17023SJohn MarinoTarget has the basic signed and unsigned C types in @code{stdint.h}.
1708*e4b17023SJohn MarinoThis will be obsolete when GCC ensures a working @code{stdint.h} for
1709*e4b17023SJohn Marinoall targets.
1710*e4b17023SJohn Marino
1711*e4b17023SJohn Marino@item trampolines
1712*e4b17023SJohn MarinoTarget supports trampolines.
1713*e4b17023SJohn Marino
1714*e4b17023SJohn Marino@item uclibc
1715*e4b17023SJohn MarinoTarget supports uClibc.
1716*e4b17023SJohn Marino
1717*e4b17023SJohn Marino@item unwrapped
1718*e4b17023SJohn MarinoTarget does not use a status wrapper.
1719*e4b17023SJohn Marino
1720*e4b17023SJohn Marino@item vxworks_kernel
1721*e4b17023SJohn MarinoTarget is a VxWorks kernel.
1722*e4b17023SJohn Marino
1723*e4b17023SJohn Marino@item vxworks_rtp
1724*e4b17023SJohn MarinoTarget is a VxWorks RTP.
1725*e4b17023SJohn Marino
1726*e4b17023SJohn Marino@item wchar
1727*e4b17023SJohn MarinoTarget supports wide characters.
1728*e4b17023SJohn Marino@end table
1729*e4b17023SJohn Marino
1730*e4b17023SJohn Marino@subsubsection Other attributes
1731*e4b17023SJohn Marino
1732*e4b17023SJohn Marino@table @code
1733*e4b17023SJohn Marino@item automatic_stack_alignment
1734*e4b17023SJohn MarinoTarget supports automatic stack alignment.
1735*e4b17023SJohn Marino
1736*e4b17023SJohn Marino@item cxa_atexit
1737*e4b17023SJohn MarinoTarget uses @code{__cxa_atexit}.
1738*e4b17023SJohn Marino
1739*e4b17023SJohn Marino@item default_packed
1740*e4b17023SJohn MarinoTarget has packed layout of structure members by default.
1741*e4b17023SJohn Marino
1742*e4b17023SJohn Marino@item fgraphite
1743*e4b17023SJohn MarinoTarget supports Graphite optimizations.
1744*e4b17023SJohn Marino
1745*e4b17023SJohn Marino@item fixed_point
1746*e4b17023SJohn MarinoTarget supports fixed-point extension to C.
1747*e4b17023SJohn Marino
1748*e4b17023SJohn Marino@item fopenmp
1749*e4b17023SJohn MarinoTarget supports OpenMP via @option{-fopenmp}.
1750*e4b17023SJohn Marino
1751*e4b17023SJohn Marino@item fpic
1752*e4b17023SJohn MarinoTarget supports @option{-fpic} and @option{-fPIC}.
1753*e4b17023SJohn Marino
1754*e4b17023SJohn Marino@item freorder
1755*e4b17023SJohn MarinoTarget supports @option{-freorder-blocks-and-partition}.
1756*e4b17023SJohn Marino
1757*e4b17023SJohn Marino@item fstack_protector
1758*e4b17023SJohn MarinoTarget supports @option{-fstack-protector}.
1759*e4b17023SJohn Marino
1760*e4b17023SJohn Marino@item gas
1761*e4b17023SJohn MarinoTarget uses GNU @command{as}.
1762*e4b17023SJohn Marino
1763*e4b17023SJohn Marino@item gc_sections
1764*e4b17023SJohn MarinoTarget supports @option{--gc-sections}.
1765*e4b17023SJohn Marino
1766*e4b17023SJohn Marino@item gld
1767*e4b17023SJohn MarinoTarget uses GNU @command{ld}.
1768*e4b17023SJohn Marino
1769*e4b17023SJohn Marino@item keeps_null_pointer_checks
1770*e4b17023SJohn MarinoTarget keeps null pointer checks, either due to the use of
1771*e4b17023SJohn Marino@option{-fno-delete-null-pointer-checks} or hardwired into the target.
1772*e4b17023SJohn Marino
1773*e4b17023SJohn Marino@item lto
1774*e4b17023SJohn MarinoCompiler has been configured to support link-time optimization (LTO).
1775*e4b17023SJohn Marino
1776*e4b17023SJohn Marino@item named_sections
1777*e4b17023SJohn MarinoTarget supports named sections.
1778*e4b17023SJohn Marino
1779*e4b17023SJohn Marino@item natural_alignment_32
1780*e4b17023SJohn MarinoTarget uses natural alignment (aligned to type size) for types of
1781*e4b17023SJohn Marino32 bits or less.
1782*e4b17023SJohn Marino
1783*e4b17023SJohn Marino@item target_natural_alignment_64
1784*e4b17023SJohn MarinoTarget uses natural alignment (aligned to type size) for types of
1785*e4b17023SJohn Marino64 bits or less.
1786*e4b17023SJohn Marino
1787*e4b17023SJohn Marino@item nonpic
1788*e4b17023SJohn MarinoTarget does not generate PIC by default.
1789*e4b17023SJohn Marino
1790*e4b17023SJohn Marino@item pcc_bitfield_type_matters
1791*e4b17023SJohn MarinoTarget defines @code{PCC_BITFIELD_TYPE_MATTERS}.
1792*e4b17023SJohn Marino
1793*e4b17023SJohn Marino@item pe_aligned_commons
1794*e4b17023SJohn MarinoTarget supports @option{-mpe-aligned-commons}.
1795*e4b17023SJohn Marino
1796*e4b17023SJohn Marino@item pie
1797*e4b17023SJohn MarinoTarget supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
1798*e4b17023SJohn Marino
1799*e4b17023SJohn Marino@item section_anchors
1800*e4b17023SJohn MarinoTarget supports section anchors.
1801*e4b17023SJohn Marino
1802*e4b17023SJohn Marino@item short_enums
1803*e4b17023SJohn MarinoTarget defaults to short enums.
1804*e4b17023SJohn Marino
1805*e4b17023SJohn Marino@item static
1806*e4b17023SJohn MarinoTarget supports @option{-static}.
1807*e4b17023SJohn Marino
1808*e4b17023SJohn Marino@item static_libgfortran
1809*e4b17023SJohn MarinoTarget supports statically linking @samp{libgfortran}.
1810*e4b17023SJohn Marino
1811*e4b17023SJohn Marino@item string_merging
1812*e4b17023SJohn MarinoTarget supports merging string constants at link time.
1813*e4b17023SJohn Marino
1814*e4b17023SJohn Marino@item ucn
1815*e4b17023SJohn MarinoTarget supports compiling and assembling UCN.
1816*e4b17023SJohn Marino
1817*e4b17023SJohn Marino@item ucn_nocache
1818*e4b17023SJohn MarinoIncluding the options used to compile this particular test, the
1819*e4b17023SJohn Marinotarget supports compiling and assembling UCN.
1820*e4b17023SJohn Marino
1821*e4b17023SJohn Marino@item unaligned_stack
1822*e4b17023SJohn MarinoTarget does not guarantee that its @code{STACK_BOUNDARY} is greater than
1823*e4b17023SJohn Marinoor equal to the required vector alignment.
1824*e4b17023SJohn Marino
1825*e4b17023SJohn Marino@item vector_alignment_reachable
1826*e4b17023SJohn MarinoVector alignment is reachable for types of 32 bits or less.
1827*e4b17023SJohn Marino
1828*e4b17023SJohn Marino@item vector_alignment_reachable_for_64bit
1829*e4b17023SJohn MarinoVector alignment is reachable for types of 64 bits or less.
1830*e4b17023SJohn Marino
1831*e4b17023SJohn Marino@item wchar_t_char16_t_compatible
1832*e4b17023SJohn MarinoTarget supports @code{wchar_t} that is compatible with @code{char16_t}.
1833*e4b17023SJohn Marino
1834*e4b17023SJohn Marino@item wchar_t_char32_t_compatible
1835*e4b17023SJohn MarinoTarget supports @code{wchar_t} that is compatible with @code{char32_t}.
1836*e4b17023SJohn Marino@end table
1837*e4b17023SJohn Marino
1838*e4b17023SJohn Marino@subsubsection Local to tests in @code{gcc.target/i386}
1839*e4b17023SJohn Marino
1840*e4b17023SJohn Marino@table @code
1841*e4b17023SJohn Marino@item 3dnow
1842*e4b17023SJohn MarinoTarget supports compiling @code{3dnow} instructions.
1843*e4b17023SJohn Marino
1844*e4b17023SJohn Marino@item aes
1845*e4b17023SJohn MarinoTarget supports compiling @code{aes} instructions.
1846*e4b17023SJohn Marino
1847*e4b17023SJohn Marino@item fma4
1848*e4b17023SJohn MarinoTarget supports compiling @code{fma4} instructions.
1849*e4b17023SJohn Marino
1850*e4b17023SJohn Marino@item ms_hook_prologue
1851*e4b17023SJohn MarinoTarget supports attribute @code{ms_hook_prologue}.
1852*e4b17023SJohn Marino
1853*e4b17023SJohn Marino@item pclmul
1854*e4b17023SJohn MarinoTarget supports compiling @code{pclmul} instructions.
1855*e4b17023SJohn Marino
1856*e4b17023SJohn Marino@item sse3
1857*e4b17023SJohn MarinoTarget supports compiling @code{sse3} instructions.
1858*e4b17023SJohn Marino
1859*e4b17023SJohn Marino@item sse4
1860*e4b17023SJohn MarinoTarget supports compiling @code{sse4} instructions.
1861*e4b17023SJohn Marino
1862*e4b17023SJohn Marino@item sse4a
1863*e4b17023SJohn MarinoTarget supports compiling @code{sse4a} instructions.
1864*e4b17023SJohn Marino
1865*e4b17023SJohn Marino@item ssse3
1866*e4b17023SJohn MarinoTarget supports compiling @code{ssse3} instructions.
1867*e4b17023SJohn Marino
1868*e4b17023SJohn Marino@item vaes
1869*e4b17023SJohn MarinoTarget supports compiling @code{vaes} instructions.
1870*e4b17023SJohn Marino
1871*e4b17023SJohn Marino@item vpclmul
1872*e4b17023SJohn MarinoTarget supports compiling @code{vpclmul} instructions.
1873*e4b17023SJohn Marino
1874*e4b17023SJohn Marino@item xop
1875*e4b17023SJohn MarinoTarget supports compiling @code{xop} instructions.
1876*e4b17023SJohn Marino@end table
1877*e4b17023SJohn Marino
1878*e4b17023SJohn Marino@subsubsection Local to tests in @code{gcc.target/spu/ea}
1879*e4b17023SJohn Marino
1880*e4b17023SJohn Marino@table @code
1881*e4b17023SJohn Marino@item ealib
1882*e4b17023SJohn MarinoTarget @code{__ea} library functions are available.
1883*e4b17023SJohn Marino@end table
1884*e4b17023SJohn Marino
1885*e4b17023SJohn Marino@subsubsection Local to tests in @code{gcc.test-framework}
1886*e4b17023SJohn Marino
1887*e4b17023SJohn Marino@table @code
1888*e4b17023SJohn Marino@item no
1889*e4b17023SJohn MarinoAlways returns 0.
1890*e4b17023SJohn Marino
1891*e4b17023SJohn Marino@item yes
1892*e4b17023SJohn MarinoAlways returns 1.
1893*e4b17023SJohn Marino@end table
1894*e4b17023SJohn Marino
1895*e4b17023SJohn Marino@node Add Options
1896*e4b17023SJohn Marino@subsection Features for @code{dg-add-options}
1897*e4b17023SJohn Marino
1898*e4b17023SJohn MarinoThe supported values of @var{feature} for directive @code{dg-add-options}
1899*e4b17023SJohn Marinoare:
1900*e4b17023SJohn Marino
1901*e4b17023SJohn Marino@table @code
1902*e4b17023SJohn Marino@item arm_neon
1903*e4b17023SJohn MarinoNEON support.  Only ARM targets support this feature, and only then
1904*e4b17023SJohn Marinoin certain modes; see the @ref{arm_neon_ok,,arm_neon_ok effective target
1905*e4b17023SJohn Marinokeyword}.
1906*e4b17023SJohn Marino
1907*e4b17023SJohn Marino@item arm_neon_fp16
1908*e4b17023SJohn MarinoNEON and half-precision floating point support.  Only ARM targets
1909*e4b17023SJohn Marinosupport this feature, and only then in certain modes; see
1910*e4b17023SJohn Marinothe @ref{arm_neon_ok,,arm_neon_fp16_ok effective target keyword}.
1911*e4b17023SJohn Marino
1912*e4b17023SJohn Marino@item bind_pic_locally
1913*e4b17023SJohn MarinoAdd the target-specific flags needed to enable functions to bind
1914*e4b17023SJohn Marinolocally when using pic/PIC passes in the testsuite.
1915*e4b17023SJohn Marino
1916*e4b17023SJohn Marino@item c99_runtime
1917*e4b17023SJohn MarinoAdd the target-specific flags needed to access the C99 runtime.
1918*e4b17023SJohn Marino
1919*e4b17023SJohn Marino@item ieee
1920*e4b17023SJohn MarinoAdd the target-specific flags needed to enable full IEEE
1921*e4b17023SJohn Marinocompliance mode.
1922*e4b17023SJohn Marino
1923*e4b17023SJohn Marino@item mips16_attribute
1924*e4b17023SJohn Marino@code{mips16} function attributes.
1925*e4b17023SJohn MarinoOnly MIPS targets support this feature, and only then in certain modes.
1926*e4b17023SJohn Marino
1927*e4b17023SJohn Marino@item tls
1928*e4b17023SJohn MarinoAdd the target-specific flags needed to use thread-local storage.
1929*e4b17023SJohn Marino@end table
1930*e4b17023SJohn Marino
1931*e4b17023SJohn Marino@node Require Support
1932*e4b17023SJohn Marino@subsection Variants of @code{dg-require-@var{support}}
1933*e4b17023SJohn Marino
1934*e4b17023SJohn MarinoA few of the @code{dg-require} directives take arguments.
1935*e4b17023SJohn Marino
1936*e4b17023SJohn Marino@table @code
1937*e4b17023SJohn Marino@item dg-require-iconv @var{codeset}
1938*e4b17023SJohn MarinoSkip the test if the target does not support iconv.  @var{codeset} is
1939*e4b17023SJohn Marinothe codeset to convert to.
1940*e4b17023SJohn Marino
1941*e4b17023SJohn Marino@item dg-require-profiling @var{profopt}
1942*e4b17023SJohn MarinoSkip the test if the target does not support profiling with option
1943*e4b17023SJohn Marino@var{profopt}.
1944*e4b17023SJohn Marino
1945*e4b17023SJohn Marino@item dg-require-visibility @var{vis}
1946*e4b17023SJohn MarinoSkip the test if the target does not support the @code{visibility} attribute.
1947*e4b17023SJohn MarinoIf @var{vis} is @code{""}, support for @code{visibility("hidden")} is
1948*e4b17023SJohn Marinochecked, for @code{visibility("@var{vis}")} otherwise.
1949*e4b17023SJohn Marino@end table
1950*e4b17023SJohn Marino
1951*e4b17023SJohn MarinoThe original @code{dg-require} directives were defined before there
1952*e4b17023SJohn Marinowas support for effective-target keywords.  The directives that do not
1953*e4b17023SJohn Marinotake arguments could be replaced with effective-target keywords.
1954*e4b17023SJohn Marino
1955*e4b17023SJohn Marino@table @code
1956*e4b17023SJohn Marino@item dg-require-alias ""
1957*e4b17023SJohn MarinoSkip the test if the target does not support the @samp{alias} attribute.
1958*e4b17023SJohn Marino
1959*e4b17023SJohn Marino@item dg-require-ascii-locale ""
1960*e4b17023SJohn MarinoSkip the test if the host does not support an ASCII locale.
1961*e4b17023SJohn Marino
1962*e4b17023SJohn Marino@item dg-require-compat-dfp ""
1963*e4b17023SJohn MarinoSkip this test unless both compilers in a @file{compat} testsuite
1964*e4b17023SJohn Marinosupport decimal floating point.
1965*e4b17023SJohn Marino
1966*e4b17023SJohn Marino@item dg-require-cxa-atexit ""
1967*e4b17023SJohn MarinoSkip the test if the target does not support @code{__cxa_atexit}.
1968*e4b17023SJohn MarinoThis is equivalent to @code{dg-require-effective-target cxa_atexit}.
1969*e4b17023SJohn Marino
1970*e4b17023SJohn Marino@item dg-require-dll ""
1971*e4b17023SJohn MarinoSkip the test if the target does not support DLL attributes.
1972*e4b17023SJohn Marino
1973*e4b17023SJohn Marino@item dg-require-fork ""
1974*e4b17023SJohn MarinoSkip the test if the target does not support @code{fork}.
1975*e4b17023SJohn Marino
1976*e4b17023SJohn Marino@item dg-require-gc-sections ""
1977*e4b17023SJohn MarinoSkip the test if the target's linker does not support the
1978*e4b17023SJohn Marino@code{--gc-sections} flags.
1979*e4b17023SJohn MarinoThis is equivalent to @code{dg-require-effective-target gc-sections}.
1980*e4b17023SJohn Marino
1981*e4b17023SJohn Marino@item dg-require-host-local ""
1982*e4b17023SJohn MarinoSkip the test if the host is remote, rather than the same as the build
1983*e4b17023SJohn Marinosystem.  Some tests are incompatible with DejaGnu's handling of remote
1984*e4b17023SJohn Marinohosts, which involves copying the source file to the host and compiling
1985*e4b17023SJohn Marinoit with a relative path and "@code{-o a.out}".
1986*e4b17023SJohn Marino
1987*e4b17023SJohn Marino@item dg-require-mkfifo ""
1988*e4b17023SJohn MarinoSkip the test if the target does not support @code{mkfifo}.
1989*e4b17023SJohn Marino
1990*e4b17023SJohn Marino@item dg-require-named-sections ""
1991*e4b17023SJohn MarinoSkip the test is the target does not support named sections.
1992*e4b17023SJohn MarinoThis is equivalent to @code{dg-require-effective-target named_sections}.
1993*e4b17023SJohn Marino
1994*e4b17023SJohn Marino@item dg-require-weak ""
1995*e4b17023SJohn MarinoSkip the test if the target does not support weak symbols.
1996*e4b17023SJohn Marino
1997*e4b17023SJohn Marino@item dg-require-weak-override ""
1998*e4b17023SJohn MarinoSkip the test if the target does not support overriding weak symbols.
1999*e4b17023SJohn Marino@end table
2000*e4b17023SJohn Marino
2001*e4b17023SJohn Marino@node Final Actions
2002*e4b17023SJohn Marino@subsection Commands for use in @code{dg-final}
2003*e4b17023SJohn Marino
2004*e4b17023SJohn MarinoThe GCC testsuite defines the following directives to be used within
2005*e4b17023SJohn Marino@code{dg-final}.
2006*e4b17023SJohn Marino
2007*e4b17023SJohn Marino@subsubsection Scan a particular file
2008*e4b17023SJohn Marino
2009*e4b17023SJohn Marino@table @code
2010*e4b17023SJohn Marino@item scan-file @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
2011*e4b17023SJohn MarinoPasses if @var{regexp} matches text in @var{filename}.
2012*e4b17023SJohn Marino@item scan-file-not @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
2013*e4b17023SJohn MarinoPasses if @var{regexp} does not match text in @var{filename}.
2014*e4b17023SJohn Marino@item scan-module @var{module} @var{regexp} [@{ target/xfail @var{selector} @}]
2015*e4b17023SJohn MarinoPasses if @var{regexp} matches in Fortran module @var{module}.
2016*e4b17023SJohn Marino@end table
2017*e4b17023SJohn Marino
2018*e4b17023SJohn Marino@subsubsection Scan the assembly output
2019*e4b17023SJohn Marino
2020*e4b17023SJohn Marino@table @code
2021*e4b17023SJohn Marino@item scan-assembler @var{regex} [@{ target/xfail @var{selector} @}]
2022*e4b17023SJohn MarinoPasses if @var{regex} matches text in the test's assembler output.
2023*e4b17023SJohn Marino
2024*e4b17023SJohn Marino@item scan-assembler-not @var{regex} [@{ target/xfail @var{selector} @}]
2025*e4b17023SJohn MarinoPasses if @var{regex} does not match text in the test's assembler output.
2026*e4b17023SJohn Marino
2027*e4b17023SJohn Marino@item scan-assembler-times @var{regex} @var{num} [@{ target/xfail @var{selector} @}]
2028*e4b17023SJohn MarinoPasses if @var{regex} is matched exactly @var{num} times in the test's
2029*e4b17023SJohn Marinoassembler output.
2030*e4b17023SJohn Marino
2031*e4b17023SJohn Marino@item scan-assembler-dem @var{regex} [@{ target/xfail @var{selector} @}]
2032*e4b17023SJohn MarinoPasses if @var{regex} matches text in the test's demangled assembler output.
2033*e4b17023SJohn Marino
2034*e4b17023SJohn Marino@item scan-assembler-dem-not @var{regex} [@{ target/xfail @var{selector} @}]
2035*e4b17023SJohn MarinoPasses if @var{regex} does not match text in the test's demangled assembler
2036*e4b17023SJohn Marinooutput.
2037*e4b17023SJohn Marino
2038*e4b17023SJohn Marino@item scan-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
2039*e4b17023SJohn MarinoPasses if @var{symbol} is defined as a hidden symbol in the test's
2040*e4b17023SJohn Marinoassembly output.
2041*e4b17023SJohn Marino
2042*e4b17023SJohn Marino@item scan-not-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
2043*e4b17023SJohn MarinoPasses if @var{symbol} is not defined as a hidden symbol in the test's
2044*e4b17023SJohn Marinoassembly output.
2045*e4b17023SJohn Marino@end table
2046*e4b17023SJohn Marino
2047*e4b17023SJohn Marino@subsubsection Scan optimization dump files
2048*e4b17023SJohn Marino
2049*e4b17023SJohn MarinoThese commands are available for @var{kind} of @code{tree}, @code{rtl},
2050*e4b17023SJohn Marinoand @code{ipa}.
2051*e4b17023SJohn Marino
2052*e4b17023SJohn Marino@table @code
2053*e4b17023SJohn Marino@item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
2054*e4b17023SJohn MarinoPasses if @var{regex} matches text in the dump file with suffix @var{suffix}.
2055*e4b17023SJohn Marino
2056*e4b17023SJohn Marino@item scan-@var{kind}-dump-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
2057*e4b17023SJohn MarinoPasses if @var{regex} does not match text in the dump file with suffix
2058*e4b17023SJohn Marino@var{suffix}.
2059*e4b17023SJohn Marino
2060*e4b17023SJohn Marino@item scan-@var{kind}-dump-times @var{regex} @var{num} @var{suffix} [@{ target/xfail @var{selector} @}]
2061*e4b17023SJohn MarinoPasses if @var{regex} is found exactly @var{num} times in the dump file
2062*e4b17023SJohn Marinowith suffix @var{suffix}.
2063*e4b17023SJohn Marino
2064*e4b17023SJohn Marino@item scan-@var{kind}-dump-dem @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
2065*e4b17023SJohn MarinoPasses if @var{regex} matches demangled text in the dump file with
2066*e4b17023SJohn Marinosuffix @var{suffix}.
2067*e4b17023SJohn Marino
2068*e4b17023SJohn Marino@item scan-@var{kind}-dump-dem-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
2069*e4b17023SJohn MarinoPasses if @var{regex} does not match demangled text in the dump file with
2070*e4b17023SJohn Marinosuffix @var{suffix}.
2071*e4b17023SJohn Marino@end table
2072*e4b17023SJohn Marino
2073*e4b17023SJohn Marino@subsubsection Verify that an output files exists or not
2074*e4b17023SJohn Marino
2075*e4b17023SJohn Marino@table @code
2076*e4b17023SJohn Marino@item output-exists [@{ target/xfail @var{selector} @}]
2077*e4b17023SJohn MarinoPasses if compiler output file exists.
2078*e4b17023SJohn Marino
2079*e4b17023SJohn Marino@item output-exists-not [@{ target/xfail @var{selector} @}]
2080*e4b17023SJohn MarinoPasses if compiler output file does not exist.
2081*e4b17023SJohn Marino@end table
2082*e4b17023SJohn Marino
2083*e4b17023SJohn Marino@subsubsection Check for LTO tests
2084*e4b17023SJohn Marino
2085*e4b17023SJohn Marino@table @code
2086*e4b17023SJohn Marino@item scan-symbol @var{regexp} [@{ target/xfail @var{selector} @}]
2087*e4b17023SJohn MarinoPasses if the pattern is present in the final executable.
2088*e4b17023SJohn Marino@end table
2089*e4b17023SJohn Marino
2090*e4b17023SJohn Marino@subsubsection Checks for @command{gcov} tests
2091*e4b17023SJohn Marino
2092*e4b17023SJohn Marino@table @code
2093*e4b17023SJohn Marino@item run-gcov @var{sourcefile}
2094*e4b17023SJohn MarinoCheck line counts in @command{gcov} tests.
2095*e4b17023SJohn Marino
2096*e4b17023SJohn Marino@item run-gcov [branches] [calls] @{ @var{opts} @var{sourcefile} @}
2097*e4b17023SJohn MarinoCheck branch and/or call counts, in addition to line counts, in
2098*e4b17023SJohn Marino@command{gcov} tests.
2099*e4b17023SJohn Marino@end table
2100*e4b17023SJohn Marino
2101*e4b17023SJohn Marino@subsubsection Clean up generated test files
2102*e4b17023SJohn Marino
2103*e4b17023SJohn Marino@table @code
2104*e4b17023SJohn Marino@item cleanup-coverage-files
2105*e4b17023SJohn MarinoRemoves coverage data files generated for this test.
2106*e4b17023SJohn Marino
2107*e4b17023SJohn Marino@item cleanup-ipa-dump @var{suffix}
2108*e4b17023SJohn MarinoRemoves IPA dump files generated for this test.
2109*e4b17023SJohn Marino
2110*e4b17023SJohn Marino@item cleanup-modules
2111*e4b17023SJohn MarinoRemoves Fortran module files generated for this test.
2112*e4b17023SJohn Marino
2113*e4b17023SJohn Marino@item cleanup-profile-file
2114*e4b17023SJohn MarinoRemoves profiling files generated for this test.
2115*e4b17023SJohn Marino
2116*e4b17023SJohn Marino@item cleanup-repo-files
2117*e4b17023SJohn MarinoRemoves files generated for this test for @option{-frepo}.
2118*e4b17023SJohn Marino
2119*e4b17023SJohn Marino@item cleanup-rtl-dump @var{suffix}
2120*e4b17023SJohn MarinoRemoves RTL dump files generated for this test.
2121*e4b17023SJohn Marino
2122*e4b17023SJohn Marino@item cleanup-saved-temps
2123*e4b17023SJohn MarinoRemoves files for the current test which were kept for @option{-save-temps}.
2124*e4b17023SJohn Marino
2125*e4b17023SJohn Marino@item cleanup-tree-dump @var{suffix}
2126*e4b17023SJohn MarinoRemoves tree dump files matching @var{suffix} which were generated for
2127*e4b17023SJohn Marinothis test.
2128*e4b17023SJohn Marino@end table
2129*e4b17023SJohn Marino
2130*e4b17023SJohn Marino@node Ada Tests
2131*e4b17023SJohn Marino@section Ada Language Testsuites
2132*e4b17023SJohn Marino
2133*e4b17023SJohn MarinoThe Ada testsuite includes executable tests from the ACATS
2134*e4b17023SJohn Marinotestsuite, publicly available at
2135*e4b17023SJohn Marino@uref{http://www.ada-auth.org/acats.html}.
2136*e4b17023SJohn Marino
2137*e4b17023SJohn MarinoThese tests are integrated in the GCC testsuite in the
2138*e4b17023SJohn Marino@file{ada/acats} directory, and
2139*e4b17023SJohn Marinoenabled automatically when running @code{make check}, assuming
2140*e4b17023SJohn Marinothe Ada language has been enabled when configuring GCC@.
2141*e4b17023SJohn Marino
2142*e4b17023SJohn MarinoYou can also run the Ada testsuite independently, using
2143*e4b17023SJohn Marino@code{make check-ada}, or run a subset of the tests by specifying which
2144*e4b17023SJohn Marinochapter to run, e.g.:
2145*e4b17023SJohn Marino
2146*e4b17023SJohn Marino@smallexample
2147*e4b17023SJohn Marino$ make check-ada CHAPTERS="c3 c9"
2148*e4b17023SJohn Marino@end smallexample
2149*e4b17023SJohn Marino
2150*e4b17023SJohn MarinoThe tests are organized by directory, each directory corresponding to
2151*e4b17023SJohn Marinoa chapter of the Ada Reference Manual.  So for example, @file{c9} corresponds
2152*e4b17023SJohn Marinoto chapter 9, which deals with tasking features of the language.
2153*e4b17023SJohn Marino
2154*e4b17023SJohn MarinoThere is also an extra chapter called @file{gcc} containing a template for
2155*e4b17023SJohn Marinocreating new executable tests, although this is deprecated in favor of
2156*e4b17023SJohn Marinothe @file{gnat.dg} testsuite.
2157*e4b17023SJohn Marino
2158*e4b17023SJohn MarinoThe tests are run using two @command{sh} scripts: @file{run_acats} and
2159*e4b17023SJohn Marino@file{run_all.sh}.  To run the tests using a simulator or a cross
2160*e4b17023SJohn Marinotarget, see the small
2161*e4b17023SJohn Marinocustomization section at the top of @file{run_all.sh}.
2162*e4b17023SJohn Marino
2163*e4b17023SJohn MarinoThese tests are run using the build tree: they can be run without doing
2164*e4b17023SJohn Marinoa @code{make install}.
2165*e4b17023SJohn Marino
2166*e4b17023SJohn Marino@node C Tests
2167*e4b17023SJohn Marino@section C Language Testsuites
2168*e4b17023SJohn Marino
2169*e4b17023SJohn MarinoGCC contains the following C language testsuites, in the
2170*e4b17023SJohn Marino@file{gcc/testsuite} directory:
2171*e4b17023SJohn Marino
2172*e4b17023SJohn Marino@table @file
2173*e4b17023SJohn Marino@item gcc.dg
2174*e4b17023SJohn MarinoThis contains tests of particular features of the C compiler, using the
2175*e4b17023SJohn Marinomore modern @samp{dg} harness.  Correctness tests for various compiler
2176*e4b17023SJohn Marinofeatures should go here if possible.
2177*e4b17023SJohn Marino
2178*e4b17023SJohn MarinoMagic comments determine whether the file
2179*e4b17023SJohn Marinois preprocessed, compiled, linked or run.  In these tests, error and warning
2180*e4b17023SJohn Marinomessage texts are compared against expected texts or regular expressions
2181*e4b17023SJohn Marinogiven in comments.  These tests are run with the options @samp{-ansi -pedantic}
2182*e4b17023SJohn Marinounless other options are given in the test.  Except as noted below they
2183*e4b17023SJohn Marinoare not run with multiple optimization options.
2184*e4b17023SJohn Marino@item gcc.dg/compat
2185*e4b17023SJohn MarinoThis subdirectory contains tests for binary compatibility using
2186*e4b17023SJohn Marino@file{lib/compat.exp}, which in turn uses the language-independent support
2187*e4b17023SJohn Marino(@pxref{compat Testing, , Support for testing binary compatibility}).
2188*e4b17023SJohn Marino@item gcc.dg/cpp
2189*e4b17023SJohn MarinoThis subdirectory contains tests of the preprocessor.
2190*e4b17023SJohn Marino@item gcc.dg/debug
2191*e4b17023SJohn MarinoThis subdirectory contains tests for debug formats.  Tests in this
2192*e4b17023SJohn Marinosubdirectory are run for each debug format that the compiler supports.
2193*e4b17023SJohn Marino@item gcc.dg/format
2194*e4b17023SJohn MarinoThis subdirectory contains tests of the @option{-Wformat} format
2195*e4b17023SJohn Marinochecking.  Tests in this directory are run with and without
2196*e4b17023SJohn Marino@option{-DWIDE}.
2197*e4b17023SJohn Marino@item gcc.dg/noncompile
2198*e4b17023SJohn MarinoThis subdirectory contains tests of code that should not compile and
2199*e4b17023SJohn Marinodoes not need any special compilation options.  They are run with
2200*e4b17023SJohn Marinomultiple optimization options, since sometimes invalid code crashes
2201*e4b17023SJohn Marinothe compiler with optimization.
2202*e4b17023SJohn Marino@item gcc.dg/special
2203*e4b17023SJohn MarinoFIXME: describe this.
2204*e4b17023SJohn Marino
2205*e4b17023SJohn Marino@item gcc.c-torture
2206*e4b17023SJohn MarinoThis contains particular code fragments which have historically broken easily.
2207*e4b17023SJohn MarinoThese tests are run with multiple optimization options, so tests for features
2208*e4b17023SJohn Marinowhich only break at some optimization levels belong here.  This also contains
2209*e4b17023SJohn Marinotests to check that certain optimizations occur.  It might be worthwhile to
2210*e4b17023SJohn Marinoseparate the correctness tests cleanly from the code quality tests, but
2211*e4b17023SJohn Marinoit hasn't been done yet.
2212*e4b17023SJohn Marino
2213*e4b17023SJohn Marino@item gcc.c-torture/compat
2214*e4b17023SJohn MarinoFIXME: describe this.
2215*e4b17023SJohn Marino
2216*e4b17023SJohn MarinoThis directory should probably not be used for new tests.
2217*e4b17023SJohn Marino@item gcc.c-torture/compile
2218*e4b17023SJohn MarinoThis testsuite contains test cases that should compile, but do not
2219*e4b17023SJohn Marinoneed to link or run.  These test cases are compiled with several
2220*e4b17023SJohn Marinodifferent combinations of optimization options.  All warnings are
2221*e4b17023SJohn Marinodisabled for these test cases, so this directory is not suitable if
2222*e4b17023SJohn Marinoyou wish to test for the presence or absence of compiler warnings.
2223*e4b17023SJohn MarinoWhile special options can be set, and tests disabled on specific
2224*e4b17023SJohn Marinoplatforms, by the use of @file{.x} files, mostly these test cases
2225*e4b17023SJohn Marinoshould not contain platform dependencies.  FIXME: discuss how defines
2226*e4b17023SJohn Marinosuch as @code{NO_LABEL_VALUES} and @code{STACK_SIZE} are used.
2227*e4b17023SJohn Marino@item gcc.c-torture/execute
2228*e4b17023SJohn MarinoThis testsuite contains test cases that should compile, link and run;
2229*e4b17023SJohn Marinootherwise the same comments as for @file{gcc.c-torture/compile} apply.
2230*e4b17023SJohn Marino@item gcc.c-torture/execute/ieee
2231*e4b17023SJohn MarinoThis contains tests which are specific to IEEE floating point.
2232*e4b17023SJohn Marino@item gcc.c-torture/unsorted
2233*e4b17023SJohn MarinoFIXME: describe this.
2234*e4b17023SJohn Marino
2235*e4b17023SJohn MarinoThis directory should probably not be used for new tests.
2236*e4b17023SJohn Marino@item gcc.misc-tests
2237*e4b17023SJohn MarinoThis directory contains C tests that require special handling.  Some
2238*e4b17023SJohn Marinoof these tests have individual expect files, and others share
2239*e4b17023SJohn Marinospecial-purpose expect files:
2240*e4b17023SJohn Marino
2241*e4b17023SJohn Marino@table @file
2242*e4b17023SJohn Marino@item @code{bprob*.c}
2243*e4b17023SJohn MarinoTest @option{-fbranch-probabilities} using
2244*e4b17023SJohn Marino@file{gcc.misc-tests/bprob.exp}, which
2245*e4b17023SJohn Marinoin turn uses the generic, language-independent framework
2246*e4b17023SJohn Marino(@pxref{profopt Testing, , Support for testing profile-directed
2247*e4b17023SJohn Marinooptimizations}).
2248*e4b17023SJohn Marino
2249*e4b17023SJohn Marino@item @code{gcov*.c}
2250*e4b17023SJohn MarinoTest @command{gcov} output using @file{gcov.exp}, which in turn uses the
2251*e4b17023SJohn Marinolanguage-independent support (@pxref{gcov Testing, , Support for testing gcov}).
2252*e4b17023SJohn Marino
2253*e4b17023SJohn Marino@item @code{i386-pf-*.c}
2254*e4b17023SJohn MarinoTest i386-specific support for data prefetch using @file{i386-prefetch.exp}.
2255*e4b17023SJohn Marino@end table
2256*e4b17023SJohn Marino
2257*e4b17023SJohn Marino@item gcc.test-framework
2258*e4b17023SJohn Marino@table @file
2259*e4b17023SJohn Marino@item @code{dg-*.c}
2260*e4b17023SJohn MarinoTest the testsuite itself using @file{gcc.test-framework/test-framework.exp}.
2261*e4b17023SJohn Marino@end table
2262*e4b17023SJohn Marino
2263*e4b17023SJohn Marino@end table
2264*e4b17023SJohn Marino
2265*e4b17023SJohn MarinoFIXME: merge in @file{testsuite/README.gcc} and discuss the format of
2266*e4b17023SJohn Marinotest cases and magic comments more.
2267*e4b17023SJohn Marino
2268*e4b17023SJohn Marino@node libgcj Tests
2269*e4b17023SJohn Marino@section The Java library testsuites.
2270*e4b17023SJohn Marino
2271*e4b17023SJohn MarinoRuntime tests are executed via @samp{make check} in the
2272*e4b17023SJohn Marino@file{@var{target}/libjava/testsuite} directory in the build
2273*e4b17023SJohn Marinotree.  Additional runtime tests can be checked into this testsuite.
2274*e4b17023SJohn Marino
2275*e4b17023SJohn MarinoRegression testing of the core packages in libgcj is also covered by the
2276*e4b17023SJohn MarinoMauve testsuite.  The @uref{http://sourceware.org/mauve/,,Mauve Project}
2277*e4b17023SJohn Marinodevelops tests for the Java Class Libraries.  These tests are run as part
2278*e4b17023SJohn Marinoof libgcj testing by placing the Mauve tree within the libjava testsuite
2279*e4b17023SJohn Marinosources at @file{libjava/testsuite/libjava.mauve/mauve}, or by specifying
2280*e4b17023SJohn Marinothe location of that tree when invoking @samp{make}, as in
2281*e4b17023SJohn Marino@samp{make MAUVEDIR=~/mauve check}.
2282*e4b17023SJohn Marino
2283*e4b17023SJohn MarinoTo detect regressions, a mechanism in @file{mauve.exp} compares the
2284*e4b17023SJohn Marinofailures for a test run against the list of expected failures in
2285*e4b17023SJohn Marino@file{libjava/testsuite/libjava.mauve/xfails} from the source hierarchy.
2286*e4b17023SJohn MarinoUpdate this file when adding new failing tests to Mauve, or when fixing
2287*e4b17023SJohn Marinobugs in libgcj that had caused Mauve test failures.
2288*e4b17023SJohn Marino
2289*e4b17023SJohn MarinoWe encourage developers to contribute test cases to Mauve.
2290*e4b17023SJohn Marino
2291*e4b17023SJohn Marino@node LTO Testing
2292*e4b17023SJohn Marino@section Support for testing link-time optimizations
2293*e4b17023SJohn Marino
2294*e4b17023SJohn MarinoTests for link-time optimizations usually require multiple source files
2295*e4b17023SJohn Marinothat are compiled separately, perhaps with different sets of options.
2296*e4b17023SJohn MarinoThere are several special-purpose test directives used for these tests.
2297*e4b17023SJohn Marino
2298*e4b17023SJohn Marino@table @code
2299*e4b17023SJohn Marino@item @{ dg-lto-do @var{do-what-keyword} @}
2300*e4b17023SJohn Marino@var{do-what-keyword} specifies how the test is compiled and whether
2301*e4b17023SJohn Marinoit is executed.  It is one of:
2302*e4b17023SJohn Marino
2303*e4b17023SJohn Marino@table @code
2304*e4b17023SJohn Marino@item assemble
2305*e4b17023SJohn MarinoCompile with @option{-c} to produce a relocatable object file.
2306*e4b17023SJohn Marino@item link
2307*e4b17023SJohn MarinoCompile, assemble, and link to produce an executable file.
2308*e4b17023SJohn Marino@item run
2309*e4b17023SJohn MarinoProduce and run an executable file, which is expected to return
2310*e4b17023SJohn Marinoan exit code of 0.
2311*e4b17023SJohn Marino@end table
2312*e4b17023SJohn Marino
2313*e4b17023SJohn MarinoThe default is @code{assemble}.  That can be overridden for a set of
2314*e4b17023SJohn Marinotests by redefining @code{dg-do-what-default} within the @code{.exp}
2315*e4b17023SJohn Marinofile for those tests.
2316*e4b17023SJohn Marino
2317*e4b17023SJohn MarinoUnlike @code{dg-do}, @code{dg-lto-do} does not support an optional
2318*e4b17023SJohn Marino@samp{target} or @samp{xfail} list.  Use @code{dg-skip-if},
2319*e4b17023SJohn Marino@code{dg-xfail-if}, or @code{dg-xfail-run-if}.
2320*e4b17023SJohn Marino
2321*e4b17023SJohn Marino@item @{ dg-lto-options @{ @{ @var{options} @} [@{ @var{options} @}] @} [@{ target @var{selector} @}]@}
2322*e4b17023SJohn MarinoThis directive provides a list of one or more sets of compiler options
2323*e4b17023SJohn Marinoto override @var{LTO_OPTIONS}.  Each test will be compiled and run with
2324*e4b17023SJohn Marinoeach of these sets of options.
2325*e4b17023SJohn Marino
2326*e4b17023SJohn Marino@item @{ dg-extra-ld-options @var{options} [@{ target @var{selector} @}]@}
2327*e4b17023SJohn MarinoThis directive adds @var{options} to the linker options used.
2328*e4b17023SJohn Marino
2329*e4b17023SJohn Marino@item @{ dg-suppress-ld-options @var{options} [@{ target @var{selector} @}]@}
2330*e4b17023SJohn MarinoThis directive removes @var{options} from the set of linker options used.
2331*e4b17023SJohn Marino@end table
2332*e4b17023SJohn Marino
2333*e4b17023SJohn Marino@node gcov Testing
2334*e4b17023SJohn Marino@section Support for testing @command{gcov}
2335*e4b17023SJohn Marino
2336*e4b17023SJohn MarinoLanguage-independent support for testing @command{gcov}, and for checking
2337*e4b17023SJohn Marinothat branch profiling produces expected values, is provided by the
2338*e4b17023SJohn Marinoexpect file @file{lib/gcov.exp}.  @command{gcov} tests also rely on procedures
2339*e4b17023SJohn Marinoin @file{lib/gcc-dg.exp} to compile and run the test program.  A typical
2340*e4b17023SJohn Marino@command{gcov} test contains the following DejaGnu commands within comments:
2341*e4b17023SJohn Marino
2342*e4b17023SJohn Marino@smallexample
2343*e4b17023SJohn Marino@{ dg-options "-fprofile-arcs -ftest-coverage" @}
2344*e4b17023SJohn Marino@{ dg-do run @{ target native @} @}
2345*e4b17023SJohn Marino@{ dg-final @{ run-gcov sourcefile @} @}
2346*e4b17023SJohn Marino@end smallexample
2347*e4b17023SJohn Marino
2348*e4b17023SJohn MarinoChecks of @command{gcov} output can include line counts, branch percentages,
2349*e4b17023SJohn Marinoand call return percentages.  All of these checks are requested via
2350*e4b17023SJohn Marinocommands that appear in comments in the test's source file.
2351*e4b17023SJohn MarinoCommands to check line counts are processed by default.
2352*e4b17023SJohn MarinoCommands to check branch percentages and call return percentages are
2353*e4b17023SJohn Marinoprocessed if the @command{run-gcov} command has arguments @code{branches}
2354*e4b17023SJohn Marinoor @code{calls}, respectively.  For example, the following specifies
2355*e4b17023SJohn Marinochecking both, as well as passing @option{-b} to @command{gcov}:
2356*e4b17023SJohn Marino
2357*e4b17023SJohn Marino@smallexample
2358*e4b17023SJohn Marino@{ dg-final @{ run-gcov branches calls @{ -b sourcefile @} @} @}
2359*e4b17023SJohn Marino@end smallexample
2360*e4b17023SJohn Marino
2361*e4b17023SJohn MarinoA line count command appears within a comment on the source line
2362*e4b17023SJohn Marinothat is expected to get the specified count and has the form
2363*e4b17023SJohn Marino@code{count(@var{cnt})}.  A test should only check line counts for
2364*e4b17023SJohn Marinolines that will get the same count for any architecture.
2365*e4b17023SJohn Marino
2366*e4b17023SJohn MarinoCommands to check branch percentages (@code{branch}) and call
2367*e4b17023SJohn Marinoreturn percentages (@code{returns}) are very similar to each other.
2368*e4b17023SJohn MarinoA beginning command appears on or before the first of a range of
2369*e4b17023SJohn Marinolines that will report the percentage, and the ending command
2370*e4b17023SJohn Marinofollows that range of lines.  The beginning command can include a
2371*e4b17023SJohn Marinolist of percentages, all of which are expected to be found within
2372*e4b17023SJohn Marinothe range.  A range is terminated by the next command of the same
2373*e4b17023SJohn Marinokind.  A command @code{branch(end)} or @code{returns(end)} marks
2374*e4b17023SJohn Marinothe end of a range without starting a new one.  For example:
2375*e4b17023SJohn Marino
2376*e4b17023SJohn Marino@smallexample
2377*e4b17023SJohn Marinoif (i > 10 && j > i && j < 20)  /* @r{branch(27 50 75)} */
2378*e4b17023SJohn Marino                                /* @r{branch(end)} */
2379*e4b17023SJohn Marino  foo (i, j);
2380*e4b17023SJohn Marino@end smallexample
2381*e4b17023SJohn Marino
2382*e4b17023SJohn MarinoFor a call return percentage, the value specified is the
2383*e4b17023SJohn Marinopercentage of calls reported to return.  For a branch percentage,
2384*e4b17023SJohn Marinothe value is either the expected percentage or 100 minus that
2385*e4b17023SJohn Marinovalue, since the direction of a branch can differ depending on the
2386*e4b17023SJohn Marinotarget or the optimization level.
2387*e4b17023SJohn Marino
2388*e4b17023SJohn MarinoNot all branches and calls need to be checked.  A test should not
2389*e4b17023SJohn Marinocheck for branches that might be optimized away or replaced with
2390*e4b17023SJohn Marinopredicated instructions.  Don't check for calls inserted by the
2391*e4b17023SJohn Marinocompiler or ones that might be inlined or optimized away.
2392*e4b17023SJohn Marino
2393*e4b17023SJohn MarinoA single test can check for combinations of line counts, branch
2394*e4b17023SJohn Marinopercentages, and call return percentages.  The command to check a
2395*e4b17023SJohn Marinoline count must appear on the line that will report that count, but
2396*e4b17023SJohn Marinocommands to check branch percentages and call return percentages can
2397*e4b17023SJohn Marinobracket the lines that report them.
2398*e4b17023SJohn Marino
2399*e4b17023SJohn Marino@node profopt Testing
2400*e4b17023SJohn Marino@section Support for testing profile-directed optimizations
2401*e4b17023SJohn Marino
2402*e4b17023SJohn MarinoThe file @file{profopt.exp} provides language-independent support for
2403*e4b17023SJohn Marinochecking correct execution of a test built with profile-directed
2404*e4b17023SJohn Marinooptimization.  This testing requires that a test program be built and
2405*e4b17023SJohn Marinoexecuted twice.  The first time it is compiled to generate profile
2406*e4b17023SJohn Marinodata, and the second time it is compiled to use the data that was
2407*e4b17023SJohn Marinogenerated during the first execution.  The second execution is to
2408*e4b17023SJohn Marinoverify that the test produces the expected results.
2409*e4b17023SJohn Marino
2410*e4b17023SJohn MarinoTo check that the optimization actually generated better code, a
2411*e4b17023SJohn Marinotest can be built and run a third time with normal optimizations to
2412*e4b17023SJohn Marinoverify that the performance is better with the profile-directed
2413*e4b17023SJohn Marinooptimizations.  @file{profopt.exp} has the beginnings of this kind
2414*e4b17023SJohn Marinoof support.
2415*e4b17023SJohn Marino
2416*e4b17023SJohn Marino@file{profopt.exp} provides generic support for profile-directed
2417*e4b17023SJohn Marinooptimizations.  Each set of tests that uses it provides information
2418*e4b17023SJohn Marinoabout a specific optimization:
2419*e4b17023SJohn Marino
2420*e4b17023SJohn Marino@table @code
2421*e4b17023SJohn Marino@item tool
2422*e4b17023SJohn Marinotool being tested, e.g., @command{gcc}
2423*e4b17023SJohn Marino
2424*e4b17023SJohn Marino@item profile_option
2425*e4b17023SJohn Marinooptions used to generate profile data
2426*e4b17023SJohn Marino
2427*e4b17023SJohn Marino@item feedback_option
2428*e4b17023SJohn Marinooptions used to optimize using that profile data
2429*e4b17023SJohn Marino
2430*e4b17023SJohn Marino@item prof_ext
2431*e4b17023SJohn Marinosuffix of profile data files
2432*e4b17023SJohn Marino
2433*e4b17023SJohn Marino@item PROFOPT_OPTIONS
2434*e4b17023SJohn Marinolist of options with which to run each test, similar to the lists for
2435*e4b17023SJohn Marinotorture tests
2436*e4b17023SJohn Marino
2437*e4b17023SJohn Marino@item @{ dg-final-generate @{ @var{local-directive} @} @}
2438*e4b17023SJohn MarinoThis directive is similar to @code{dg-final}, but the
2439*e4b17023SJohn Marino@var{local-directive} is run after the generation of profile data.
2440*e4b17023SJohn Marino
2441*e4b17023SJohn Marino@item @{ dg-final-use @{ @var{local-directive} @} @}
2442*e4b17023SJohn MarinoThe @var{local-directive} is run after the profile data have been
2443*e4b17023SJohn Marinoused.
2444*e4b17023SJohn Marino@end table
2445*e4b17023SJohn Marino
2446*e4b17023SJohn Marino@node compat Testing
2447*e4b17023SJohn Marino@section Support for testing binary compatibility
2448*e4b17023SJohn Marino
2449*e4b17023SJohn MarinoThe file @file{compat.exp} provides language-independent support for
2450*e4b17023SJohn Marinobinary compatibility testing.  It supports testing interoperability of
2451*e4b17023SJohn Marinotwo compilers that follow the same ABI, or of multiple sets of
2452*e4b17023SJohn Marinocompiler options that should not affect binary compatibility.  It is
2453*e4b17023SJohn Marinointended to be used for testsuites that complement ABI testsuites.
2454*e4b17023SJohn Marino
2455*e4b17023SJohn MarinoA test supported by this framework has three parts, each in a
2456*e4b17023SJohn Marinoseparate source file: a main program and two pieces that interact
2457*e4b17023SJohn Marinowith each other to split up the functionality being tested.
2458*e4b17023SJohn Marino
2459*e4b17023SJohn Marino@table @file
2460*e4b17023SJohn Marino@item @var{testname}_main.@var{suffix}
2461*e4b17023SJohn MarinoContains the main program, which calls a function in file
2462*e4b17023SJohn Marino@file{@var{testname}_x.@var{suffix}}.
2463*e4b17023SJohn Marino
2464*e4b17023SJohn Marino@item @var{testname}_x.@var{suffix}
2465*e4b17023SJohn MarinoContains at least one call to a function in
2466*e4b17023SJohn Marino@file{@var{testname}_y.@var{suffix}}.
2467*e4b17023SJohn Marino
2468*e4b17023SJohn Marino@item @var{testname}_y.@var{suffix}
2469*e4b17023SJohn MarinoShares data with, or gets arguments from,
2470*e4b17023SJohn Marino@file{@var{testname}_x.@var{suffix}}.
2471*e4b17023SJohn Marino@end table
2472*e4b17023SJohn Marino
2473*e4b17023SJohn MarinoWithin each test, the main program and one functional piece are
2474*e4b17023SJohn Marinocompiled by the GCC under test.  The other piece can be compiled by
2475*e4b17023SJohn Marinoan alternate compiler.  If no alternate compiler is specified,
2476*e4b17023SJohn Marinothen all three source files are all compiled by the GCC under test.
2477*e4b17023SJohn MarinoYou can specify pairs of sets of compiler options.  The first element
2478*e4b17023SJohn Marinoof such a pair specifies options used with the GCC under test, and the
2479*e4b17023SJohn Marinosecond element of the pair specifies options used with the alternate
2480*e4b17023SJohn Marinocompiler.  Each test is compiled with each pair of options.
2481*e4b17023SJohn Marino
2482*e4b17023SJohn Marino@file{compat.exp} defines default pairs of compiler options.
2483*e4b17023SJohn MarinoThese can be overridden by defining the environment variable
2484*e4b17023SJohn Marino@env{COMPAT_OPTIONS} as:
2485*e4b17023SJohn Marino
2486*e4b17023SJohn Marino@smallexample
2487*e4b17023SJohn MarinoCOMPAT_OPTIONS="[list [list @{@var{tst1}@} @{@var{alt1}@}]
2488*e4b17023SJohn Marino  @dots{}[list @{@var{tstn}@} @{@var{altn}@}]]"
2489*e4b17023SJohn Marino@end smallexample
2490*e4b17023SJohn Marino
2491*e4b17023SJohn Marinowhere @var{tsti} and @var{alti} are lists of options, with @var{tsti}
2492*e4b17023SJohn Marinoused by the compiler under test and @var{alti} used by the alternate
2493*e4b17023SJohn Marinocompiler.  For example, with
2494*e4b17023SJohn Marino@code{[list [list @{-g -O0@} @{-O3@}] [list @{-fpic@} @{-fPIC -O2@}]]},
2495*e4b17023SJohn Marinothe test is first built with @option{-g -O0} by the compiler under
2496*e4b17023SJohn Marinotest and with @option{-O3} by the alternate compiler.  The test is
2497*e4b17023SJohn Marinobuilt a second time using @option{-fpic} by the compiler under test
2498*e4b17023SJohn Marinoand @option{-fPIC -O2} by the alternate compiler.
2499*e4b17023SJohn Marino
2500*e4b17023SJohn MarinoAn alternate compiler is specified by defining an environment
2501*e4b17023SJohn Marinovariable to be the full pathname of an installed compiler; for C
2502*e4b17023SJohn Marinodefine @env{ALT_CC_UNDER_TEST}, and for C++ define
2503*e4b17023SJohn Marino@env{ALT_CXX_UNDER_TEST}.  These will be written to the
2504*e4b17023SJohn Marino@file{site.exp} file used by DejaGnu.  The default is to build each
2505*e4b17023SJohn Marinotest with the compiler under test using the first of each pair of
2506*e4b17023SJohn Marinocompiler options from @env{COMPAT_OPTIONS}.  When
2507*e4b17023SJohn Marino@env{ALT_CC_UNDER_TEST} or
2508*e4b17023SJohn Marino@env{ALT_CXX_UNDER_TEST} is @code{same}, each test is built using
2509*e4b17023SJohn Marinothe compiler under test but with combinations of the options from
2510*e4b17023SJohn Marino@env{COMPAT_OPTIONS}.
2511*e4b17023SJohn Marino
2512*e4b17023SJohn MarinoTo run only the C++ compatibility suite using the compiler under test
2513*e4b17023SJohn Marinoand another version of GCC using specific compiler options, do the
2514*e4b17023SJohn Marinofollowing from @file{@var{objdir}/gcc}:
2515*e4b17023SJohn Marino
2516*e4b17023SJohn Marino@smallexample
2517*e4b17023SJohn Marinorm site.exp
2518*e4b17023SJohn Marinomake -k \
2519*e4b17023SJohn Marino  ALT_CXX_UNDER_TEST=$@{alt_prefix@}/bin/g++ \
2520*e4b17023SJohn Marino  COMPAT_OPTIONS="@var{lists as shown above}" \
2521*e4b17023SJohn Marino  check-c++ \
2522*e4b17023SJohn Marino  RUNTESTFLAGS="compat.exp"
2523*e4b17023SJohn Marino@end smallexample
2524*e4b17023SJohn Marino
2525*e4b17023SJohn MarinoA test that fails when the source files are compiled with different
2526*e4b17023SJohn Marinocompilers, but passes when the files are compiled with the same
2527*e4b17023SJohn Marinocompiler, demonstrates incompatibility of the generated code or
2528*e4b17023SJohn Marinoruntime support.  A test that fails for the alternate compiler but
2529*e4b17023SJohn Marinopasses for the compiler under test probably tests for a bug that was
2530*e4b17023SJohn Marinofixed in the compiler under test but is present in the alternate
2531*e4b17023SJohn Marinocompiler.
2532*e4b17023SJohn Marino
2533*e4b17023SJohn MarinoThe binary compatibility tests support a small number of test framework
2534*e4b17023SJohn Marinocommands that appear within comments in a test file.
2535*e4b17023SJohn Marino
2536*e4b17023SJohn Marino@table @code
2537*e4b17023SJohn Marino@item dg-require-*
2538*e4b17023SJohn MarinoThese commands can be used in @file{@var{testname}_main.@var{suffix}}
2539*e4b17023SJohn Marinoto skip the test if specific support is not available on the target.
2540*e4b17023SJohn Marino
2541*e4b17023SJohn Marino@item dg-options
2542*e4b17023SJohn MarinoThe specified options are used for compiling this particular source
2543*e4b17023SJohn Marinofile, appended to the options from @env{COMPAT_OPTIONS}.  When this
2544*e4b17023SJohn Marinocommand appears in @file{@var{testname}_main.@var{suffix}} the options
2545*e4b17023SJohn Marinoare also used to link the test program.
2546*e4b17023SJohn Marino
2547*e4b17023SJohn Marino@item dg-xfail-if
2548*e4b17023SJohn MarinoThis command can be used in a secondary source file to specify that
2549*e4b17023SJohn Marinocompilation is expected to fail for particular options on particular
2550*e4b17023SJohn Marinotargets.
2551*e4b17023SJohn Marino@end table
2552*e4b17023SJohn Marino
2553*e4b17023SJohn Marino@node Torture Tests
2554*e4b17023SJohn Marino@section Support for torture testing using multiple options
2555*e4b17023SJohn Marino
2556*e4b17023SJohn MarinoThroughout the compiler testsuite there are several directories whose
2557*e4b17023SJohn Marinotests are run multiple times, each with a different set of options.
2558*e4b17023SJohn MarinoThese are known as torture tests.
2559*e4b17023SJohn Marino@file{lib/torture-options.exp} defines procedures to
2560*e4b17023SJohn Marinoset up these lists:
2561*e4b17023SJohn Marino
2562*e4b17023SJohn Marino@table @code
2563*e4b17023SJohn Marino@item torture-init
2564*e4b17023SJohn MarinoInitialize use of torture lists.
2565*e4b17023SJohn Marino@item set-torture-options
2566*e4b17023SJohn MarinoSet lists of torture options to use for tests with and without loops.
2567*e4b17023SJohn MarinoOptionally combine a set of torture options with a set of other
2568*e4b17023SJohn Marinooptions, as is done with Objective-C runtime options.
2569*e4b17023SJohn Marino@item torture-finish
2570*e4b17023SJohn MarinoFinalize use of torture lists.
2571*e4b17023SJohn Marino@end table
2572*e4b17023SJohn Marino
2573*e4b17023SJohn MarinoThe @file{.exp} file for a set of tests that use torture options must
2574*e4b17023SJohn Marinoinclude calls to these three procedures if:
2575*e4b17023SJohn Marino
2576*e4b17023SJohn Marino@itemize @bullet
2577*e4b17023SJohn Marino@item It calls @code{gcc-dg-runtest} and overrides @var{DG_TORTURE_OPTIONS}.
2578*e4b17023SJohn Marino
2579*e4b17023SJohn Marino@item It calls @var{$@{tool@}}@code{-torture} or
2580*e4b17023SJohn Marino@var{$@{tool@}}@code{-torture-execute}, where @var{tool} is @code{c},
2581*e4b17023SJohn Marino@code{fortran}, or @code{objc}.
2582*e4b17023SJohn Marino
2583*e4b17023SJohn Marino@item It calls @code{dg-pch}.
2584*e4b17023SJohn Marino@end itemize
2585*e4b17023SJohn Marino
2586*e4b17023SJohn MarinoIt is not necessary for a @file{.exp} file that calls @code{gcc-dg-runtest}
2587*e4b17023SJohn Marinoto call the torture procedures if the tests should use the list in
2588*e4b17023SJohn Marino@var{DG_TORTURE_OPTIONS} defined in @file{gcc-dg.exp}.
2589*e4b17023SJohn Marino
2590*e4b17023SJohn MarinoMost uses of torture options can override the default lists by defining
2591*e4b17023SJohn Marino@var{TORTURE_OPTIONS} or add to the default list by defining
2592*e4b17023SJohn Marino@var{ADDITIONAL_TORTURE_OPTIONS}.  Define these in a @file{.dejagnurc}
2593*e4b17023SJohn Marinofile or add them to the @file{site.exp} file; for example
2594*e4b17023SJohn Marino
2595*e4b17023SJohn Marino@smallexample
2596*e4b17023SJohn Marinoset ADDITIONAL_TORTURE_OPTIONS  [list \
2597*e4b17023SJohn Marino  @{ -O2 -ftree-loop-linear @} \
2598*e4b17023SJohn Marino  @{ -O2 -fpeel-loops @} ]
2599*e4b17023SJohn Marino@end smallexample
2600