mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:31:11 +08:00
c-tree.texi, [...]: Use @smallexample instead of @example.
* doc/c-tree.texi, doc/compat.texi, doc/cpp.texi, doc/cppopts.texi, doc/extend.texi, doc/install.texi, doc/interface.texi, doc/invoke.texi, doc/libgcc.texi, doc/md.texi, doc/objc.texi, doc/rtl.texi, doc/tm.texi, doc/trouble.texi: Use @smallexample instead of @example. From-SVN: r76075
This commit is contained in:
parent
cfbed37cf8
commit
3ab51846c1
@ -1,3 +1,11 @@
|
||||
2004-01-18 Joseph S. Myers <jsm@polyomino.org.uk>
|
||||
|
||||
* doc/c-tree.texi, doc/compat.texi, doc/cpp.texi,
|
||||
doc/cppopts.texi, doc/extend.texi, doc/install.texi,
|
||||
doc/interface.texi, doc/invoke.texi, doc/libgcc.texi, doc/md.texi,
|
||||
doc/objc.texi, doc/rtl.texi, doc/tm.texi, doc/trouble.texi: Use
|
||||
@smallexample instead of @example.
|
||||
|
||||
2004-01-17 Ziemowit Laski <zlaski@apple.com>
|
||||
|
||||
* objc/objc-act.c (build_objc_method_call): Use target
|
||||
|
@ -1,4 +1,4 @@
|
||||
@c Copyright (c) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
@ -98,24 +98,24 @@ Many macros behave as predicates. Many, although not all, of these
|
||||
predicates end in @samp{_P}. Do not rely on the result type of these
|
||||
macros being of any particular type. You may, however, rely on the fact
|
||||
that the type can be compared to @code{0}, so that statements like
|
||||
@example
|
||||
@smallexample
|
||||
if (TEST_P (t) && !TEST_P (y))
|
||||
x = 1;
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
and
|
||||
@example
|
||||
@smallexample
|
||||
int i = (TEST_P (t) != 0);
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
are legal. Macros that return @code{int} values now may be changed to
|
||||
return @code{tree} values, or other pointers in the future. Even those
|
||||
that continue to return @code{int} may return multiple nonzero codes
|
||||
where previously they returned only zero and one. Therefore, you should
|
||||
not write code like
|
||||
@example
|
||||
@smallexample
|
||||
if (TEST_P (t) == 1)
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
as this code is not guaranteed to work correctly in the future.
|
||||
|
||||
@ -871,15 +871,15 @@ This predicate holds if the declaration was implicitly generated by the
|
||||
compiler. For example, this predicate will hold of an implicitly
|
||||
declared member function, or of the @code{TYPE_DECL} implicitly
|
||||
generated for a class type. Recall that in C++ code like:
|
||||
@example
|
||||
@smallexample
|
||||
struct S @{@};
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
is roughly equivalent to C code like:
|
||||
@example
|
||||
@smallexample
|
||||
struct S @{@};
|
||||
typedef struct S S;
|
||||
@end example
|
||||
@end smallexample
|
||||
The implicitly generated @code{typedef} declaration is represented by a
|
||||
@code{TYPE_DECL} for which @code{DECL_ARTIFICIAL} holds.
|
||||
|
||||
@ -1029,9 +1029,9 @@ occurred.
|
||||
If a friend function is defined in a class scope, the
|
||||
@code{DECL_FRIEND_CONTEXT} macro can be used to determine the class in
|
||||
which it was defined. For example, in
|
||||
@example
|
||||
@smallexample
|
||||
class C @{ friend void f() @{@} @};
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
the @code{DECL_CONTEXT} for @code{f} will be the
|
||||
@code{global_namespace}, but the @code{DECL_FRIEND_CONTEXT} will be the
|
||||
@ -1378,7 +1378,7 @@ the expression has been omitted. A substatement may in fact be a list
|
||||
of statements, connected via their @code{TREE_CHAIN}s. So, you should
|
||||
always process the statement tree by looping over substatements, like
|
||||
this:
|
||||
@example
|
||||
@smallexample
|
||||
void process_stmt (stmt)
|
||||
tree stmt;
|
||||
@{
|
||||
@ -1397,7 +1397,7 @@ void process_stmt (stmt)
|
||||
stmt = TREE_CHAIN (stmt);
|
||||
@}
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
In other words, while the @code{then} clause of an @code{if} statement
|
||||
in C++ can be only one statement (although that one statement may be a
|
||||
compound statement), the intermediate representation will sometimes use
|
||||
@ -1408,18 +1408,18 @@ several statements chained together.
|
||||
|
||||
Used to represent an inline assembly statement. For an inline assembly
|
||||
statement like:
|
||||
@example
|
||||
@smallexample
|
||||
asm ("mov x, y");
|
||||
@end example
|
||||
@end smallexample
|
||||
The @code{ASM_STRING} macro will return a @code{STRING_CST} node for
|
||||
@code{"mov x, y"}. If the original statement made use of the
|
||||
extended-assembly syntax, then @code{ASM_OUTPUTS},
|
||||
@code{ASM_INPUTS}, and @code{ASM_CLOBBERS} will be the outputs, inputs,
|
||||
and clobbers for the statement, represented as @code{STRING_CST} nodes.
|
||||
The extended-assembly syntax looks like:
|
||||
@example
|
||||
@smallexample
|
||||
asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
|
||||
@end example
|
||||
@end smallexample
|
||||
The first string is the @code{ASM_STRING}, containing the instruction
|
||||
template. The next two strings are the output and inputs, respectively;
|
||||
this statement has no clobbers. As this example indicates, ``plain''
|
||||
@ -1451,9 +1451,9 @@ the same type as the condition expression in the switch statement.
|
||||
Otherwise, if both @code{CASE_LOW} and @code{CASE_HIGH} are defined, the
|
||||
statement is a range of case labels. Such statements originate with the
|
||||
extension that allows users to write things of the form:
|
||||
@example
|
||||
@smallexample
|
||||
case 2 ... 5:
|
||||
@end example
|
||||
@end smallexample
|
||||
The first value will be @code{CASE_LOW}, while the second will be
|
||||
@code{CASE_HIGH}.
|
||||
|
||||
@ -1562,9 +1562,9 @@ evaluated, the statement should be executed. Then, the
|
||||
@code{TREE_VALUE} should be used as the conditional expression itself.
|
||||
This representation is used to handle C++ code like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
if (int i = 7) @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
where there is a new local variable (or variables) declared within the
|
||||
condition.
|
||||
@ -1584,9 +1584,9 @@ the @code{LABEL_DECL} with @code{DECL_NAME}.
|
||||
|
||||
If the function uses the G++ ``named return value'' extension, meaning
|
||||
that the function has been defined like:
|
||||
@example
|
||||
@smallexample
|
||||
S f(int) return s @{@dots{}@}
|
||||
@end example
|
||||
@end smallexample
|
||||
then there will be a @code{RETURN_INIT}. There is never a named
|
||||
returned value for a constructor. The first argument to the
|
||||
@code{RETURN_INIT} is the name of the object returned; the second
|
||||
@ -1601,9 +1601,9 @@ constructed in the place where the object will be returned.
|
||||
Used to represent a @code{return} statement. The @code{RETURN_EXPR} is
|
||||
the expression returned; it will be @code{NULL_TREE} if the statement
|
||||
was just
|
||||
@example
|
||||
@smallexample
|
||||
return;
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item SCOPE_STMT
|
||||
|
||||
@ -1803,9 +1803,9 @@ noted otherwise, the operands to an expression are accessed using the
|
||||
@code{TREE_OPERAND} macro. For example, to access the first operand to
|
||||
a binary plus expression @code{expr}, use:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
TREE_OPERAND (expr, 0)
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
As this example indicates, the operands are zero-indexed.
|
||||
|
||||
@ -1819,10 +1819,11 @@ These nodes represent integer constants. Note that the type of these
|
||||
constants is obtained with @code{TREE_TYPE}; they are not always of type
|
||||
@code{int}. In particular, @code{char} constants are represented with
|
||||
@code{INTEGER_CST} nodes. The value of the integer constant @code{e} is
|
||||
given by @example
|
||||
given by
|
||||
@smallexample
|
||||
((TREE_INT_CST_HIGH (e) << HOST_BITS_PER_WIDE_INT)
|
||||
+ TREE_INST_CST_LOW (e))
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
HOST_BITS_PER_WIDE_INT is at least thirty-two on all platforms. Both
|
||||
@code{TREE_INT_CST_HIGH} and @code{TREE_INT_CST_LOW} return a
|
||||
@ -1893,11 +1894,11 @@ or @code{UNION_TYPE} within which the pointer points), and the
|
||||
Note that the @code{DECL_CONTEXT} for the @code{PTRMEM_CST_MEMBER} is in
|
||||
general different from the @code{PTRMEM_CST_CLASS}. For example,
|
||||
given:
|
||||
@example
|
||||
@smallexample
|
||||
struct B @{ int i; @};
|
||||
struct D : public B @{@};
|
||||
int D::*dp = &D::i;
|
||||
@end example
|
||||
@end smallexample
|
||||
@noindent
|
||||
The @code{PTRMEM_CST_CLASS} for @code{&D::i} is @code{D}, even though
|
||||
the @code{DECL_CONTEXT} for the @code{PTRMEM_CST_MEMBER} is @code{B},
|
||||
@ -2181,9 +2182,9 @@ sites.
|
||||
@item STMT_EXPR
|
||||
These nodes are used to represent GCC's statement-expression extension.
|
||||
The statement-expression extension allows code like this:
|
||||
@example
|
||||
@smallexample
|
||||
int f() @{ return (@{ int j; j = 3; j + 7; @}); @}
|
||||
@end example
|
||||
@end smallexample
|
||||
In other words, an sequence of statements may occur where a single
|
||||
expression would normally appear. The @code{STMT_EXPR} node represents
|
||||
such an expression. The @code{STMT_EXPR_STMT} gives the statement
|
||||
@ -2192,13 +2193,13 @@ value of the expression is the value of the last sub-statement in the
|
||||
@code{COMPOUND_STMT}. More precisely, the value is the value computed
|
||||
by the last @code{EXPR_STMT} in the outermost scope of the
|
||||
@code{COMPOUND_STMT}. For example, in:
|
||||
@example
|
||||
@smallexample
|
||||
(@{ 3; @})
|
||||
@end example
|
||||
@end smallexample
|
||||
the value is @code{3} while in:
|
||||
@example
|
||||
@smallexample
|
||||
(@{ if (x) @{ 3; @} @})
|
||||
@end example
|
||||
@end smallexample
|
||||
(represented by a nested @code{COMPOUND_STMT}), there is no value. If
|
||||
the @code{STMT_EXPR} does not yield a value, it's type will be
|
||||
@code{void}.
|
||||
|
@ -1,4 +1,4 @@
|
||||
@c Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -133,9 +133,9 @@ build was configured, but can be seen by using the G++ @option{-v} option.
|
||||
With default configuration options for G++ 3.3 the compile line for a
|
||||
different C++ compiler needs to include
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
-I@var{gcc_install_directory}/include/c++/3.3
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Similarly, compiling code with G++ that must use a C++ library other
|
||||
than the GNU C++ library requires specifying the location of the header
|
||||
|
402
gcc/doc/cpp.texi
402
gcc/doc/cpp.texi
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@c Copyright (c) 1999, 2000, 2001, 2002, 2003
|
||||
@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the CPP and GCC manuals.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
@ -255,11 +255,11 @@ files without updating the @file{Makefile} to match.
|
||||
|
||||
This is typical output:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: test.c test.h
|
||||
|
||||
test.h:
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item -MT @var{target}
|
||||
@opindex MT
|
||||
@ -275,9 +275,9 @@ argument to @option{-MT}, or use multiple @option{-MT} options.
|
||||
|
||||
For example, @option{@w{-MT '$(objpfx)foo.o'}} might give
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
$(objpfx)foo.o: foo.c
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item -MQ @var{target}
|
||||
@opindex MQ
|
||||
@ -285,9 +285,9 @@ $(objpfx)foo.o: foo.c
|
||||
Same as @option{-MT}, but it quotes any characters which are special to
|
||||
Make. @option{@w{-MQ '$(objpfx)foo.o'}} gives
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
$$(objpfx)foo.o: foo.c
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The default target is automatically quoted, as if it were given with
|
||||
@option{-MQ}.
|
||||
@ -563,9 +563,9 @@ preprocessor, including predefined macros. This gives you a way of
|
||||
finding out what is predefined in your version of the preprocessor.
|
||||
Assuming you have no file @file{foo.h}, the command
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
touch foo.h; cpp -dM foo.h
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
will show all the predefined macros.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -513,11 +513,11 @@ affected by this requirement, see
|
||||
|
||||
To configure GCC:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
% mkdir @var{objdir}
|
||||
% cd @var{objdir}
|
||||
% @var{srcdir}/configure [@var{options}] [@var{target}]
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
|
||||
@heading Target specification
|
||||
@ -999,9 +999,9 @@ Specify that only a particular subset of compilers and
|
||||
their runtime libraries should be built. For a list of valid values for
|
||||
@var{langN} you can issue the following command in the
|
||||
@file{gcc} directory of your GCC source tree:@*
|
||||
@example
|
||||
@smallexample
|
||||
grep language= */config-lang.in
|
||||
@end example
|
||||
@end smallexample
|
||||
Currently, you can use any of the following:
|
||||
@code{ada}, @code{c}, @code{c++}, @code{f77}, @code{java}, @code{objc}.
|
||||
Building the Ada compiler has special requirements, see below.@*
|
||||
@ -1294,10 +1294,10 @@ without debugging information as in the following example. This will save
|
||||
roughly 40% of disk space both for the bootstrap and the final installation.
|
||||
(Libraries will still contain debugging information.)
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make CFLAGS='-O' LIBCFLAGS='-g -O2' \
|
||||
LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
If you wish to use non-default GCC flags when compiling the stage2 and
|
||||
stage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing
|
||||
@ -1441,7 +1441,7 @@ library would be the same as the one built for the cross compiler.
|
||||
For example, you can build a native Ada compiler by issuing the
|
||||
following commands (assuming @command{make} is GNU make):
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
cd @var{objdir}
|
||||
@var{srcdir}/configure --enable-languages=c,ada
|
||||
cd @var{objdir}
|
||||
@ -1449,7 +1449,7 @@ following commands (assuming @command{make} is GNU make):
|
||||
cd gcc
|
||||
make gnatlib_and_tools
|
||||
cd ..
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Currently, when compiling the Ada front end, you cannot use the parallel
|
||||
build feature described in the previous section.
|
||||
@ -1519,10 +1519,10 @@ installed are not in the @env{PATH}, you may need to set the following
|
||||
environment variables appropriately, as in the following example (which
|
||||
assumes that DejaGnu has been installed under @file{/usr/local}):
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
TCL_LIBRARY = /usr/local/share/tcl8.0
|
||||
DEJAGNULIBS = /usr/local/share/dejagnu
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
(On systems such as Cygwin, these paths are required to be actual
|
||||
paths, not mounts or links; presumably this is due to some lack of
|
||||
@ -1530,9 +1530,9 @@ portability in the DejaGnu code.)
|
||||
|
||||
|
||||
Finally, you can run the testsuite (which may take a long time):
|
||||
@example
|
||||
@smallexample
|
||||
cd @var{objdir}; make -k check
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
This will test various components of GCC, such as compiler
|
||||
front ends and runtime libraries. While running the testsuite, DejaGnu
|
||||
@ -1551,16 +1551,16 @@ just run @samp{make check} in a subdirectory of the object directory.
|
||||
A more selective way to just run all @command{gcc} execute tests in the
|
||||
testsuite is to use
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make check-gcc RUNTESTFLAGS="execute.exp @var{other-options}"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Likewise, in order to run only the @command{g++} ``old-deja'' tests in
|
||||
the testsuite with filenames matching @samp{9805*}, you would use
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make check-g++ RUNTESTFLAGS="old-deja.exp=9805* @var{other-options}"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The @file{*.exp} files are located in the testsuite directories of the GCC
|
||||
source, the most important ones being @file{compile.exp},
|
||||
@ -1576,9 +1576,9 @@ You can pass multiple options to the testsuite using the
|
||||
@samp{RUNTESTFLAGS}, or directly to @command{runtest} if you prefer to
|
||||
work outside the makefiles. For example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make check-g++ RUNTESTFLAGS="--target_board=unix/-O3/-fno-strength-reduce"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
will run the standard @command{g++} testsuites (``unix'' is the target name
|
||||
for a standard native testsuite situation), passing
|
||||
@ -1588,15 +1588,15 @@ slashes separate options.
|
||||
You can run the testsuites multiple times using combinations of options
|
||||
with a syntax similar to the brace expansion of popular shells:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@dots{}"--target_board=arm-sim@{-mhard-float,-msoft-float@}@{-O1,-O2,-O3,@}"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
(Note the empty option caused by the trailing comma in the final group.)
|
||||
The following will run each testsuite eight times using the @samp{arm-sim}
|
||||
target, as if you had specified all possible combinations yourself:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
--target_board=arm-sim/-mhard-float/-O1
|
||||
--target_board=arm-sim/-mhard-float/-O2
|
||||
--target_board=arm-sim/-mhard-float/-O3
|
||||
@ -1605,14 +1605,14 @@ target, as if you had specified all possible combinations yourself:
|
||||
--target_board=arm-sim/-msoft-float/-O2
|
||||
--target_board=arm-sim/-msoft-float/-O3
|
||||
--target_board=arm-sim/-msoft-float
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
They can be combined as many times as you wish, in arbitrary ways. This
|
||||
list:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@dots{}"--target_board=unix/-Wextra@{-O3,-fno-strength-reduce@}@{-fomit-frame-pointer,@}"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
will generate four combinations, all involving @samp{-Wextra}.
|
||||
|
||||
@ -1623,15 +1623,15 @@ parallel by having the shell perform the combinations and @command{make}
|
||||
do the parallel runs. Instead of using @samp{--target_board}, use a
|
||||
special makefile target:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make -j@var{N} check-@var{testsuite}//@var{test-target}/@var{option1}/@var{option2}/@dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
For example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make -j3 check-gcc//sh-hms-sim/@{-m1,-m2,-m3,-m3e,-m4@}/@{,-nofpu@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
will run three concurrent ``make-gcc'' testsuites, eventually testing all
|
||||
ten combinations as described above. Note that this is currently only
|
||||
@ -1693,10 +1693,10 @@ problem in future releases.
|
||||
If you want to report the results to the GCC project, use the
|
||||
@file{contrib/test_summary} shell script. Start it in the @var{objdir} with
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@var{srcdir}/contrib/test_summary -p your_commentary.txt \
|
||||
-m gcc-testresults@@gcc.gnu.org |sh
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
This script uses the @command{Mail} program to send the results, so
|
||||
make sure it is in your @env{PATH}. The file @file{your_commentary.txt} is
|
||||
@ -1725,9 +1725,9 @@ messages may be automatically processed.
|
||||
@end ifnothtml
|
||||
|
||||
Now that GCC has been built (and optionally tested), you can install it with
|
||||
@example
|
||||
@smallexample
|
||||
cd @var{objdir}; make install
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
We strongly recommend to install into a target directory where there is
|
||||
no previous version of GCC present.
|
||||
@ -1755,9 +1755,9 @@ binutils, including assembler and linker.
|
||||
Installation into a temporary staging area or into a @command{chroot}
|
||||
jail can be achieved with the command
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
make DESTDIR=@var{path-to-rootdir} install
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent where @var{path-to-rootdir} is the absolute path of
|
||||
a directory relative to which all installation paths will be
|
||||
@ -2158,15 +2158,15 @@ we need to use the old assembler, invoked via the barely documented
|
||||
@option{-oldas} option. To bootstrap GCC, you either need to use the
|
||||
Compaq C Compiler:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
% CC=cc @var{srcdir}/configure [@var{options}] [@var{target}]
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
or you can use a copy of GCC 2.95.3 or higher built on Tru64 UNIX V4.0:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
% CC=gcc -Wa,-oldas @var{srcdir}/configure [@var{options}] [@var{target}]
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
As of GNU binutils 2.11.2, neither GNU @command{as} nor GNU @command{ld}
|
||||
are supported on Tru64 UNIX, so you must not configure GCC with
|
||||
@ -2231,10 +2231,10 @@ need to tell GCC where to find the assembler and the linker. The
|
||||
simplest way to do so is by providing @option{--with-as} and
|
||||
@option{--with-ld} to @file{configure}, e.g.@:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
configure --with-as=/opt/ctl/bin/cam --with-ld=/opt/ctl/bin/cld \
|
||||
--enable-languages=c
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The comparison test during @samp{make bootstrap} fails on Unicos/Mk
|
||||
because the assembler inserts timestamps into object files. You should
|
||||
@ -2306,9 +2306,9 @@ can also be obtained from:
|
||||
We @emph{strongly} recommend using binutils 2.13 or newer.
|
||||
|
||||
The following error:
|
||||
@example
|
||||
@smallexample
|
||||
Error: register required
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
indicates that you should upgrade to a newer version of the binutils.
|
||||
|
||||
@ -2712,10 +2712,10 @@ from the right place) while making the tools not think we're actually
|
||||
building a cross compiler. The easiest way to do this is with a configure
|
||||
command like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
CC=/udk/usr/ccs/bin/cc @var{/your/path/to}/gcc/configure \
|
||||
--host=i686-pc-udk --target=i686-pc-udk --program-prefix=udk-
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@emph{You should substitute @samp{i686} in the above command with the appropriate
|
||||
processor for your host.}
|
||||
@ -2803,21 +2803,21 @@ multilib @file{libstdc++.a} installed:
|
||||
|
||||
Extract the shared object from each the GCC 3.1 @file{libstdc++.a}
|
||||
archive:
|
||||
@example
|
||||
@smallexample
|
||||
% ar -x libstdc++.a libstdc++.so.4
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Enable the @samp{F_LOADONLY} flag so that the shared object will be
|
||||
available for runtime dynamic loading, but not linking:
|
||||
@example
|
||||
@smallexample
|
||||
% strip -e libstdc++.so.4
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Archive the runtime-only shared object in the GCC 3.2
|
||||
@file{libstdc++.a} archive:
|
||||
@example
|
||||
@smallexample
|
||||
% ar -q libstdc++.a libstdc++.so.4
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Linking executables and shared libraries may produce warnings of
|
||||
duplicate symbols. The assembly files generated by GCC for AIX always
|
||||
@ -2950,16 +2950,16 @@ encounter this problem, upgrade your operating system or use BASH (the
|
||||
GNU shell) to run @command{fixproto}. This bug will cause the fixproto
|
||||
program to report an error of the form:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
./fixproto: sh internal 1K buffer overflow
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
To fix this, you can also change the first line of the fixproto script
|
||||
to look like:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#!/bin/ksh
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@html
|
||||
<hr />
|
||||
@ -3042,21 +3042,21 @@ ensure that the N32 ABI is in use. To test this, compile a simple C
|
||||
file with @command{cc} and then run @command{file} on the
|
||||
resulting object file. The output should look like:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: ELF N32 MSB @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
If you see:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: ELF 32-bit MSB @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
or
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: ELF 64-bit MSB @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
then your version of @command{cc} uses the O32 or N64 ABI by default. You
|
||||
should set the environment variable @env{CC} to @samp{cc -n32}
|
||||
@ -3070,15 +3070,15 @@ the ISA depending on the machine where GCC is built. Using one of them
|
||||
as the bootstrap compiler may result in mips4 code, which won't run at
|
||||
all on mips3-only systems. For the test program above, you should see:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: ELF N32 MSB mips-3 @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
If you get:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
test.o: ELF N32 MSB mips-4 @dots{}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
instead, you should set the environment variable @env{CC} to @samp{cc
|
||||
-n32 -mips3} or @samp{gcc -mips3} respectively before configuring GCC@.
|
||||
@ -3407,9 +3407,9 @@ releases mishandled unaligned relocations on @code{sparc-*-*} targets.
|
||||
The following compiler flags must be specified in the configure
|
||||
step in order to bootstrap this target with the Sun compiler:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
% CC="cc -xildoff -xarch=v9" @var{srcdir}/configure [@var{options}] [@var{target}]
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@option{-xildoff} turns off the incremental linker, and @option{-xarch=v9}
|
||||
specifies the SPARC-V9 architecture to the Sun linker and assembler.
|
||||
@ -3443,10 +3443,10 @@ is said to work. Smaller values may also work.
|
||||
|
||||
On System V, if you get an error like this,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
/usr/local/lib/bison.simple: In function `yyparse':
|
||||
/usr/local/lib/bison.simple:625: virtual memory exhausted
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
that too indicates a problem with disk space, ulimit, or @code{MAXUMEM}.
|
||||
|
@ -1,5 +1,5 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
@c 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
@c 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -76,10 +76,10 @@ just take the address of the variable. If a variable's address is ever
|
||||
taken, even if just to compute it and ignore it, then the variable cannot
|
||||
go in a register:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@{
|
||||
int careful;
|
||||
&careful;
|
||||
@dots{}
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
@ -807,7 +807,7 @@ Specify explicitly the @var{language} for the following input files
|
||||
(rather than letting the compiler choose a default based on the file
|
||||
name suffix). This option applies to all following input files until
|
||||
the next @option{-x} option. Possible values for @var{language} are:
|
||||
@example
|
||||
@smallexample
|
||||
c c-header cpp-output
|
||||
c++ c++-header c++-cpp-output
|
||||
objective-c objective-c-header objc-cpp-output
|
||||
@ -816,7 +816,7 @@ ada
|
||||
f77 f77-cpp-input ratfor
|
||||
java
|
||||
treelang
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item -x none
|
||||
Turn off any specification of a language, so that subsequent files are
|
||||
@ -1247,9 +1247,9 @@ for C++ programs; but you can also use most of the GNU compiler options
|
||||
regardless of what language your program is in. For example, you
|
||||
might compile a file @code{firstClass.C} like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
g++ -g -frepo -O -c firstClass.C
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In this example, only @option{-frepo} is an option meant
|
||||
@ -1735,9 +1735,9 @@ for Objective-C programs, but you can also use most of the GNU compiler
|
||||
options regardless of what language your program is in. For example,
|
||||
you might compile a file @code{some_class.m} like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
gcc -g -fgnu-runtime -O -c some_class.m
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In this example, @option{-fgnu-runtime} is an option meant only for
|
||||
@ -3513,9 +3513,9 @@ Same as @option{-print-file-name=libgcc.a}.
|
||||
This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
|
||||
but you do want to link with @file{libgcc.a}. You can do
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item -print-search-dirs
|
||||
@opindex print-search-dirs
|
||||
@ -4217,7 +4217,7 @@ example, an @code{unsigned int} can alias an @code{int}, but not a
|
||||
type.
|
||||
|
||||
Pay special attention to code like this:
|
||||
@example
|
||||
@smallexample
|
||||
union a_union @{
|
||||
int i;
|
||||
double d;
|
||||
@ -4228,13 +4228,13 @@ int f() @{
|
||||
t.d = 3.0;
|
||||
return t.i;
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
The practice of reading from a different union member than the one most
|
||||
recently written to (called ``type-punning'') is common. Even with
|
||||
@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
|
||||
is accessed through the union type. So, the code above will work as
|
||||
expected. However, this code might not:
|
||||
@example
|
||||
@smallexample
|
||||
int f() @{
|
||||
a_union t;
|
||||
int* ip;
|
||||
@ -4242,7 +4242,7 @@ int f() @{
|
||||
ip = &t.i;
|
||||
return *ip;
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Every language that wishes to perform language-specific alias analysis
|
||||
should define a function that computes, given an @code{tree}
|
||||
@ -11094,12 +11094,12 @@ function and its call site. (On some platforms,
|
||||
function, so the call site information may not be available to the
|
||||
profiling functions otherwise.)
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
void __cyg_profile_func_enter (void *this_fn,
|
||||
void *call_site);
|
||||
void __cyg_profile_func_exit (void *this_fn,
|
||||
void *call_site);
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The first argument is the address of the start of the current function,
|
||||
which may be looked up exactly in the symbol table.
|
||||
@ -11579,10 +11579,10 @@ appropriate options and the option @option{-aux-info}. Then run
|
||||
the existing @samp{.X} file because it is newer than the source file.
|
||||
For example:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
gcc -Dfoo=bar file1.c -aux-info file1.X
|
||||
protoize *.c
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
You need to include the special files along with the rest in the
|
||||
|
@ -1,4 +1,4 @@
|
||||
@c Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
@c Contributed by Aldy Hernandez <aldy@quesejoda.com>
|
||||
@ -443,7 +443,7 @@ is NaN, and @var{a} is strictly greater than @var{b}.
|
||||
|
||||
document me!
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
_Unwind_DeleteException
|
||||
_Unwind_Find_FDE
|
||||
_Unwind_ForcedUnwind
|
||||
@ -472,7 +472,7 @@ document me!
|
||||
__register_frame_info_table
|
||||
__register_frame_info_table_bases
|
||||
__register_frame_table
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@node Miscellaneous routines
|
||||
@section Miscellaneous runtime library routines
|
||||
|
@ -1,5 +1,5 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001,
|
||||
@c 2002, 2003 Free Software Foundation, Inc.
|
||||
@c 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -181,7 +181,7 @@ this pattern. @xref{Insn Attributes}.
|
||||
|
||||
Here is an actual example of an instruction pattern, for the 68000/68020.
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(define_insn "tstsi"
|
||||
[(set (cc0)
|
||||
(match_operand:SI 0 "general_operand" "rm"))]
|
||||
@ -192,12 +192,12 @@ Here is an actual example of an instruction pattern, for the 68000/68020.
|
||||
return \"tstl %0\";
|
||||
return \"cmpl #0,%0\";
|
||||
@}")
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This can also be written using braced strings:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(define_insn "tstsi"
|
||||
[(set (cc0)
|
||||
(match_operand:SI 0 "general_operand" "rm"))]
|
||||
@ -207,7 +207,7 @@ This can also be written using braced strings:
|
||||
return "tstl %0";
|
||||
return "cmpl #0,%0";
|
||||
@})
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
This is an instruction that sets the condition codes based on the value of
|
||||
a general operand. It has no condition, so any insn whose RTL description
|
||||
@ -3548,24 +3548,24 @@ Every machine description must have a named pattern for each of the
|
||||
conditional branch names @samp{b@var{cond}}. The recognition template
|
||||
must always have the form
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(set (pc)
|
||||
(if_then_else (@var{cond} (cc0) (const_int 0))
|
||||
(label_ref (match_operand 0 "" ""))
|
||||
(pc)))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In addition, every machine description must have an anonymous pattern
|
||||
for each of the possible reverse-conditional branches. Their templates
|
||||
look like
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(set (pc)
|
||||
(if_then_else (@var{cond} (cc0) (const_int 0))
|
||||
(pc)
|
||||
(label_ref (match_operand 0 "" ""))))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
They are necessary because jump optimization can turn direct-conditional
|
||||
@ -3575,7 +3575,7 @@ It is often convenient to use the @code{match_operator} construct to
|
||||
reduce the number of patterns that must be specified for branches. For
|
||||
example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(define_insn ""
|
||||
[(set (pc)
|
||||
(if_then_else (match_operator 0 "comparison_operator"
|
||||
@ -3584,20 +3584,20 @@ example,
|
||||
(label_ref (match_operand 1 "" ""))))]
|
||||
"@var{condition}"
|
||||
"@dots{}")
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
In some cases machines support instructions identical except for the
|
||||
machine mode of one or more operands. For example, there may be
|
||||
``sign-extend halfword'' and ``sign-extend byte'' instructions whose
|
||||
patterns are
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(set (match_operand:SI 0 @dots{})
|
||||
(extend:SI (match_operand:HI 1 @dots{})))
|
||||
|
||||
(set (match_operand:SI 0 @dots{})
|
||||
(extend:SI (match_operand:QI 1 @dots{})))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Constant integers do not specify a machine mode, so an instruction to
|
||||
@ -3910,26 +3910,26 @@ A machine that has an instruction that performs a bitwise logical-and of one
|
||||
operand with the bitwise negation of the other should specify the pattern
|
||||
for that instruction as
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(define_insn ""
|
||||
[(set (match_operand:@var{m} 0 @dots{})
|
||||
(and:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{}))
|
||||
(match_operand:@var{m} 2 @dots{})))]
|
||||
"@dots{}"
|
||||
"@dots{}")
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Similarly, a pattern for a ``NAND'' instruction should be written
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(define_insn ""
|
||||
[(set (match_operand:@var{m} 0 @dots{})
|
||||
(ior:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{}))
|
||||
(not:@var{m} (match_operand:@var{m} 2 @dots{}))))]
|
||||
"@dots{}"
|
||||
"@dots{}")
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
In both cases, it is not necessary to include patterns for the many
|
||||
logically equivalent RTL expressions.
|
||||
@ -3944,9 +3944,9 @@ and @code{(not:@var{m} (xor:@var{m} @var{x} @var{y}))}.
|
||||
The sum of three items, one of which is a constant, will only appear in
|
||||
the form
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(plus:@var{m} (plus:@var{m} @var{x} @var{y}) @var{constant})
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
On machines that do not use @code{cc0},
|
||||
|
@ -1,5 +1,5 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
@c 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
@c 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -41,7 +41,7 @@ Suppose for example you have a @code{FileStream} class that declares
|
||||
@code{Stdin}, @code{Stdout} and @code{Stderr} as global variables, like
|
||||
below:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
|
||||
FileStream *Stdin = nil;
|
||||
FileStream *Stdout = nil;
|
||||
@ -59,7 +59,7 @@ FileStream *Stderr = nil;
|
||||
/* Other methods here */
|
||||
@@end
|
||||
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
In this example, the initialization of @code{Stdin}, @code{Stdout} and
|
||||
@code{Stderr} in @code{+initialize} occurs too late. The programmer can
|
||||
@ -73,7 +73,7 @@ just before entering @code{main}.
|
||||
The correct solution of the above problem is to use the @code{+load}
|
||||
method instead of @code{+initialize}:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
|
||||
@@implementation FileStream
|
||||
|
||||
@ -87,7 +87,7 @@ method instead of @code{+initialize}:
|
||||
/* Other methods here */
|
||||
@@end
|
||||
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The @code{+load} is a method that is not overridden by categories. If a
|
||||
class and a category of it both implement @code{+load}, both methods are
|
||||
@ -258,12 +258,12 @@ compiler on an i386 machine:
|
||||
@item Objective-C type
|
||||
@tab Compiler encoding
|
||||
@item
|
||||
@example
|
||||
@smallexample
|
||||
int a[10];
|
||||
@end example
|
||||
@end smallexample
|
||||
@tab @code{[10i]}
|
||||
@item
|
||||
@example
|
||||
@smallexample
|
||||
struct @{
|
||||
int i;
|
||||
float f[3];
|
||||
@ -271,7 +271,7 @@ struct @{
|
||||
int b:2;
|
||||
char c;
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
@tab @code{@{?=i[3f]b128i3b131i2c@}}
|
||||
@end multitable
|
||||
|
||||
@ -343,7 +343,7 @@ Here is an example of how to use this feature. Suppose you want to
|
||||
implement a class whose instances hold a weak pointer reference; the
|
||||
following class does this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
|
||||
@@interface WeakPointer : Object
|
||||
@{
|
||||
@ -375,7 +375,7 @@ following class does this:
|
||||
|
||||
@@end
|
||||
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Weak pointers are supported through a new type character specifier
|
||||
represented by the @samp{!} character. The
|
||||
@ -391,9 +391,9 @@ GNU Objective-C provides constant string objects that are generated
|
||||
directly by the compiler. You declare a constant string object by
|
||||
prefixing a C constant string with the character @samp{@@}:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
id myString = @@"this is a constant string object";
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The constant string objects are by default instances of the
|
||||
@code{NXConstantString} class which is provided by the GNU Objective-C
|
||||
@ -406,7 +406,7 @@ a new command line options @option{-fconstant-string-class=@var{class-name}}.
|
||||
The provided class should adhere to a strict structure, the same
|
||||
as @code{NXConstantString}'s structure:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
|
||||
@@interface MyConstantStringClass
|
||||
@{
|
||||
@ -416,7 +416,7 @@ as @code{NXConstantString}'s structure:
|
||||
@}
|
||||
@@end
|
||||
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@code{NXConstantString} inherits from @code{Object}; user class
|
||||
libraries may choose to inherit the customized constant string class
|
||||
@ -455,9 +455,9 @@ forgotten, we are documenting it here.
|
||||
The keyword @code{@@compatibility_alias} allows you to define a class name
|
||||
as equivalent to another class name. For example:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@@compatibility_alias WOApplication GSWApplication;
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
tells the compiler that each time it encounters @code{WOApplication} as
|
||||
a class name, it should replace it with @code{GSWApplication} (that is,
|
||||
|
@ -1,4 +1,4 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
@c Copyright (C) 1988, 1989, 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
@ -308,16 +308,16 @@ Operands of expressions are accessed using the macros @code{XEXP},
|
||||
two arguments: an expression-pointer (RTX) and an operand number
|
||||
(counting from zero). Thus,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
XEXP (@var{x}, 2)
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
accesses operand 2 of expression @var{x}, as an expression.
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
XINT (@var{x}, 2)
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
accesses the same operand as an integer. @code{XSTR}, used in the same
|
||||
@ -1850,9 +1850,9 @@ Represents the signed product of the values represented by @var{x} and
|
||||
Some machines support a multiplication that generates a product wider
|
||||
than the operands. Write the pattern for this as
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(mult:@var{m} (sign_extend:@var{m} @var{x}) (sign_extend:@var{m} @var{y}))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
where @var{m} is wider than the modes of @var{x} and @var{y}, which need
|
||||
not be the same.
|
||||
@ -1874,9 +1874,9 @@ Some machines have division instructions in which the operands and
|
||||
quotient widths are not all the same; you should represent
|
||||
such instructions using @code{truncate} and @code{sign_extend} as in,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(truncate:@var{m1} (div:@var{m2} @var{x} (sign_extend:@var{m2} @var{y})))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@findex udiv
|
||||
@cindex unsigned division
|
||||
@ -2232,9 +2232,9 @@ operation requires two operands of the same machine mode.
|
||||
Therefore, the byte-sized operand is enclosed in a conversion
|
||||
operation, as in
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The conversion operation is not a mere placeholder, because there
|
||||
may be more than one way of converting from a given starting mode
|
||||
@ -2567,10 +2567,10 @@ side effect expressions---expressions of code @code{set}, @code{call},
|
||||
side-effects are computed, and second all the actual side-effects are
|
||||
performed. For example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
|
||||
(set (mem:SI (reg:SI 1)) (reg:SI 1))])
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
says unambiguously that the values of hard register 1 and the memory
|
||||
@ -2583,13 +2583,13 @@ expect the result of one @code{set} to be available for the next one.
|
||||
For example, people sometimes attempt to represent a jump-if-zero
|
||||
instruction this way:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(parallel [(set (cc0) (reg:SI 34))
|
||||
(set (pc) (if_then_else
|
||||
(eq (cc0) (const_int 0))
|
||||
(label_ref @dots{})
|
||||
(pc)))])
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
But this is incorrect, because it says that the jump condition depends
|
||||
@ -2716,9 +2716,9 @@ by is the length in bytes of the machine mode of the containing memory
|
||||
reference of which this expression serves as the address. Here is an
|
||||
example of its use:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(mem:DF (pre_dec:SI (reg:SI 39)))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This says to decrement pseudo register 39 by the length of a @code{DFmode}
|
||||
@ -2878,16 +2878,16 @@ chain delimited by these insns, the @code{NEXT_INSN} and
|
||||
@code{PREV_INSN} pointers must always correspond: if @var{insn} is not
|
||||
the first insn,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
NEXT_INSN (PREV_INSN (@var{insn})) == @var{insn}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
is always true and if @var{insn} is not the last insn,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
PREV_INSN (NEXT_INSN (@var{insn})) == @var{insn}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
is always true.
|
||||
@ -3459,9 +3459,9 @@ RTL expression code, @code{call}.
|
||||
@cindex @code{call} usage
|
||||
A @code{call} expression has two operands, as follows:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(call (mem:@var{fm} @var{addr}) @var{nbytes})
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Here @var{nbytes} is an operand that represents the number of bytes of
|
||||
@ -3479,10 +3479,10 @@ For a subroutine that returns a value whose mode is not @code{BLKmode},
|
||||
the value is returned in a hard register. If this register's number is
|
||||
@var{r}, then the body of the call insn looks like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
(set (reg:@var{m} @var{r})
|
||||
(call (mem:@var{fm} @var{addr}) @var{nbytes}))
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This RTL expression makes it clear (to the optimizer passes) that the
|
||||
|
@ -1,5 +1,5 @@
|
||||
@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
|
||||
@c 2002, 2003 Free Software Foundation, Inc.
|
||||
@c 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -356,12 +356,12 @@ used.
|
||||
|
||||
The @file{config/rs6000/rs6000.h} target file defines:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define EXTRA_SPECS \
|
||||
@{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
|
||||
|
||||
#define CPP_SYS_DEFAULT ""
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The @file{config/rs6000/sysv.h} target file defines:
|
||||
@smallexample
|
||||
@ -561,7 +561,7 @@ operating system, code the component name as @samp{0}.
|
||||
|
||||
For example, here is the definition used for VAX/VMS:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define INCLUDE_DEFAULTS \
|
||||
@{ \
|
||||
@{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \
|
||||
@ -570,7 +570,7 @@ For example, here is the definition used for VAX/VMS:
|
||||
@{ ".", 0, 0, 0@}, \
|
||||
@{ 0, 0, 0, 0@} \
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
Here is the order of prefixes tried for exec files:
|
||||
@ -1253,7 +1253,7 @@ If your aim is to make GCC use the same conventions for laying out
|
||||
bit-fields as are used by another compiler, here is how to investigate
|
||||
what the other compiler does. Compile and run this program:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
struct foo1
|
||||
@{
|
||||
char x;
|
||||
@ -1276,7 +1276,7 @@ main ()
|
||||
sizeof (struct foo2));
|
||||
exit (0);
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
If this prints 2 and 5, then the compiler's behavior is what you would
|
||||
get from @code{PCC_BITFIELD_TYPE_MATTERS}.
|
||||
@ -1712,7 +1712,7 @@ int}.
|
||||
The C++ compiler represents a pointer-to-member-function with a struct
|
||||
that looks like:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
struct @{
|
||||
union @{
|
||||
void (*fn)();
|
||||
@ -1720,7 +1720,7 @@ that looks like:
|
||||
@};
|
||||
ptrdiff_t delta;
|
||||
@};
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The C++ compiler must use one bit to indicate whether the function that
|
||||
@ -2288,9 +2288,9 @@ in many of the tables described below.
|
||||
@defmac N_REG_CLASSES
|
||||
The number of distinct register classes, defined as follows:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
||||
@end example
|
||||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
@defmac REG_CLASS_NAMES
|
||||
@ -2409,9 +2409,9 @@ to use when it is necessary to copy value @var{x} into a register in class
|
||||
another, smaller class. On many machines, the following definition is
|
||||
safe:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Sometimes returning a more restrictive class makes better code. For
|
||||
example, on the 68000, when @var{x} is an integer constant that is in range
|
||||
@ -2623,11 +2623,11 @@ does not store the low-order 32 bits, as would be the case for a normal
|
||||
register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}
|
||||
as below:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
|
||||
(GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
|
||||
? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
|
||||
@end example
|
||||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
Three other special macros describe which operands fit which constraint
|
||||
@ -3347,12 +3347,12 @@ replacing it with either the frame pointer or the argument pointer,
|
||||
depending on whether or not the frame pointer has been eliminated.
|
||||
|
||||
In this case, you might specify:
|
||||
@example
|
||||
@smallexample
|
||||
#define ELIMINABLE_REGS \
|
||||
@{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
|
||||
@{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
|
||||
@{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Note that the elimination of the argument pointer with the stack pointer is
|
||||
specified first since that is the preferred elimination.
|
||||
@ -3413,18 +3413,18 @@ stack when an instruction attempts to push @var{npushed} bytes.
|
||||
|
||||
On some machines, the definition
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define PUSH_ROUNDING(BYTES) (BYTES)
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
will suffice. But on other machines, instructions that appear
|
||||
to push one byte actually push two bytes in an attempt to maintain
|
||||
alignment. Then the definition should be
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
|
||||
@end example
|
||||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
@findex current_function_outgoing_args_size
|
||||
@ -3901,9 +3901,9 @@ second of a pair (for a value of type @code{double}, say) need not be
|
||||
recognized by this macro. So for most machines, this definition
|
||||
suffices:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
If the machine has register windows, so that the caller and the called
|
||||
function use different registers for the return value, this macro
|
||||
@ -4284,9 +4284,9 @@ A function like @code{TARGET_ASM_OUTPUT_MI_THUNK}, except that if
|
||||
after adding @code{delta}. In particular, if @var{p} is the
|
||||
adjusted pointer, the following adjustment should be made:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
If this function is defined, it will always be used in place of
|
||||
@ -4907,9 +4907,9 @@ A C compound statement that attempts to replace @var{x} with a valid
|
||||
memory address for an operand of mode @var{mode}. @var{win} will be a
|
||||
C statement label elsewhere in the code; the macro definition may use
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
to avoid further processing if the address has become legitimate.
|
||||
@ -6275,9 +6275,9 @@ the address of this pool entry. The definition of this macro is
|
||||
responsible for outputting the label definition at the proper place.
|
||||
Here is how to do this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno});
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
When you output a pool entry specially, you should end with a
|
||||
@code{goto} to the label @var{jumpto}. This will prevent the same pool
|
||||
@ -6936,9 +6936,9 @@ support a @dfn{.init} section which is executed at program startup,
|
||||
parts of @file{crtstuff.c} are compiled into that section. The
|
||||
program is linked by the @command{gcc} driver like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The prologue of a function (@code{__init}) appears in the @code{.init}
|
||||
section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise
|
||||
@ -7357,10 +7357,10 @@ definitions of these labels are output using
|
||||
@code{(*targetm.asm_out.internal_label)}, and they must be printed in the same
|
||||
way here. For example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
fprintf (@var{stream}, "\t.word L%d-L%d\n",
|
||||
@var{value}, @var{rel})
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
You must provide this macro on machines where the addresses in a
|
||||
dispatch table are relative to the table's own address. If defined, GCC
|
||||
@ -7379,9 +7379,9 @@ a label. @var{value} is the number of an internal label whose
|
||||
definition is output using @code{(*targetm.asm_out.internal_label)}.
|
||||
For example,
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
fprintf (@var{stream}, "\t.word L%d\n", @var{value})
|
||||
@end example
|
||||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
@defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
|
||||
|
@ -1,5 +1,5 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
@c 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
@c 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@ -374,11 +374,11 @@ because of problems in DEC's versions of the X11 header files
|
||||
@option{-I/usr/include/mit} to use the MIT versions of the header files,
|
||||
or fixing the header files by adding this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#ifdef __STDC__
|
||||
#define NeedFunctionPrototypes 0
|
||||
#endif
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
On various 386 Unix systems derived from System V, including SCO, ISC,
|
||||
@ -393,17 +393,17 @@ is available as a separate package, and also in the file
|
||||
If you have installed GNU malloc as a separate library package, use this
|
||||
option when you relink GCC:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
MALLOC=/usr/local/lib/libgmalloc.a
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Alternatively, if you have compiled @file{gmalloc.c} from Emacs 19, copy
|
||||
the object file to @file{gmalloc.o} and use this option when you relink
|
||||
GCC:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
MALLOC=gmalloc.o
|
||||
@end example
|
||||
@end smallexample
|
||||
@end itemize
|
||||
|
||||
@node Incompatibilities
|
||||
@ -454,9 +454,9 @@ Negating this value yields 2147483648 again.
|
||||
GCC does not substitute macro arguments when they appear inside of
|
||||
string constants. For example, the following macro in GCC
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#define foo(a) "a"
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
will produce output @code{"a"} regardless of what the argument @var{a} is.
|
||||
@ -469,7 +469,7 @@ variables guaranteed to remain valid are those declared
|
||||
@code{volatile}. This is a consequence of automatic register
|
||||
allocation. Consider this function:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
jmp_buf j;
|
||||
|
||||
foo ()
|
||||
@ -484,7 +484,7 @@ foo ()
|
||||
/* @r{@code{longjmp (j)} may occur in @code{fun3}.} */
|
||||
return a + fun3 ();
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Here @code{a} may or may not be restored to its first value when the
|
||||
@code{longjmp} occurs. If @code{a} is allocated in a register, then
|
||||
@ -500,13 +500,13 @@ Programs that use preprocessing directives in the middle of macro
|
||||
arguments do not work with GCC@. For example, a program like this
|
||||
will not work:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
@group
|
||||
foobar (
|
||||
#define luser
|
||||
hack)
|
||||
@end group
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
ISO C does not permit such a construct.
|
||||
|
||||
@ -530,10 +530,10 @@ rest of the file even if it happens within a block.
|
||||
In traditional C, you can combine @code{long}, etc., with a typedef name,
|
||||
as shown here:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
typedef int foo;
|
||||
typedef long foo bar;
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
In ISO C, this is not allowed: @code{long} and other type modifiers
|
||||
require an explicit @code{int}.
|
||||
@ -546,10 +546,10 @@ PCC allows typedef names to be used as function parameters.
|
||||
Traditional C allows the following erroneous pair of declarations to
|
||||
appear together in a given scope:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
typedef int foo;
|
||||
typedef foo foo;
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
GCC treats all characters of identifiers as significant. According to
|
||||
@ -574,11 +574,11 @@ comments enclosed in conditionals that are guaranteed to fail; if these
|
||||
comments contain apostrophes, GCC will probably report an error. For
|
||||
example, this code would produce an error:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
#if 0
|
||||
You can't expect this to work.
|
||||
#endif
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The best solution to such a problem is to put the text into an actual
|
||||
C comment delimited by @samp{/*@dots{}*/}.
|
||||
@ -758,14 +758,14 @@ executable and your source code, when you use optimization.
|
||||
Users often think it is a bug when GCC reports an error for code
|
||||
like this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
int foo (struct mumble *);
|
||||
|
||||
struct mumble @{ @dots{} @};
|
||||
|
||||
int foo (struct mumble *x)
|
||||
@{ @dots{} @}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
This code really is erroneous, because the scope of @code{struct
|
||||
mumble} in the prototype is limited to the argument list containing it.
|
||||
@ -866,14 +866,14 @@ give rise to questions of this sort.
|
||||
When a class has static data members, it is not enough to @emph{declare}
|
||||
the static member; you must also @emph{define} it. For example:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
class Foo
|
||||
@{
|
||||
@dots{}
|
||||
void method();
|
||||
static int bar;
|
||||
@};
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
This declaration only establishes that the class @code{Foo} has an
|
||||
@code{int} named @code{Foo::bar}, and a member function named
|
||||
@ -882,9 +882,9 @@ This declaration only establishes that the class @code{Foo} has an
|
||||
standard, you must supply an initializer in one (and only one) source
|
||||
file, such as:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
int Foo::bar = 0;
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Other C++ compilers may not correctly implement the standard behavior.
|
||||
As a result, when you switch to @command{g++} from one of these compilers,
|
||||
@ -908,7 +908,7 @@ template parameters. This shorter term will also be used in the rest of
|
||||
this section.} Only names that are dependent are looked up at the point
|
||||
of instantiation. For example, consider
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
void foo(double);
|
||||
|
||||
struct A @{
|
||||
@ -923,7 +923,7 @@ of instantiation. For example, consider
|
||||
|
||||
static const int N;
|
||||
@};
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Here, the names @code{foo} and @code{N} appear in a context that does
|
||||
not depend on the type of @code{T}. The compiler will thus require that
|
||||
@ -947,7 +947,7 @@ since version 3.4.
|
||||
Two-stage name lookup sometimes leads to situations with behavior
|
||||
different from non-template codes. The most common is probably this:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
template <typename T> struct Base @{
|
||||
int i;
|
||||
@};
|
||||
@ -955,7 +955,7 @@ different from non-template codes. The most common is probably this:
|
||||
template <typename T> struct Derived : public Base<T> @{
|
||||
int get_i() @{ return i; @}
|
||||
@};
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
In @code{get_i()}, @code{i} is not used in a dependent context, so the
|
||||
compiler will look for a name declared at the enclosing namespace scope
|
||||
@ -976,7 +976,7 @@ into scope by a @code{using}-declaration.
|
||||
Another, similar example involves calling member functions of a base
|
||||
class:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
template <typename T> struct Base @{
|
||||
int f();
|
||||
@};
|
||||
@ -984,7 +984,7 @@ class:
|
||||
template <typename T> struct Derived : Base<T> @{
|
||||
int g() @{ return f(); @};
|
||||
@};
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
Again, the call to @code{f()} is not dependent on template arguments
|
||||
(there are no arguments that depend on the type @code{T}, and it is also
|
||||
@ -993,13 +993,13 @@ Thus a global declaration of such a function must be available, since
|
||||
the one in the base class is not visible until instantiation time. The
|
||||
compiler will consequently produce the following error message:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
x.cc: In member function `int Derived<T>::g()':
|
||||
x.cc:6: error: there are no arguments to `f' that depend on a template
|
||||
parameter, so a declaration of `f' must be available
|
||||
x.cc:6: error: (if you use `-fpermissive', G++ will accept your code, but
|
||||
allowing the use of an undeclared name is deprecated)
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
To make the code valid either use @code{this->f()}, or
|
||||
@code{Base<T>::f()}. Using the @code{-fpermissive} flag will also let
|
||||
@ -1035,7 +1035,7 @@ For example, a program may use a function @code{strfunc} that returns
|
||||
@code{string} objects, and another function @code{charfunc} that
|
||||
operates on pointers to @code{char}:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
string strfunc ();
|
||||
void charfunc (const char *);
|
||||
|
||||
@ -1048,7 +1048,7 @@ f ()
|
||||
@dots{}
|
||||
charfunc (p);
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In this situation, it may seem reasonable to save a pointer to the C
|
||||
@ -1067,10 +1067,10 @@ The safe way to write such code is to give the temporary a name, which
|
||||
forces it to remain until the end of the scope of the name. For
|
||||
example:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
string& tmp = strfunc ();
|
||||
charfunc (tmp.c_str ());
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
@node Copy Assignment
|
||||
@subsection Implicit Copy-Assignment for Virtual Bases
|
||||
@ -1080,7 +1080,7 @@ belongs to each full object. Also, the constructors and destructors are
|
||||
invoked only once, and called from the most-derived class. However, such
|
||||
objects behave unspecified when being assigned. For example:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
struct Base@{
|
||||
char *name;
|
||||
Base(char *n) : name(strdup(n))@{@}
|
||||
@ -1108,7 +1108,7 @@ void func(Derived &d1, Derived &d2)
|
||||
@{
|
||||
d1 = d2;
|
||||
@}
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
The C++ standard specifies that @samp{Base::Base} is only called once
|
||||
when constructing or copy-constructing a Derived object. It is
|
||||
@ -1404,12 +1404,12 @@ It is never safe to depend on the order of evaluation of side effects.
|
||||
For example, a function call like this may very well behave differently
|
||||
from one compiler to another:
|
||||
|
||||
@example
|
||||
@smallexample
|
||||
void func (int, int);
|
||||
|
||||
int i = 2;
|
||||
func (i++, i++);
|
||||
@end example
|
||||
@end smallexample
|
||||
|
||||
There is no guarantee (in either the C or the C++ standard language
|
||||
definitions) that the increments will be evaluated in any particular
|
||||
|
Loading…
x
Reference in New Issue
Block a user