Using the GNU Compiler Collection
Total Page:16
File Type:pdf, Size:1020Kb
Using the GNU Compiler Collection For gcc version 4.4.5 (GCC) 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 ..................... 251 5 Extensions to the C Language Family ................... 259 6 Extensions to the C++ Language ...................... 529 7 GNU Objective-C runtime features ..................... 541 8 Binary Compatibility ................................ 547 9 gcov—a Test Coverage Program ....................... 551 10 Known Causes of Trouble with GCC .................... 559 11 Reporting Bugs ..................................... 577 12 How To Get Help with GCC .......................... 579 13 Contributing to GCC Development ..................... 581 Funding Free Software ................................... 583 The GNU Project and GNU/Linux......................... 585 GNU General Public License .............................. 587 GNU Free Documentation License ......................... 599 Contributors to GCC .................................... 607 Option Index .......................................... 623 Keyword Index ......................................... 639 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 .................................... 26 3.4 Options Controlling C Dialect ................................. 27 3.5 Options Controlling C++ Dialect ............................. 31 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 ......................................... 130 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 .......................................... 153 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 ..................................... 184 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 ....................................... 203 3.17.24 MN10300 Options .................................... 204 3.17.25 PDP-11 Options ...................................... 204 3.17.26 picoChip Options ..................................... 206 3.17.27 PowerPC Options..................................... 206 3.17.28 IBM RS/6000 and PowerPC Options .................. 206 3.17.29 S/390 and zSeries Options ............................ 218 3.17.30 Score Options......................................... 221 3.17.31 SH Options ........................................... 222 3.17.32 SPARC Options ...................................... 225 3.17.33 SPU Options ......................................... 229 3.17.34 Options for System V ................................. 231 3.17.35 V850 Options ......................................... 231 3.17.36 VAX Options ......................................... 232 3.17.37 VxWorks Options ..................................... 232 3.17.38 x86-64 Options ....................................... 233 3.17.39 i386 and x86-64 Windows Options .................... 233 3.17.40 Xstormy16 Options ................................... 234 3.17.41 Xtensa Options ....................................... 234 3.17.42 zSeries Options ....................................... 235 3.18 Options for Code Generation Conventions ................... 235 3.19 Environment Variables Affecting GCC ...................... 243 3.20 Using Precompiled Headers ................................. 246 3.21 Running Protoize ........................................... 248 4 C Implementation-defined behavior ........ 251 4.1 Translation .................................................. 251 4.2 Environment................................................. 251 4.3 Identifiers.................................................... 251 4.4 Characters ................................................... 252 4.5 Integers...................................................... 252 4.6 Floating point ............................................... 253 4.7 Arrays and pointers .......................................... 254 4.8 Hints ........................................................ 255 4.9 Structures, unions, enumerations, and bit-fields ............... 255 4.10 Qualifiers ................................................... 256 4.11 Declarators ................................................. 256 4.12 Statements ................................................. 256 4.13 Preprocessing directives ..................................... 256 4.14 Library functions ........................................... 257 v 4.15 Architecture ................................................ 257 4.16 Locale-specific behavior ..................................... 257 5 Extensions to the C Language Family ...... 259 5.1 Statements and Declarations in Expressions .................. 259 5.2 Locally Declared Labels ...................................... 260 5.3 Labels as Values ............................................. 261 5.4 Nested Functions ............................................ 262 5.5 Constructing Function Calls.................................. 264 5.6 Referring to a Type with typeof ............................. 266 5.7 Conditionals with Omitted Operands......................... 267 5.8 Double-Word Integers ........................................ 268 5.9 Complex Numbers ........................................... 268 5.10 Additional Floating Types .................................. 269 5.11 Decimal Floating Types..................................... 269 5.12 Hex Floats.................................................. 270 5.13 Fixed-Point Types .......................................... 270 5.14 Arrays of Length Zero ...................................... 271 5.15 Structures With No Members ............................... 272 5.16 Arrays of Variable Length..................................