Using the GNU Compiler Collection
Total Page:16
File Type:pdf, Size:1020Kb
Using the GNU Compiler Collection For gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188) Richard M. Stallman and the GCC Developer Community Published by: GNU Press Website: www.gnupress.org a division of the General: [email protected] Free Software Foundation Orders: [email protected] 51 Franklin Street, Fifth Floor Tel 617-542-5942 Boston, MA 02110-1301 USA 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 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.2 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 ::::::::::::::::::::: 253 5 Extensions to the C Language Family ::::::::::::::::::: 261 6 Extensions to the C++ Language :::::::::::::::::::::: 533 7 GNU Objective-C runtime features ::::::::::::::::::::: 545 8 Binary Compatibility :::::::::::::::::::::::::::::::: 551 9 gcov|a Test Coverage Program ::::::::::::::::::::::: 555 10 Known Causes of Trouble with GCC :::::::::::::::::::: 563 11 Reporting Bugs ::::::::::::::::::::::::::::::::::::: 581 12 How To Get Help with GCC :::::::::::::::::::::::::: 583 13 Contributing to GCC Development ::::::::::::::::::::: 585 Funding Free Software ::::::::::::::::::::::::::::::::::: 587 The GNU Project and GNU/Linux::::::::::::::::::::::::: 589 GNU General Public License :::::::::::::::::::::::::::::: 591 GNU Free Documentation License ::::::::::::::::::::::::: 603 Contributors to GCC :::::::::::::::::::::::::::::::::::: 611 Option Index :::::::::::::::::::::::::::::::::::::::::: 627 Keyword Index ::::::::::::::::::::::::::::::::::::::::: 643 iii Table of Contents Introduction :::::::::::::::::::::::::::::::::::::::: 1 1 Programming Languages Supported by GCC ::::::::::::::::::::::::::::::::::::::::::::::::: 3 2 Language Standards Supported by GCC ::::: 5 2.1 C language::::::::::::::::::::::::::::::::::::::::::::::::::::: 5 2.2 C++ language ::::::::::::::::::::::::::::::::::::::::::::::::: 6 2.3 Objective-C and Objective-C++ languages ::::::::::::::::::::: 7 3 GCC Command Options ::::::::::::::::::::::: 9 3.1 Option Summary::::::::::::::::::::::::::::::::::::::::::::::: 9 3.2 Options Controlling the Kind of Output ::::::::::::::::::::::: 21 3.3 Compiling C++ Programs :::::::::::::::::::::::::::::::::::: 27 3.4 Options Controlling C Dialect ::::::::::::::::::::::::::::::::: 27 3.5 Options Controlling C++ Dialect ::::::::::::::::::::::::::::: 32 3.6 Options Controlling Objective-C and Objective-C++ Dialects :: 40 3.7 Options to Control Diagnostic Messages Formatting ::::::::::: 44 3.8 Options to Request or Suppress Warnings ::::::::::::::::::::: 44 3.9 Options for Debugging Your Program or GCC ::::::::::::::::: 65 3.10 Options That Control Optimization :::::::::::::::::::::::::: 80 3.11 Options Controlling the Preprocessor:::::::::::::::::::::::: 120 3.12 Passing Options to the Assembler ::::::::::::::::::::::::::: 130 3.13 Options for Linking ::::::::::::::::::::::::::::::::::::::::: 131 3.14 Options for Directory Search :::::::::::::::::::::::::::::::: 134 3.15 Specifying subprocesses and the switches to pass to them :::: 136 3.16 Specifying Target Machine and Compiler Version :::::::::::: 143 3.17 Hardware Models and Configurations ::::::::::::::::::::::: 143 3.17.1 ARC Options :::::::::::::::::::::::::::::::::::::::::: 143 3.17.2 ARM Options:::::::::::::::::::::::::::::::::::::::::: 144 3.17.3 AVR Options :::::::::::::::::::::::::::::::::::::::::: 148 3.17.4 Blackfin Options ::::::::::::::::::::::::::::::::::::::: 149 3.17.5 CRIS Options:::::::::::::::::::::::::::::::::::::::::: 152 3.17.6 CRX Options :::::::::::::::::::::::::::::::::::::::::: 154 3.17.7 Darwin Options :::::::::::::::::::::::::::::::::::::::: 154 3.17.8 DEC Alpha Options ::::::::::::::::::::::::::::::::::: 158 3.17.9 DEC Alpha/VMS Options ::::::::::::::::::::::::::::: 162 3.17.10 FR30 Options :::::::::::::::::::::::::::::::::::::::: 162 3.17.11 FRV Options ::::::::::::::::::::::::::::::::::::::::: 163 3.17.12 GNU/Linux Options :::::::::::::::::::::::::::::::::: 166 3.17.13 H8/300 Options::::::::::::::::::::::::::::::::::::::: 167 3.17.14 HPPA Options:::::::::::::::::::::::::::::::::::::::: 167 iv Using the GNU Compiler Collection (GCC) 3.17.15 Intel 386 and AMD x86-64 Options ::::::::::::::::::: 170 3.17.16 IA-64 Options :::::::::::::::::::::::::::::::::::::::: 181 3.17.17 M32C Options :::::::::::::::::::::::::::::::::::::::: 184 3.17.18 M32R/D Options ::::::::::::::::::::::::::::::::::::: 185 3.17.19 M680x0 Options :::::::::::::::::::::::::::::::::::::: 186 3.17.20 M68hc1x Options ::::::::::::::::::::::::::::::::::::: 191 3.17.21 MCore Options ::::::::::::::::::::::::::::::::::::::: 192 3.17.22 MIPS Options :::::::::::::::::::::::::::::::::::::::: 193 3.17.23 MMIX Options ::::::::::::::::::::::::::::::::::::::: 204 3.17.24 MN10300 Options :::::::::::::::::::::::::::::::::::: 205 3.17.25 PDP-11 Options :::::::::::::::::::::::::::::::::::::: 205 3.17.26 picoChip Options ::::::::::::::::::::::::::::::::::::: 206 3.17.27 PowerPC Options::::::::::::::::::::::::::::::::::::: 207 3.17.28 IBM RS/6000 and PowerPC Options :::::::::::::::::: 207 3.17.29 S/390 and zSeries Options :::::::::::::::::::::::::::: 219 3.17.30 Score Options::::::::::::::::::::::::::::::::::::::::: 222 3.17.31 SH Options ::::::::::::::::::::::::::::::::::::::::::: 223 3.17.32 SPARC Options :::::::::::::::::::::::::::::::::::::: 227 3.17.33 SPU Options ::::::::::::::::::::::::::::::::::::::::: 231 3.17.34 Options for System V ::::::::::::::::::::::::::::::::: 232 3.17.35 V850 Options ::::::::::::::::::::::::::::::::::::::::: 232 3.17.36 VAX Options ::::::::::::::::::::::::::::::::::::::::: 233 3.17.37 VxWorks Options ::::::::::::::::::::::::::::::::::::: 234 3.17.38 x86-64 Options ::::::::::::::::::::::::::::::::::::::: 234 3.17.39 i386 and x86-64 Windows Options :::::::::::::::::::: 234 3.17.40 Xstormy16 Options ::::::::::::::::::::::::::::::::::: 235 3.17.41 Xtensa Options ::::::::::::::::::::::::::::::::::::::: 235 3.17.42 zSeries Options ::::::::::::::::::::::::::::::::::::::: 236 3.18 Options for Code Generation Conventions ::::::::::::::::::: 237 3.19 Environment Variables Affecting GCC :::::::::::::::::::::: 245 3.20 Using Precompiled Headers ::::::::::::::::::::::::::::::::: 247 3.21 Running Protoize ::::::::::::::::::::::::::::::::::::::::::: 249 4 C Implementation-defined behavior :::::::: 253 4.1 Translation :::::::::::::::::::::::::::::::::::::::::::::::::: 253 4.2 Environment::::::::::::::::::::::::::::::::::::::::::::::::: 253 4.3 Identifiers:::::::::::::::::::::::::::::::::::::::::::::::::::: 253 4.4 Characters ::::::::::::::::::::::::::::::::::::::::::::::::::: 254 4.5 Integers:::::::::::::::::::::::::::::::::::::::::::::::::::::: 254 4.6 Floating point ::::::::::::::::::::::::::::::::::::::::::::::: 255 4.7 Arrays and pointers :::::::::::::::::::::::::::::::::::::::::: 256 4.8 Hints :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 257 4.9 Structures, unions, enumerations, and bit-fields ::::::::::::::: 257 4.10 Qualifiers ::::::::::::::::::::::::::::::::::::::::::::::::::: 258 4.11 Declarators ::::::::::::::::::::::::::::::::::::::::::::::::: 258 4.12 Statements ::::::::::::::::::::::::::::::::::::::::::::::::: 258 4.13 Preprocessing directives ::::::::::::::::::::::::::::::::::::: 258 4.14 Library functions ::::::::::::::::::::::::::::::::::::::::::: 259 v 4.15 Architecture :::::::::::::::::::::::::::::::::::::::::::::::: 259 4.16 Locale-specific behavior ::::::::::::::::::::::::::::::::::::: 259 5 Extensions to the C Language Family :::::: 261 5.1 Statements and Declarations in Expressions :::::::::::::::::: 261 5.2 Locally Declared Labels :::::::::::::::::::::::::::::::::::::: 262 5.3 Labels as Values ::::::::::::::::::::::::::::::::::::::::::::: 263 5.4 Nested Functions :::::::::::::::::::::::::::::::::::::::::::: 264 5.5 Constructing Function Calls:::::::::::::::::::::::::::::::::: 266 5.6 Referring to a Type with typeof ::::::::::::::::::::::::::::: 268 5.7 Conditionals with Omitted Operands::::::::::::::::::::::::: 269 5.8 Double-Word Integers :::::::::::::::::::::::::::::::::::::::: 270 5.9 Complex Numbers ::::::::::::::::::::::::::::::::::::::::::: 270 5.10 Additional Floating Types :::::::::::::::::::::::::::::::::: 271 5.11 Half-Precision Floating Point ::::::::::::::::::::::::::::::: 271 5.12 Decimal Floating Types::::::::::::::::::::::::::::::::::::: 272 5.13 Hex Floats:::::::::::::::::::::::::::::::::::::::::::::::::: 272 5.14 Fixed-Point Types :::::::::::::::::::::::::::::::::::::::::: 272 5.15 Arrays of Length Zero :::::::::::::::::::::::::::::::::::::: 274