aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@wasabisystems.com>2002-11-19 04:37:50 +0000
committerJason Thorpe <thorpej@gcc.gnu.org>2002-11-19 04:37:50 +0000
commitf3226a90019efdcdd3f1be3ef4fe19ff7f8d7f23 (patch)
treea48e1f22c976c1cbedd74ba5fba89fa5a4479319 /gcc/doc
parent3b312ef46fc9f3319b688174a105d5827dd122b1 (diff)
downloadgcc-f3226a90019efdcdd3f1be3ef4fe19ff7f8d7f23.zip
gcc-f3226a90019efdcdd3f1be3ef4fe19ff7f8d7f23.tar.gz
gcc-f3226a90019efdcdd3f1be3ef4fe19ff7f8d7f23.tar.bz2
gcc.c (The Specs Language): Document spec functions.
* gcc.c (The Specs Language): Document spec functions. (static_spec_functions, lookup_spec_function) (eval_spec_function, handle_spec_function) (if_exists_spec_function, alloc_args): New. (execute): Abort if processing_spec_function is true. (do_spec_1): Hand off spec to handle_spec_function if %: is encountered. If processing_spec_function is true, end any pending argument when the end of the string is reached. (main): Use alloc_args to allocate the initial argument vector. * gcc.h (struct spec_function): New. (lang_specific_spec_functions): New extern. * config/netbsd-elf.h (STARTFILE_SPEC): Add if-exists(crti%O%s). (ENDFILE_SPEC): Add if-exists(crtn%O%s). * config/alpha/netbsd.h (ENDFILE_SPEC): Likewise. * doc/invoke.texi: Document spec functions. * cppspec.c (lang_specific_spec_functions): New. * gccspec.c: Likewise. * g++spec.c (lang_specific_spec_functions): New. * g77spec.c (lang_specific_spec_functions): New. * jvspec.c (lang_specific_spec_functions): New. From-SVN: r59241
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 1df52de..45fee6f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4967,6 +4967,27 @@ Substitute the variable part of a matched option. See below.
Note that each comma in the substituted string is replaced by
a single space.
+@item %:@var{function}(@var{args})
+Call the named function @var{function}, passing it @var{args}.
+@var{args} is first processed as a nested spec string, then split
+into an argument vector in the usual fashion. The function returns
+a string which is processed as if it had appeared literally as part
+of the current spec.
+
+The following built-in spec functions are provided:
+
+@table @code
+@item @code{if-exists}
+The @code{if-exists} spec function takes one argument, an absolute
+pathname to a file. If the file exists, @code{if-exists} returns the
+pathname. Here is a small example of its usage:
+
+@smallexample
+*startfile:
+crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
+@end smallexample
+@end table
+
@item %@{@code{S}@}
Substitutes the @code{-S} switch, if that switch was given to GCC@.
If that switch was not specified, this substitutes nothing. Note that