Section “Introduction” in Using the GNU Compiler Collection (GCC)
Total Page:16
File Type:pdf, Size:1020Kb
Using the GNU Compiler Collection (GCC) Using the GNU Compiler Collection by Richard M. Stallman and the GCC Developer Community For GCC Version 4.1.2 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 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 “GNU General Public License” and “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 .......................... 7 4 C Implementation-defined behavior ................. 205 5 Extensions to the C Language Family ................ 213 6 Extensions to the C++ Language .................. 361 7 GNU Objective-C runtime features.................. 371 8 Binary Compatibility ........................... 377 9 gcov—a Test Coverage Program ................... 381 10 Known Causes of Trouble with GCC ................ 389 11 Reporting Bugs ............................... 407 12 How To Get Help with GCC ...................... 409 13 Contributing to GCC Development ................. 411 Funding Free Software ............................. 413 The GNU Project and GNU/Linux..................... 415 GNU GENERAL PUBLIC LICENSE ................... 417 GNU Free Documentation License ..................... 423 Contributors to GCC .............................. 431 Option Index.................................... 447 Keyword Index .................................. 459 ii Using the GNU Compiler Collection (GCC) iii Table of Contents Introduction .................................. 1 1 Programming Languages Supported by GCC ......................................... 3 2 Language Standards Supported by GCC .... 5 3 GCC Command Options ................... 7 3.1 Option Summary ............................................ 7 3.2 Options Controlling the Kind of Output ..................... 17 3.3 Compiling C++ Programs .................................. 20 3.4 Options Controlling C Dialect ............................... 21 3.5 Options Controlling C++ Dialect............................ 25 3.6 Options Controlling Objective-C and Objective-C++ Dialects.. 32 3.7 Options to Control Diagnostic Messages Formatting........... 36 3.8 Options to Request or Suppress Warnings .................... 36 3.9 Options for Debugging Your Program or GCC ................ 53 3.10 Options That Control Optimization ........................ 65 3.11 Options Controlling the Preprocessor ....................... 94 3.12 Passing Options to the Assembler ......................... 104 3.13 Options for Linking ...................................... 104 3.14 Options for Directory Search .............................. 107 3.15 Specifying subprocesses and the switches to pass to them.... 109 3.16 Specifying Target Machine and Compiler Version ........... 115 3.17 Hardware Models and Configurations ...................... 116 3.17.1 ARC Options ....................................... 116 3.17.2 ARM Options ....................................... 116 3.17.3 AVR Options........................................ 121 3.17.4 Blackfin Options..................................... 121 3.17.5 CRIS Options ....................................... 122 3.17.6 CRX Options ....................................... 124 3.17.7 Darwin Options ..................................... 124 3.17.8 DEC Alpha Options ................................. 128 3.17.9 DEC Alpha/VMS Options ........................... 132 3.17.10 FRV Options ....................................... 132 3.17.11 H8/300 Options .................................... 136 3.17.12 HPPA Options ..................................... 136 3.17.13 Intel 386 and AMD x86-64 Options .................. 139 3.17.14 IA-64 Options ...................................... 147 3.17.15 M32C Options ..................................... 149 3.17.16 M32R/D Options ................................... 149 3.17.17 M680x0 Options .................................... 151 iv Using the GNU Compiler Collection (GCC) 3.17.18 M68hc1x Options................................... 153 3.17.19 MCore Options ..................................... 154 3.17.20 MIPS Options...................................... 155 3.17.21 MMIX Options ..................................... 160 3.17.22 MN10300 Options .................................. 162 3.17.23 MT Options........................................ 162 3.17.24 PDP-11 Options.................................... 163 3.17.25 PowerPC Options .................................. 164 3.17.26 IBM RS/6000 and PowerPC Options ................. 164 3.17.27 S/390 and zSeries Options........................... 174 3.17.28 SH Options ........................................ 177 3.17.29 SPARC Options .................................... 180 3.17.30 Options for System V ............................... 184 3.17.31 TMS320C3x/C4x Options ........................... 185 3.17.32 V850 Options ...................................... 187 3.17.33 VAX Options ...................................... 188 3.17.34 x86-64 Options ..................................... 188 3.17.35 Xstormy16 Options ................................. 188 3.17.36 Xtensa Options..................................... 188 3.17.37 zSeries Options ..................................... 190 3.18 Options for Code Generation Conventions.................. 190 3.19 Environment Variables Affecting GCC ..................... 196 3.20 Using Precompiled Headers ............................... 199 3.21 Running Protoize ........................................ 201 4 C Implementation-defined behavior ....... 205 4.1 Translation ............................................... 205 4.2 Environment.............................................. 205 4.3 Identifiers ................................................ 205 4.4 Characters................................................ 206 4.5 Integers .................................................. 206 4.6 Floating point ............................................ 207 4.7 Arrays and pointers ....................................... 208 4.8 Hints ..................................................... 209 4.9 Structures, unions, enumerations, and bit-fields .............. 209 4.10 Qualifiers ................................................ 210 4.11 Declarators .............................................. 210 4.12 Statements .............................................. 210 4.13 Preprocessing directives .................................. 210 4.14 Library functions......................................... 211 4.15 Architecture ............................................. 211 4.16 Locale-specific behavior................................... 211 v 5 Extensions to the C Language Family ..... 213 5.1 Statements and Declarations in Expressions ................. 213 5.2 Locally Declared Labels ................................... 214 5.3 Labels as Values .......................................... 215 5.4 Nested Functions.......................................... 216 5.5 Constructing Function Calls................................ 218 5.6 Referring to a Type with typeof ........................... 219 5.7 Conditionals with Omitted Operands ....................... 220 5.8 Double-Word Integers ..................................... 221 5.9 Complex Numbers ........................................ 221 5.10 Hex Floats............................................... 222 5.11 Arrays of Length Zero .................................... 222 5.12 Structures With No Members ............................. 223 5.13 Arrays of Variable Length ................................ 223 5.14 Macros with a Variable Number of Arguments. ............. 224 5.15 Slightly Looser Rules for Escaped Newlines................. 225 5.16 Non-Lvalue Arrays May Have Subscripts ................... 225 5.17 Arithmetic on void- and Function-Pointers................. 226 5.18 Non-Constant Initializers ................................. 226 5.19 Compound Literals ....................................... 226 5.20 Designated Initializers .................................... 227 5.21 Case Ranges ............................................. 228 5.22 Cast to a Union Type .................................... 228 5.23 Mixed Declarations and Code ............................. 229 5.24 Declaring Attributes of Functions.......................... 229 5.25 Attribute Syntax ......................................... 242 5.26 Prototypes and Old-Style Function Definitions.............. 245 5.27 C++ Style Comments ...................................