现在的位置: 首页 > 综合 > 正文

GCC 中文手册(上)

2013年07月30日 ⁄ 综合 ⁄ 共 39208字 ⁄ 字号 评论关闭
使用gcc -v --help可以列出gcc的所有可选项

Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Usage: gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path
  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor
  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -save-temps              Do not delete intermediate files
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=<file>            Override built-in specs with the contents of <file>
  -std=<standard>          Assume that the input sources are for <standard>
  -B <directory>           Add <directory> to the compiler's search paths
  -b <machine>             Run gcc for target <machine>, if installed
  -V <version>             Run gcc version number <version>, if installed
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by gcc.  In order to pass
 other options on to these processes the -W<letter> options must be used.
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
 
 /usr/libexec/gcc/x86_64-redhat-linux/3.4.6/cc1 -quiet -v help-dummy -quiet -dumpbase help-dummy -mtune=k8 -auxbase help-dummy -version --help -o /tmp/cc0yUXP4.s

The following options are language-independent:
 
  --help                      Display this information
  --param <param>=<value>     Set parameter <param> to value.  See below for a complete list of parameters
  --target-help               This switch lacks documentation
  --version                   This switch lacks documentation
  -G<number>                  Put global and static data smaller than <number> bytes into a special section (on some targets)
  -O<number>                  Set optimization level to <number>
  -Os                         Optimize for space rather than speed
  -W                          This switch is deprecated; use -Wextra instead
  -Waggregate-return          Warn about returning structures, unions or arrays
  -Wcast-align                Warn about pointer casts which increase alignment
  -Wdeprecated-declarations   Warn about uses of __attribute__((deprecated)) declarations
  -Wdisabled-optimization     Warn when an optimization pass is disabled
  -Werror                     Treat all warnings as errors
  -Wextra                     Print extra (possibly unwanted) warnings
  -Winline                    Warn when an inlined function cannot be inlined
  -Wlarger-than-<number>      Warn if an object is larger than <number> bytes
  -Wmissing-noreturn          Warn about functions which might be candidates for __attribute__((noreturn))
  -Wpacked                    Warn when the packed attribute has no effect on struct layout
  -Wpadded                    Warn when padding is required to align structure members
  -Wshadow                    Warn when one local variable shadows another
  -Wstrict-aliasing           Warn about code which might break strict aliasing rules
  -Wswitch                    Warn about enumerated switches, with no default, missing a case
  -Wswitch-default            Warn about enumerated switches missing a "default:" statement
  -Wswitch-enum               Warn about all enumerated switches missing a specific case
  -Wsystem-headers            Do not suppress warnings from system headers
  -Wuninitialized             Warn about uninitialized automatic variables
  -Wunreachable-code          Warn about code that will never be executed
  -Wunused                    Enable all -Wunused- warnings
  -Wunused-function           Warn when a function is unused
  -Wunused-label              Warn when a label is unused
  -Wunused-parameter          Warn when a function parameter is unused
  -Wunused-value              Warn when an expression value is unused
  -Wunused-variable           Warn when a variable is unused
  -aux-info <file>            Emit declaration information into <file>
  -aux-info=                  This switch lacks documentation
  -auxbase                    This switch lacks documentation
  -auxbase-strip              This switch lacks documentation
  -d<letters>                 Enable dumps from specific passes of the compiler
  -dumpbase <file>            Set the file basename to be used for dumps
  -fPIC                       This switch lacks documentation
  -fPIE                       This switch lacks documentation
  -fabi-version=              This switch lacks documentation
  -falign-functions           Align the start of functions
  -falign-functions=          This switch lacks documentation
  -falign-jumps               Align labels which are only reached by jumping
  -falign-jumps=              This switch lacks documentation
  -falign-labels              Align all labels
  -falign-labels=             This switch lacks documentation
  -falign-loops               Align the start of loops
  -falign-loops=              This switch lacks documentation
  -fargument-alias            Specify that arguments may alias each other and globals
  -fargument-noalias          Assume arguments may alias globals but not each other
  -fargument-noalias-global   Assume arguments alias neither each other nor globals
  -fasynchronous-unwind-tables Generate unwind tables that are exact at each instruction boundary
  -fbounds-check              Generate code to check bounds before indexing arrays
  -fbranch-count-reg          Replace add, compare, branch with branch on count register
  -fbranch-probabilities      Use profiling information for branch probabilities
  -fbranch-target-load-optimize Perform branch target load optimization before prologue / epilogue threading
  -fbranch-target-load-optimize2 Perform branch target load optimization after prologue / epilogue threading
  -fcall-saved-<register>     Mark <register> as being preserved across functions
  -fcall-used-<register>      Mark <register> as being corrupted by function calls
  -fcaller-saves              Save registers around function calls
  -fcommon                    Do not put uninitialized globals in the common section
  -fcprop-registers           Perform a register copy-propagation optimization pass
  -fcrossjumping              Perform cross-jumping optimization
  -fcse-follow-jumps          When running CSE, follow jumps to their targets
  -fcse-skip-blocks           When running CSE, follow conditional jumps
  -fdata-sections             Place data items into their own section
  -fdefer-pop                 Defer popping functions args from stack until later
  -fdelayed-branch            Attempt to fill delay slots of branch instructions
  -fdelete-null-pointer-checks Delete useless null pointer checks
  -fdiagnostics-show-location=[once|every-line] How often to emit source location at the beginning of line-wrapped
                              diagnostics
  -fdump-unnumbered           Suppress output of instruction numbers and line number notes in debugging dumps
  -feliminate-dwarf2-dups     Perform DWARF2 duplicate elimination
  -feliminate-unused-debug-symbols Perform unused type elimination in debug info
  -feliminate-unused-debug-types Perform unused type elimination in debug info
  -fexceptions                Enable exception handling
  -fexpensive-optimizations   Perform a number of minor, expensive optimizations
  -ffast-math                 This switch lacks documentation
  -ffinite-math-only          Assume no NaNs or infinities are generated
  -ffixed-<register>          Mark <register> as being unavailable to the compiler
  -ffloat-store               Do not store floats in registers
  -fforce-addr                Copy memory address constants into registers before use
  -fforce-mem                 Copy memory operands into registers before use
  -fframe-base-loclist        Allow use of DWARF2 location lists for frame base
  -ffunction-cse              Allow function addresses to be held in registers
  -ffunction-sections         Place each function into its own section
  -fgcse                      Perform global common subexpression elimination
  -fgcse-las                  Perform redundant load after store elimination in global common subexpression elimination
  -fgcse-lm                   Perform enhanced load motion during global common subexpression elimination
  -fgcse-sm                   Perform store motion after global common subexpression elimination
  -fguess-branch-probability  Enable guessing of branch probabilities
  -fident                     Process #ident directives
  -fif-conversion             Perform conversion of conditional jumps to branchless equivalents
  -fif-conversion2            Perform conversion of conditional jumps to conditional execution
  -finhibit-size-directive    Do not generate .size directives
  -finline                    Pay attention to the "inline" keyword
  -finline-functions          This switch lacks documentation
  -finline-limit-             This switch lacks documentation
  -finline-limit=<number>     Limit the size of inlined functions to <number>
  -finstrument-functions      Instrument function entry and exit with profiling calls
  -fkeep-inline-functions     Generate code for functions even if they are fully inlined
  -fkeep-static-consts        Emit static const variables even if they are not used
  -fleading-underscore        Give external symbols a leading underscore
  -floop-optimize             Perform loop optimizations
  -fmath-errno                Set errno after built-in math functions
  -fmem-report                Report on permanent memory allocation
  -fmerge-all-constants       Attempt to merge identical constants and constant variables
  -fmerge-constants           Attempt to merge identical constants across compilation units
  -fmessage-length=<number>   Limit diagnostics to <number> characters per line.  0 suppresses line-wrapping
  -fmove-all-movables         Force all loop invariant computations out of loops
  -fnew-ra                    Use graph-coloring register allocation
  -fnon-call-exceptions       Support synchronous non-call exceptions
  -fold-unroll-all-loops      Perform loop unrolling for all loops
  -fold-unroll-loops          Perform loop unrolling when iteration count is known
  -fomit-frame-pointer        When possible do not generate stack frames
  -foptimize-register-move    Do the full register move optimization pass
  -foptimize-sibling-calls    Optimize sibling and tail recursive calls
  -fpack-struct               Pack structure members together without holes
  -fpcc-struct-return         Return small aggregates in memory, not registers
  -fpeel-loops                Perform loop peeling
  -fpeephole                  Enable machine specific peephole optimizations
  -fpeephole2                 Enable an RTL peephole pass before sched2
  -fpic                       Generate position-independent code if possible
  -fpie                       Generate position-independent code for executables if possible
  -fprefetch-loop-arrays      Generate prefetch instructions, if available, for arrays in loops
  -fprofile                   Enable basic program profiling code
  -fprofile-arcs              Insert arc-based program profiling code
  -fprofile-generate          Enable common options for generating profile info for profile feedback directed optimizations
  -fprofile-use               Enable common options for performing profile feedback directed optimizations
  -fprofile-values            Insert code to profile values of expressions
  -frandom-seed               This switch lacks documentation
  -frandom-seed=<string>      Make compile reproducible using <string>
  -freduce-all-givs           Strength reduce all loop general induction variables
  -freg-struct-return         Return small aggregates in registers
  -fregmove                   Enables a register move optimization
  -frename-registers          Perform a register renaming optimization pass
  -freorder-blocks            Reorder basic blocks to improve code placement
  -freorder-functions         Reorder functions to improve code placement
  -frerun-cse-after-loop      Add a common subexpression elimination pass after loop optimizations
  -frerun-loop-opt            Run the loop optimizer twice
  -frounding-math             Disable optimizations that assume default FP rounding behavior
  -fsched-interblock          Enable scheduling across basic blocks
  -fsched-spec                Allow speculative motion of non-loads
  -fsched-spec-load           Allow speculative motion of some loads
  -fsched-spec-load-dangerous Allow speculative motion of more loads
  -fsched-stalled-insns       Allow premature scheduling of queued insns
  -fsched-stalled-insns-dep   Set dependence distance checking in premature scheduling of queued insns
  -fsched-stalled-insns-dep=  -fsched-stalled-insns-dep=<number>   Set dependence distance checking in premature scheduling
                              of queued insns
  -fsched-stalled-insns=      -fsched-stalled-insns=<number>       Set number of queued insns that can be prematurely
                              scheduled
  -fsched-verbose=<number>    Set the verbosity level of the scheduler
  -fsched2-use-superblocks    If scheduling post reload, do superblock scheduling
  -fsched2-use-traces         If scheduling post reload, do trace scheduling
  -fschedule-insns            Reschedule instructions before register allocation
  -fschedule-insns2           Reschedule instructions after register allocation
  -fshared-data               Mark data as shared rather than private
  -fsignaling-nans            Disable optimizations observable by IEEE signaling NaNs
  -fsingle-precision-constant Convert floating point constants to single precision constants
  -fstack-check               Insert stack checking code into the program
  -fstack-limit               This switch lacks documentation
  -fstack-limit-register=<register> Trap if the stack goes past <register>
  -fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>
  -fstrength-reduce           Perform strength reduction optimizations
  -fstrict-aliasing           Assume strict aliasing rules apply
  -fsyntax-only               Check for syntax errors, then stop
  -ftest-coverage             Create data files needed by "gcov"
  -fthread-jumps              Perform jump threading optimizations
  -ftime-report               Report the time taken by each compiler pass
  -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation
                              model
  -ftracer                    Perform superblock formation via tail duplication
  -ftrapping-math             Assume floating-point operations can trap
  -ftrapv                     Trap for signed overflow in addition, subtraction and multiplication
  -funit-at-a-time            Compile whole compilation unit at a time
  -funroll-all-loops          Perform loop unrolling for all loops
  -funroll-loops              Perform loop unrolling when iteration count is known
  -funsafe-math-optimizations Allow math optimizations that may violate IEEE or ISO standards
  -funswitch-loops            Perform loop unswitching
  -funwind-tables             Just generate unwind tables for exception handling
  -fvar-tracking              Perform variable tracking
  -fverbose-asm               Add extra commentary to assembler output
  -fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
  -fvpt                       Use expression value profiles in optimizations
  -fweb                       Construct webs and split unrelated uses of single variable
  -fwrapv                     Assume signed arithmetic overflow wraps around
  -fwritable-strings          Store strings in writable data section
  -fzero-initialized-in-bss   Put zero initialized data in the bss section
  -g                          Generate debug information in default format
  -gcoff                      Generate debug information in COFF format
  -gdwarf-2                   Generate debug information in DWARF v2 format
  -ggdb                       Generate debug information in default extended format
  -gstabs                     Generate debug information in STABS format
  -gstabs+                    Generate debug information in extended STABS format
  -gvms                       Generate debug information in VMS format
  -gxcoff                     Generate debug information in XCOFF format
  -gxcoff+                    Generate debug information in extended XCOFF format
  -m                          This switch lacks documentation
  -o <file>                   Place output into <file>
  -p                          Enable function profiling
  -pedantic                   Issue warnings needed for strict compliance to the standard
  -pedantic-errors            Like -pedantic but issue them as errors
  -quiet                      Do not display functions compiled or elapsed time
  -version                    This switch lacks documentation
  -w                          Suppress warnings
 
The --param option recognizes the following as parameters:
 
  max-inline-insns-single     The maximum number of instructions in a single function eligible for inlining
  max-inline-insns-auto       The maximum number of instructions when automatically inlining
  max-inline-insns-rtl        The maximum number of instructions for the RTL inliner
  max-delay-slot-insn-search  The maximum number of instructions to consider to fill a delay slot
  max-delay-slot-live-search  The maximum number of instructions to consider to find accurate live register information
  max-pending-list-length     The maximum length of scheduling's pending operations list
  large-function-insns        The size of function body to be considered large
  large-function-growth       Maximal growth due to inlining of large function (in percent)
  inline-unit-growth          how much can given compilation unit grow because of the inlining (in percent)
  max-gcse-memory             The maximum amount of memory to be allocated by GCSE
  max-gcse-passes             The maximum number of passes to make when doing GCSE
  max-unrolled-insns          The maximum number of instructions to consider to unroll in a loop
  max-average-unrolled-insns  The maximum number of instructions to consider to unroll in a loop on average
  max-unroll-times            The maximum number of unrollings of a single loop
  max-peeled-insns            The maximum number of insns of a peeled loop
  max-peel-times              The maximum number of peelings of a single loop
  max-completely-peeled-insns The maximum number of insns of a completely peeled loop
  max-completely-peel-times   The maximum number of peelings of a single loop that is peeled completely
  max-once-peeled-insns       The maximum number of insns of a peeled loop that rolls only once
  max-unswitch-insns          The maximum number of insns of an unswitched loop
  max-unswitch-level          The maximum number of unswitchings in a single loop
  hot-bb-count-fraction       Select fraction of the maximal count of repetitions of basic block in program given basic
                              block needs to have to be considered hot
  hot-bb-frequency-fraction   Select fraction of the maximal frequency of executions of basic block in function given basic
                              block needs to have to be considered hot
  tracer-dynamic-coverage-feedback The percentage of function, weighted by execution frequency, that must be covered by
                              trace formation. Used when profile feedback is available
  tracer-dynamic-coverage     The percentage of function, weighted by execution frequency, that must be covered by trace
                              formation. Used when profile feedback is not available
  tracer-max-code-growth      Maximal code growth caused by tail duplication (in percent)
  tracer-min-branch-ratio     Stop reverse growth if the reverse probability of best edge is less than this threshold (in
                              percent)
  tracer-min-branch-probability-feedback Stop forward growth if the probability of best edge is less than this threshold (in
                              percent). Used when profile feedback is available
  tracer-min-branch-probability Stop forward growth if the probability of best edge is less than this threshold (in
                              percent). Used when profile feedback is not available
  max-crossjump-edges         The maximum number of incoming edges to consider for crossjumping
  max-cse-path-length         The maximum length of path considered in cse
  max-cselib-memory-locations The maximum memory locations recorded by cselib
  max-last-value-rtl          The maximum number of RTL nodes that can be recorded as combiner's last value
  ggc-min-expand              Minimum heap expansion to trigger garbage collection, as a percentage of the total size of the
                              heap
  ggc-min-heapsize            Minimum heap size before we start collecting garbage, in kilobytes
  max-reload-search-insns     The maximum number of instructions to search backward when looking for equivalent reload
  min-pretend-dynamic-size    The minimum size for an auto object to allocate it in the stack as if its size was dynamic
 
The Ada front end recognizes the following options:
 
  -I                          This switch lacks documentation
  -Wall                       This switch lacks documentation
  -Wlong-long                 Do not warn about using "long long" when -pedantic
  -Wmissing-prototypes        Warn about global functions without prototypes
  -Wstrict-prototypes         Warn about unprototyped function declarations
  -Wwrite-strings             Give strings the type "array of char"
  -fRTS                       This switch lacks documentation
  -gnat<options>              Specify options to GNAT
  -nostdinc                   Do not search standard system include directories (those specified with -isystem will still be
                              used)
  -nostdlib                   This switch lacks documentation

The C front end recognizes the following options:
 
  -I, -Wall, -Wlong-long, -Wmissing-prototypes, -Wstrict-prototypes, -Wwrite-strings, -nostdinc
 
  --output-pch=               This switch lacks documentation
  -A<question>=<answer>       Assert the <answer> to <question>.  Putting '-' before <question> disables the <answer> to
                              <question>
  -C                          Do not discard comments
  -CC                         Do not discard comments in macro expansions
  -D<macro>[=<val>]           Define a <macro> with <val> as its value.  If just <macro> is given, <val> is taken to be 1
  -H                          Print the name of header files as they are used
  -M                          This switch lacks documentation
  -MD                         Generate make dependencies and compile
  -MF                         This switch lacks documentation
  -MG                         Treat missing header files as generated files
  -MM                         This switch lacks documentation
  -MMD                        Like -MD but ignore system header files
  -MP                         This switch lacks documentation
  -MQ <target>                Add a MAKE-quoted target
  -MT                         This switch lacks documentation
  -P                          Do not generate #line directives
  -U<macro>                   Undefine <macro>
  -Wbad-function-cast         Warn about casting functions to incompatible types
  -Wcast-qual                 Warn about casts which discard qualifiers
  -Wchar-subscripts           Warn about subscripts whose type is "char"
  -Wcomment                   This switch lacks documentation
  -Wcomments                  This switch lacks documentation
  -Wconversion                Warn about possibly confusing type conversions
  -Wdeclaration-after-statement Warn when a declaration is found after a statement
  -Wdiv-by-zero               Warn about compile-time integer division by zero
  -Wendif-labels              Warn about stray tokens after #elif and #endif
  -Werror-implicit-function-declaration Make implicit function declarations an error
  -Wfloat-equal               Warn if testing floating point numbers for equality
  -Wformat                    Warn about printf/scanf/strftime/strfmon format string anomalies
  -Wformat-extra-args         Warn if passing too many arguments to a function for its format string
  -Wformat-nonliteral         Warn about format strings that are not literals
  -Wformat-security           Warn about possible security problems with format functions
  -Wformat-y2k                Warn about strftime formats yielding 2-digit years
  -Wformat-zero-length        This switch lacks documentation
  -Wformat=                   This switch lacks documentation
  -Wimplicit                  This switch lacks documentation
  -Wimplicit-function-declaration Warn about implicit function declarations
  -Wimplicit-int              Warn when a declaration does not specify a type
  -Wimport                    This switch lacks documentation
  -Winit-self                 Warn about variables which are initialized to themselves.
  -Winvalid-pch               Warn about PCH files that are found but not used
  -Wmain                      Warn about suspicious declarations of "main"
  -Wmissing-braces            Warn about possibly missing braces around initializers
  -Wmissing-declarations      Warn about global functions without previous declarations
  -Wmissing-format-attribute  Warn about functions which might be candidates for format attributes
  -Wmultichar                 Warn about use of multi-character character constants
  -Wnested-externs            Warn about "extern" declarations not at file scope
  -Wnonnull                   This switch lacks documentation
  -Wold-style-definition      Warn if an old-style parameter definition is used
  -Wparentheses               Warn about possibly missing parentheses
  -Wpointer-arith             Warn about function pointer arithmetic
  -Wredundant-decls           Warn about multiple declarations of the same object
  -Wreturn-type               Warn whenever a function's return type defaults to "int" (C), or about inconsistent return
                              types (C++)
  -Wsequence-point            Warn about possible violations of sequence point rules
  -Wsign-compare              Warn about signed-unsigned comparisons
  -Wtraditional               Warn about features not present in traditional C
  -Wtrigraphs                 This switch lacks documentation
  -Wundef                     Warn if an undefined macro is used in an #if directive
  -Wunknown-pragmas           Warn about unrecognized pragmas
  -Wunused-macros             Warn about macros defined in the main file that are not used
  -ansi                       A synonym for -std=c89 (for C) or -std=c++98 (for C++).
  -fasm                       Recognize the "asm" keyword
  -fbuiltin                   Recognize built-in functions
  -fbuiltin-                  This switch lacks documentation
  -fcond-mismatch             Allow the arguments of the '?' operator to have different types
  -fdollars-in-identifiers    Permit '$' as an identifier character
  -fdump-                     This switch lacks documentation
  -fexec-charset=<cset>       Convert all strings and character constants to character set <cset>
  -ffixed-form                This switch lacks documentation
  ffixed-line-length-<number> Set the maximum line length to <number>
  -ffreestanding              Do not assume that standard C libraries and "main" exist
  -fhosted                    Assume normal C execution environment
  -finput-charset=            -finput-charset=<cset>      Specify the default character set for source files.
  -fms-extensions             Don't warn about uses of Microsoft extensions
  -fpch-deps                  This switch lacks documentation
  -fpreprocessed              This switch lacks documentation
  -fshort-double              Use the same size for double as for float
  -fshort-enums               Use the narrowest integer type possible for enumeration types
  -fshort-wchar               Force the underlying type for "wchar_t" to be "unsigned short"
  -fshow-column               This switch lacks documentation
  -fsigned-bitfields          When "signed" or "unsigned" is not given make the bitfield signed
  -fsigned-char               Make "char" signed by default
  -ftabstop=<number>          Distance between tab stops for column reporting
  -funsigned-bitfields        When "signed" or "unsigned" is not given make the bitfield unsigned
  -funsigned-char             Make "char" unsigned by default
  -fwide-exec-charset=<cset>  Convert all wide strings and character constants to character set <cset>
  -fworking-directory         Generate a #line directive pointing at the current working directory
  -idirafter <dir>            Add <dir> to the end of the system include path
  -imacros <file>             Accept definition of macros in <file>
  -include <file>             Include the contents of <file> before other files
  -iprefix <path>             Specify <path> as a prefix for next two options
  -isysroot <dir>             Set <dir> to be the system root directory
  -isystem <dir>              Add <dir> to the start of the system include path
  -iwithprefix <dir>          Add <dir> to the end of the system include path
  -iwithprefixbefore <dir>    Add <dir> to the end of the main include path
  -remap                      Remap file names when including files
  -std=c89                    Conform to the ISO 1990 C standard
  -std=c99                    Conform to the ISO 1999 C standard
  -std=c9x                    Deprecated in favor of -std=c99
  -std=gnu89                  Conform to the ISO 1990 C standard with GNU extensions
  -std=gnu99                  Conform to the ISO 1999 C standard with GNU extensions
  -std=gnu9x                  Deprecated in favor of -std=gnu99
  -std=iso9899:1990           Conform to the ISO 1990 C standard
  -std=iso9899:199409         Conform to the ISO 1990 C standard as amended in 1994
  -std=iso9899:1999           Conform to the ISO 1999 C standard
  -std=iso9899:199x           Deprecated in favor of -std=iso9899:1999
  -traditional-cpp            Enable traditional preprocessing
  -trigraphs                  Support ISO C trigraphs
  -undef                      Do not predefine system-specific and GCC-specific macros
  -v                          Enable verbose output
 
The C++ front end recognizes the following options:
 
  --output-pch=, -A, -C, -CC, -D, -H, -I, -M, -MD, -MF, -MG, -MM, -MMD, -MP, -MQ, -MT, -P, -U, -Wall, -Wcast-qual,
  -Wchar-subscripts, -Wcomment, -Wcomments, -Wconversion, -Wendif-labels, -Wfloat-equal, -Wformat, -Wformat-extra-args,
  -Wformat-nonliteral, -Wformat-security, -Wformat-y2k, -Wformat=, -Wimplicit, -Wimport, -Winit-self, -Winvalid-pch,
  -Wlong-long, -Wmissing-braces, -Wmissing-format-attribute, -Wmultichar, -Wparentheses, -Wpointer-arith, -Wredundant-decls,
  -Wreturn-type, -Wsign-compare, -Wtrigraphs, -Wundef, -Wunknown-pragmas, -Wunused-macros, -Wwrite-strings, -ansi, -fasm,
  -fbuiltin, -fbuiltin-, -fcond-mismatch, -fdollars-in-identifiers, -fdump-, -fexec-charset=, -finput-charset=,
  -fms-extensions, -fpch-deps, -fpreprocessed, -fshort-double, -fshort-enums, -fshort-wchar, -fshow-column,
  -fsigned-bitfields, -fsigned-char, -ftabstop=, -funsigned-bitfields, -funsigned-char, -fwide-exec-charset=,
  -fworking-directory, -idirafter, -imacros, -include, -iprefix, -isysroot, -isystem, -iwithprefix, -iwithprefixbefore,
  -nostdinc, -remap, -traditional-cpp, -trigraphs, -undef, -v
 
  -Wabi                       This switch lacks documentation
  -Wctor-dtor-privacy         Warn when all constructors and destructors are private
  -Wdeprecated                Warn if deprecated class, method, or field is used
  -Weffc++                    Warn about violations of Effective C++ style rules
  -Winvalid-offsetof          Warn about invalid uses of the "offsetof" macro
  -Wnon-template-friend       Warn when non-templatized friend functions are declared within a template
  -Wnon-virtual-dtor          Warn about non-virtual destructors
  -Wold-style-cast            Warn if a C-style cast is used in a program
  -Woverloaded-virtual        Warn about overloaded virtual function names
  -Wpmf-conversions           Warn when converting the type of pointers to member functions
  -Wreorder                   Warn when the compiler reorders code
  -Wsign-promo                Warn when overload promotes from unsigned to signed
  -Wsynth                     Warn when synthesis behavior differs from Cfront
  -faccess-control            Enforce class member access control semantics
  -fall-virtual               This switch lacks documentation
  -falt-external-templates    Change when template instances are emitted
  -fcheck-new                 Check the return value of new
  -fconserve-space            Reduce the size of object files
  -fconst-strings             Make string literals "const char[]" not "char[]"
  -fdefault-inline            Inline member functions by default
  -felide-constructors        This switch lacks documentation
  -fenforce-eh-specs          Generate code to check exception specifications
  -fenum-int-equiv            This switch lacks documentation
  -fexternal-templates        This switch lacks documentation
  -ffor-scope                 Scope of for-init-statement variables is local to the loop
  -fgnu-keywords              Recognize GNU-defined keywords
  -fguiding-decls             This switch lacks documentation
  -fhandle-exceptions         This switch lacks documentation
  -fhonor-std                 This switch lacks documentation
  -fhuge-objects              Enable support for huge objects
  -fimplement-inlines         Export functions even if they can be inlined
  -fimplicit-inline-templates Emit implicit instantiations of inline templates
  -fimplicit-templates        Emit implicit instantiations of templates
  -flabels-ok                 This switch lacks documentation
  -fname-mangling-version-    This switch lacks documentation
  -fnew-abi                   This switch lacks documentation
  -fnonansi-builtins          This switch lacks documentation
  -fnonnull-objects           This switch lacks documentation
  -foperator-names            Recognize C++ kewords like "compl" and "xor"
  -foptional-diags            Enable optional diagnostics
  -fpermissive                Downgrade conformance errors to warnings
  -frepo                      Enable automatic template instantiation
  -frtti                      Generate run time type descriptor information
  -fsquangle                  This switch lacks documentation
  -fstats                     Display statistics accumulated during compilation
  -fstrict-prototype          This switch lacks documentation
  -ftemplate-depth-<number>   Specify maximum template instantiation depth
  -fthis-is-variable          This switch lacks documentation
  -fno-threadsafe-statics     Do not generate thread-safe code for initializing local statics.
  -fuse-cxa-atexit            Use __cxa_atexit to register destructors
  -fvisibility-inlines-hidden Marks all inlined methods as having hidden visibility
  -fvtable-gc                 Discard unused virtual functions
  -fvtable-thunks             Implement vtables using thunks
  -fweak                      Emit common-like symbols as weak symbols
  -fxref                      Emit cross referencing information
  -nostdinc++                 Do not search standard system include directories for C++
  -std=c++98                  Conform to the ISO 1998 C++ standard
  -std=gnu++98                Conform to the ISO 1998 C++ standard with GNU extensions

Target specific options:
  -mno-tls-direct-seg-refs  Do not use direct references against %gs when accessing tls data
  -mtls-direct-seg-refs     Use direct references against %gs when accessing tls data
  -mno-red-zone             Do not use red-zone in the x86-64 code
  -mred-zone                Use red-zone in the x86-64 code
  -mno-ms-bitfields         Use gcc default bitfield layout
  -mms-bitfields            Use native (MS) bitfield layout
  -m32                      Generate 32bit i386 code
  -m64                      Generate 64bit x86-64 code
  -m96bit-long-double       sizeof(long double) is 12
  -m128bit-long-double      sizeof(long double) is 16
  -mno-sse3                 Do not support MMX, SSE, SSE2 and SSE3 built-in functions and code generation
  -msse3                    Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation
  -mno-sse2                 Do not support MMX, SSE and SSE2 built-in functions and code generation
  -msse2                    Support MMX, SSE and SSE2 built-in functions and code generation
  -mno-sse                  Do not support MMX and SSE built-in functions and code generation
  -msse                     Support MMX and SSE built-in functions and code generation
  -mno-3dnow                Do not support 3DNow! built-in functions
  -m3dnow                   Support 3DNow! built-in functions
  -mno-mmx                  Do not support MMX built-in functions
  -mmmx                     Support MMX built-in functions
  -mno-accumulate-outgoing-args Do not use push instructions to save outgoing arguments
  -maccumulate-outgoing-args Use push instructions to save outgoing arguments
  -mno-push-args            Do not use push instructions to save outgoing arguments
  -mpush-args               Use push instructions to save outgoing arguments
  -mno-inline-all-stringops Do not inline all known string operations
  -minline-all-stringops    Inline all known string operations
  -mno-align-stringops      Do not align destination of the string operations
  -malign-stringops         Align destination of the string operations
  -mstack-arg-probe         Enable stack probing
  -momit-leaf-frame-pointer Omit the frame pointer in leaf functions
  -mfancy-math-387          Generate sin, cos, sqrt for FPU
  -mno-fancy-math-387       Do not generate sin, cos, sqrt for FPU
  -mno-fp-ret-in-387        Do not return values of functions in FPU registers
  -mfp-ret-in-387           Return values of functions in FPU registers
  -mno-ieee-fp              Do not use IEEE math for fp comparisons
  -mieee-fp                 Use IEEE math for fp comparisons
  -mno-svr3-shlib           Uninitialized locals in .data
  -msvr3-shlib              Uninitialized locals in .bss
  -mno-align-double         Align doubles on word boundary
  -malign-double            Align some doubles on dword boundary
  -mno-rtd                  Use normal calling convention
  -mrtd                     Alternate calling convention
  -mno-soft-float           Use hardware fp
  -msoft-float              Do not use hardware fp
  -mhard-float              Use hardware fp
  -mno-80387                Do not use hardware fp
  -m80387                   Use hardware fp
  -mtls-dialect=            Use given thread-local storage dialect
  -masm=                    Use given assembler dialect
  -mcmodel=                 Use given x86-64 code model
  -mbranch-cost=            Branches are this expensive (1-5, arbitrary units)
  -mpreferred-stack-boundary= Attempt to keep stack aligned to this power of 2
  -malign-functions=        Function starts are aligned to this power of 2
  -malign-jumps=            Jump targets are aligned to this power of 2
  -malign-loops=            Loop code aligned to this power of 2
  -mregparm=                Number of registers used to pass integer arguments
  -march=                   Generate code for given CPU
  -mfpmath=                 Generate floating point mathematics using given instruction set
  -mtune=                   Schedule code for given CPU


 

 GCC 中文手册(上)

GCC

Section: GNU Tools (1)
Updated: 2003/12/05
Index Return to Main Contents


 

NAME

gcc,g++-GNU工程的CC++编译器(egcs-1.1.2)  

总览(SYNOPSIS)

gcc[option|filename ]...
g++[option|filename ]...

警告(WARNING)

本手册页内容摘自GNU C编译器的完整文档,仅限于解释选项的含义.

除非有人自愿维护,否则本手册页不再更新.如果发现手册页和软件之间有所矛盾,请查对Info文件, Info文件是权威文档.

如果我们发觉本手册页的内容由于过时而导致明显的混乱和抱怨时,我们就停止发布它.不可能有其他选择,象更新Info文件同时更新man手册,因为其他维护GNU CC的工作没有留给我们时间做这个. GNU工程认为man手册是过时产物,应该把时间用到别的地方.

如果需要完整和最新的文档,请查阅Info文件`gcc'Using and Porting GNU CC (for version 2.0) (使用和移植GNU CC 2.0) 手册.二者均来自Texinfo原文件 gcc.texinfo.

描述(DESCRIPTION)

CC++编译器是集成的.他们都要用四个步骤中的一个或多个处理输入文件: 预处理(preprocessing),编译(compilation),汇编(assembly)和连接(linking).源文件后缀名标识源文件的 语言,但是对编译器来说,后缀名控制着缺省设定:

gcc
认为预处理后的文件(.i)C文件,并且设定C形式的连接.
g++
认为预处理后的文件(.i)C++文件,并且设定C++形式的连接.

源文件后缀名指出语言种类以及后期的操作:

.c      C源程序;预处理,编译,汇编.C      C++源程序;预处理,编译,汇编.cc     C++源程序;预处理,编译,汇编.cxx    C++源程序;预处理,编译,汇编.m      Objective-C源程序;预处理,编译,汇编.i     预处理后的C文件;编译,汇编.ii    预处理后的C++文件;编译,汇编.s     汇编语言源程序;汇编.S     汇编语言源程序;预处理,汇编.h     预处理器文件;通常不出现在命令行上

其他后缀名的文件被传递给连接器(linker).通常包括:

.o     目标文件(Object file).a     归档库文件(Archive file)

除非使用了-c, -S,-E选项(或者编译错误阻止了完整的过程),否则连接总是 最后的步骤.在连接阶段中,所有对应于源程序的.o文件, -l库文件,无法识别的文件名(包括指定的 .o目标文件和.a库文件)按命令行中的顺序传递给连接器.

选项(OPTIONS)

选项必须分立给出: `-dr'完全不同于`-d -r '.

大多数`-f'`-W'选项有两个相反的格式: -fname-fno-name (-Wname-Wno-name).这里 只列举不是默认选项的格式.

下面是所有选项的摘要,按类型分组,解释放在后面的章节中.

总体选项(Overall Option)

-c -S -E -o file -pipe -v -x language
语言选项(Language Option)
-ansi -fall-virtual -fcond-mismatch -fdollars-in-identifiers -fenum-int-equiv -fexternal-templates -fno-asm -fno-builtin -fhosted -fno-hosted -ffreestanding -fno-freestanding -fno-strict-prototype -fsigned-bitfields -fsigned-char -fthis-is-variable -funsigned-bitfields -funsigned-char -fwritable-strings -traditional -traditional-cpp -trigraphs
警告选项(Warning Option)
-fsyntax-only -pedantic -pedantic-errors -w -W -Wall -Waggregate-return -Wcast-

抱歉!评论已关闭.