gcc.pdf

(2944 KB) Pobierz
Using the GNU Compiler Collection
For
gcc
version 4.6.3
(Sourcery CodeBench Lite 2012.03-42)
Richard M. Stallman and the
GCC
Developer Community
Published by:
GNU Press
a division of the
Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
Website: www.gnupress.org
General: press@gnu.org
Orders: sales@gnu.org
Tel 617-542-5942
Fax 617-542-2652
Last printed October 2003 for GCC 3.3.1.
Printed copies are available for $45 each.
Copyright c 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of
the GNU Free Documentation License, Version 1.3 or any later version published by the
Free Software Foundation; with the Invariant Sections being “Funding Free Software”, the
Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see
below). A copy of the license is included in the section entitled “GNU Free Documentation
License”.
(a) The FSF’s Front-Cover Text is:
A GNU Manual
(b) The FSF’s Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software. Copies
published by the Free Software Foundation raise funds for GNU development.
i
Short Contents
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1 Programming Languages Supported by GCC
. . . . . . . . . . . . . . .
3
2 Language Standards Supported by GCC
. . . . . . . . . . . . . . . . . .
5
3 GCC Command Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
4 C Implementation-defined behavior
. . . . . . . . . . . . . . . . . . . . .
283
5 C++ Implementation-defined behavior
. . . . . . . . . . . . . . . . . .
291
6 Extensions to the C Language Family
. . . . . . . . . . . . . . . . . . .
293
7 Extensions to the C++ Language
. . . . . . . . . . . . . . . . . . . . . .
587
8 GNU Objective-C features
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
599
9 Binary Compatibility
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
615
10
gcov—a
Test Coverage Program
. . . . . . . . . . . . . . . . . . . . . . .
619
11 Known Causes of Trouble with GCC
. . . . . . . . . . . . . . . . . . . .
627
12 Reporting Bugs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
643
13 How To Get Help with GCC
. . . . . . . . . . . . . . . . . . . . . . . . . .
645
14 Contributing to GCC Development
. . . . . . . . . . . . . . . . . . . . .
647
Funding Free Software
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
649
The GNU Project and GNU/Linux
. . . . . . . . . . . . . . . . . . . . . . . . .
651
GNU General Public License
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
653
GNU Free Documentation License
. . . . . . . . . . . . . . . . . . . . . . . . .
665
Contributors to GCC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
673
Option Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
689
Keyword Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
707
iii
Table of Contents
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1
2
Programming Languages Supported by GCC
.................................................
3
Language Standards Supported by GCC
. . . . .
5
2.1
2.2
2.3
2.4
2.5
C language
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C++ language
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Objective-C and Objective-C++ languages
. . . . . . . . . . . . . . . . . . . . .
Go language
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
References for other languages
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
6
7
8
8
3
GCC Command Options
. . . . . . . . . . . . . . . . . . . . . . .
9
3.1 Option Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
3.2 Options Controlling the Kind of Output
. . . . . . . . . . . . . . . . . . . . . . .
23
3.3 Compiling C++ Programs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
3.4 Options Controlling C Dialect
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
3.5 Options Controlling C++ Dialect
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
3.6 Options Controlling Objective-C and Objective-C++ Dialects
. .
43
3.7 Options to Control Diagnostic Messages Formatting
. . . . . . . . . . .
47
3.8 Options to Request or Suppress Warnings
. . . . . . . . . . . . . . . . . . . . .
47
3.9 Options for Debugging Your Program or GCC
. . . . . . . . . . . . . . . . .
70
3.10 Options That Control Optimization
. . . . . . . . . . . . . . . . . . . . . . . . . .
89
3.11 Options Controlling the Preprocessor.
. . . . . . . . . . . . . . . . . . . . . . .
138
3.12 Passing Options to the Assembler
. . . . . . . . . . . . . . . . . . . . . . . . . . .
148
3.13 Options for Linking
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
149
3.14 Options for Directory Search
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
152
3.15 Specifying subprocesses and the switches to pass to them
. . . .
154
3.16 Specifying Target Machine and Compiler Version
. . . . . . . . . . . .
161
3.17 Hardware Models and Configurations
. . . . . . . . . . . . . . . . . . . . . . .
162
3.17.1 ARC Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
162
3.17.2 ARM Options.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
162
3.17.3 AVR Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
167
3.17.3.1
EIND
and Devices with more than 128k Bytes of Flash
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
168
3.17.4 Blackfin Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
169
3.17.5 CRIS Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
172
3.17.6 CRX Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
174
3.17.7 Darwin Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
174
3.17.8 DEC Alpha Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
177
3.17.9 DEC Alpha/VMS Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
182
3.17.10 FR30 Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
182
Zgłoś jeśli naruszono regulamin