GCC Chinese manual (I)

Source: Internet
Author: User
Tags builtin
GCC Chinese manual
Author: Xu Ming Source: Unknown clicks:

999 updated on:
Gcc

Section: GNU tools (1)
Updated: 2003/12/05
Index return to Main Contents

Name

GCC, G ++-GNU Project C and C ++ Compiler (egcs-1.1.2)

Overview (Synopsis)

Gcc[Option|Filename]...
G ++[Option|Filename]...

Warning)

The content on this manual page is taken from the complete documentation of the gnu c compiler and is limited to explaining the meaning of the options.

Unless manually maintained, the manual page will not be updated. If any conflict is found between the manual page and the software, check the info file, which is an authoritative document.

If we find that the contents of this album are out of date and cause obvious confusion and complaints, we will stop releasing it. it is impossible to have other options, such as updating the info file and updating the man manual at the same time, because other work to maintain gnu cc has not left us time to do this. the GNU Project regards man's Manual as an outdated product and uses time elsewhere.

If you need a complete and up-to-date document, please refer to the info file'Gcc'OrUsing and porting gnu cc (for Version 2.0) (Use and port gnu cc 2.0)Manual. Both are from the original texinfo FileGcc. texinfo.

Description)

C and C ++ compilers are integrated. they all need to process one or more input files in four steps: preprocessing, compilation, assembly, and linking ). the source file suffix identifies the source file language, but for the compiler, the suffix control the default settings:

Gcc
It is considered that the files after preprocessing ( . IIs the c file and sets the C-form connection.
G ++
It is considered that the files after preprocessing ( . IIs a C ++ file, and sets the C ++ form of connection.

The source file suffix indicates the language type and subsequent operations:

. CC source program; preprocessing, compilation, assembly. CC ++ source program; preprocessing, compilation, and compilation. CCC ++ source program; preprocessing, compilation, and compilation. CxxC ++ source program; preprocessing, compilation, and compilation. MObjective-C source program; preprocessing, compilation, assembly. IC files after preprocessing; compilation and compilation. IIC ++ files after preprocessing; compilation and compilation. SAssembly language source program; Assembly. SSource program of assembly language; preprocessing and assembly. HPre-processor file; usually not displayed on the command line

Other suffixed files are passed to the connector (linker). These files generally include:

. OTarget File).Archive file)

Unless-C,-S, Or-E(Or a compilation error stops the entire process). Otherwise, the connection is always the final step. In the connection phase, all. OFile,-LLibrary file, unrecognized file name (including the specified. OTarget file and.Library files) are passed to the connector in the order in the command line.

Options)

The options must be given separately :'-Dr'Completely different from'-D-r'.

Majority'-F'And'-WThe 'option has two opposite formats:-FNameAnd-Fno-Name(Or-WNameAnd-Wno-Name). Only the format that is not the default option is listed here.

The following is a summary of all options, which are grouped by type and explained in later chapters.

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-variant-funsigned-bitfields-funsigned-Char-fwritable-strings-traditional -Traditional-CPP-trigraphs
Warning Option)
-Fsyntax-only-pedantic-errors-w-wall-waggregate-return-wcast-align-wcast-qual-wchar-subscript-wcomment-wconversion-wenum-clash -werror-wformat-wid-clash- Len-Export-rule-int-wimplicit-function-declaration-winline-wlong-Long-wmain-wmissing-prototypes-wmissing-declarations-wnested-externs-wno-import-wparentheses-wpointer -Arith-wredundant-decls-wreturn-type-wshadow-wstrict-prototypes-wswitch-wtemplate-debugging-wtraditional-wtrigraphs-wuninitialized-wunused-wwrite-strings
Debugging Option)
-A-d Letters-Fpretend-float-g Level-Gcoff-gxcoff +-gdwarf +-gstabs +-ggdb-p-PG-save-temps-print-file-name = Library-Print-libgcc-file-name-print-prog-name = Program
Optimization Option)
-Fcaller-saves-fcse-Follow-Jumps-fcse-Skip-blocks-fdelayed-branch-felide-constructors-fexpensive-optimizations-ffast-math-ffloat-store-Fforce-ADDR -Fforce-Mem-Finline-functions-fkeep-inline-functions-fmemoize-lookups-fno-default-inline-fno-defer-pop-fno-function-CSE-fno-inline -fno-peephole-fomit-frame-pointer-frerun-CSE-after-loop-fschedule-insns-fschedule-insns2-fstrength-reduce-fthread-Jumps-funroll-all-loops-funroll -loops-o-O2-O3
Preprocessor Option)
- Assertion-C-dd-DM-DN-d Macro[= Defn]-E-H-idirafter Dir-Include File-Imacros File-Iprefix File-Iwithprefix Dir-M-MD-mm-MMD-nostdinc-p-u Macro-UNDEF
Assembler Option)
-Wa, Option
Linker Option)
-L Library-Nostartfiles-nostdlib-static-shared-symbolic-xlinker Option-Wl, Option-U Symbol
Directory Option)
-B Prefix-I Dir-I-l Dir
Target Option)
-B Machine-V Version
Configuration dependent Option)
M680x0 Option
-M68000-m68020-m68020-40-m68030-m68040-m68881-mbitfield-mc68000-mc68020-MFPA-mnobitfield-MRTD-mshort-msoft-float

VAX Option
-Mg-mgnu-munix

Type
-Mepilogue-mfpu-mhard-float-MnO-FPU-MnO-epilogue-msoft-float-msparclite-mv8-msupernames-mcypress

Convex options
-Margcount-mc1-MC2-mnoargcount

Amd29k Option
-M29000-m29050-MBW-MDW-mkernel-registers-mlarge-mnbw-mnodw-msmall-mstack-check-Muser-registers

M88k Option
-M88000-m88100-m88110-mbig-pic-mcheck-Zero-division-mhandle-large-shift-midentify-revision-MnO-check-Zero-division-MnO-OCs-Debug -Info-MnO-OCs-frame-position-MnO-optimize-Arg-area-MnO-serialize-volatile-MnO-underscores-mocs-debug-Info-mocs-frame-Position -moptimize-Arg-area-mserialize-volatile-mshort-data-Num-Msvr3-msvr4-mtrap-large-shift-muse-div-instruction-mversion-03.00-mwarn-passed-structs

Rs6000 options
-MFP-in-toc-MnO-fop-in-TOC

RT Option
-MCALL-Lib-Mul-MFP-Arg-in-fpregs-MFP-Arg-in-Gregs-mfull-FP-blocks-mhc-struct-return-Min-line-Mul -mminimum-FP-blocks-mnohc-struct-return

MIPs options
-Mcpu =CPU type-Mips2-mips3-mint64-mlong64-mmips-as-MGAs-mrnames-MnO-rnames-mgpopt-MnO-gpopt-mstats-MnO-stats-mmemcpy-MnO-memcpy-MnO -MIPS-tfile-mmips-tfile-msoft-float-mhard-float-mabicils-MnO-abicils-mhalf-pic-MnO-half-pic-GNum-Nocpp

I386 Option
-Mbench-mno-486-msoft-float-mno-fp-ret-in-387

Hppa options
-Mpa-risc-1-0-mpa-risc-1-1-mkernel-mshared-libs-MnO-shared-libs-mlong-CILS-mdisable-fpregs-mdisable-indexing-mtrailing-colon

I960 Option
-MCPU-type-Mnumerics-msoft-float-mleaf-procedures-MnO-leaf-procedures-mtail-call-MnO-tail-call-mcomplex-ADDR-MnO-complex-ADDR-mcode-align -MnO-code-align-mic-compat-mic2.0-compat-mic3.0-compat-MASM-compat-Mintel-ASM-mstrict-align-MnO-strict-align-mold-align -MnO-old-align

DEC Alpha Option
-MFP-regs-MnO-FP-regs-MnO-soft-float-msoft-float

System V Option
-G-QY-Qn-YP,Paths-Ym,Dir

Code Generation Option)
-Fcall-saved- Reg-Fcall-used- Reg-Ffixed- Reg-Finhibit-size-Directive-fnonnull-objects-fno-common-fno-Ident-fno-GNU-linker-fpcc-struct-return-FPIC-freg-struct-return -fshared-data-fshort-enums-fshort-double-fvolatile-global-fverbose-ASM

Overall Option)
-X Language
Clearly states that the language of the subsequent input file is Language(Instead of the default option obtained from the filename suffix). This option is applied to all subsequent input files until the next' -X'Option. LanguageOptional values include' C',' Objective-C',' C-Header',' C ++',' CPP-Output',' Cycler', And' Extends er-with-CPP'.
-X none
Close any explicit description of the language, so process the following files based on the filename suffix (as if it was never used before' -X'Option ).

You can use'-X'Indicates the option (or file name suffix ).GccWhere to start, use'-C','-S', Or'-E'Option tellsGccWhere to end. Note that some options (for example ,'-X cpp-output-e') MakeGccDo not do anything.

-C
Compile or compile the source file, but it is not connected. The Compiler outputs the target file corresponding to the source file.

By default, GCC uses'. O'Replace the source file name suffixes'. C','. I','. S', And so on. The target file name can be used.-OSelect another name.

GCC ignore-CThe option is followed by any unrecognized input files (they do not need to be compiled or compiled ).

-S
The compilation stops without compilation. For each input non-assembly language file, the output file is an assembly language file.

By default, GCC uses'. O'Replace the source file name suffixes'. C','. I', And so on. The target file name can be used.-OSelect another name.

GCC ignores any input files that do not need to be compiled.

-E
The pre-processing is stopped without compilation. The pre-processing code is sent to the standard output.

GCC ignores any input files that do not require preprocessing.

-O File
Specify the output file File. This option does not care about the output produced by GCC, whether it is an executable file, a target file, an assembly file, or a pre-processed C code.

Because only one output file can be specified, use'-O'Option is meaningless unless an executable file is output.

If'-O'Option. The default output result is: the executable file is'A. Out','Source.Suffix'The target file is'Source. O', The Assembly file is'Source. S', And the pre-processed C source code is sent to the standard output.

-V
(In a standard error) display the command for executing the compilation phase, and display the version number of the compiler driver, Preprocessor, and compiler.
-Pipe
Use pipelines instead of temporary files for communication between different phases of the compilation process. this option does not work on some systems because the assembler of those systems cannot read data from the pipeline. the GNU assembler does not have this problem.

Language options)

The following options control the C "dialect" acceptable to the compiler ":

-ANSI
Supports ANSI-compliant C Programs.

This will disable some features that are incompatible with ansi c in gnu c, suchASM,InlineAndTypeofKeywords, andUNIXAndVAXThese indicate the predefined macros of the current system type. Both the undesirable and rarely used ANSI trigraph features are enabled, and'$'Is part of the identifier.

Even though'-ANSI'Option, the following Optional keywords,_ ASM __,_ Extension __,_ Inline __And_ Typeof __Still valid. You certainly won't use them in ansi c Programs, but you can put them in header files, because when compiling programs containing these header files, you may specify'-ANSI'Option. Other predefined macros, such_ UNIX __And_ VAX __, Whether or not'-ANSI'Option, always valid.

Use'-ANSI'The option does not automatically reject compilation of non-ANSI programs unless you add'-Pedantic'Option'-ANSI'Option supplement.

Use'-ANSI'Option, the Preprocessor predefines_ Strict_ansi __Macro. some header files focus on this macro to avoid declaring some functions or defining some macros which are not called by ANSI standards; this will not interfere with programs that use these names elsewhere.

-Fno-ASM
Do not ASM, InlineOr TypeofAs keywords, these words can be used as identifiers. _ ASM __, _ Inline __And _ Typeof __Can replace them .' -ANSI'Implicitly declared' -Fno-ASM'.
-Fno-builtin
Built-in functions (built-in function) that do not start with two underscores are not accepted. Currently, the affected functions include: _ Exit, Abort, ABS, Alloca, Cos, Exit, FABS, Labs, Memcmp, Memcpy, Sin, SQRT, Strcmp, Strcpy, And Strlen.

`-ANSI'Option can blockAllocaAnd_ ExitBecome a built-in function.

-Fhosted
Compiled by the host environment; it implicitly declares' -Fbuiltin'Option, and the warning is incorrect MainFunction declaration.
-Ffreestanding
Compiled in an independent environment; it implicitly declares' -Fno-builtin'Option, and MainThe function has no special requirements.

All the standard libraries in the host environment (hosted environment) are available. The main function returns an int value. A typical example is almost all programs except the kernel. the corresponding independent environment (freestanding environment) does not have a standard library, and the program entry is not necessarily main. The most obvious example is the operating system kernel. for more information, see the latest GCC website)

-Fno-strict-Prototype
For function declarations without parameters, for example' Int foo(); ', Processed in the C style --- that is, the number or type of parameters is not specified (only for C ++). Normally, such a function FooIn C ++, the parameter is null.

-Trigraphs
Support for ansi c trigraphs .' -ANSI'Options are implicitly declared' -Trigraphs'.

-Traditional
Attempts to support some aspects of the traditional C compiler. For details, see the gnu c manual. We have removed the detailed list from here, so that when the content is outdated, people will not blame us.

Except one thing: For C ++ programs (not C ),'-Traditional'Option brings an additional effect, allowingThisAssignment. He and'-Fthis-is-Variable'Option has the same effect.

-Traditional-CPP
Attempts to support some aspects of the traditional C Preprocessor, especially the content about the Preprocessor mentioned above, but does not include' -Traditional'Other effects of the option.

-Fdollars-in-identifiers
Allowed In identifier' $'Character (only for C ++). You can specify' -Fno-dollars-in-identifiers'Option explicit disallow use' $'. (Gnu c ++ is allowed by default in some target systems' $', But not all systems .)

-Fenum-int-equiv
Allow IntImplicit conversion from type to Enumeration type (enumeration) (limited to C ++ only). Under normal circumstances, gnu c ++ allows EnumTo IntAnd vice versa.

-Fexternal-templates
Generates a small amount of code (limited to C ++) for the template declaration. The method is to generate a copy of each template function only at the place where they are defined. to use this option successfully, you must mark' # Pragma implementation'(Defined) or' # Pragma Interface'(Declaration ).

When the program uses'-Fexternal-templates'Template instantiation is all external type during compilation. You must make the required instance appear in the implementation file. You can useTypedefTo achieve this, it references each instance required. Correspondingly, if the default option is used during compilation'-Fno-external-templates', All template instances are explicitly set as built-in.

-Fall-virtual
All possible member functions are virtual functions by default. All member functions (except the constructor and NewOr DeleteMember operator) is considered as a virtual function of the class.

This does not indicate that each call to a member function will go through the internal virtual function table. In some cases, the compiler can determine that a virtual function can be directly called.

-Fcond-Mismatch
The type of the second and third parameters of the allowed conditional expressions does not match. The value of this expression is void.

-Fthis-is-Variable
Allow ThisAssign values (only for C ++). After merging the User-Defined free storage management mechanism to C ++, assign values' This'Seems out of date. Therefore, by default ThisThe assignment operation is invalid. However, for backward compatibility, you can use' -Fthis-is-Variable'Option to make this operation valid.

-Funsigned-Char
Set CharIt is defined as an unsigned type, just like Unsigned char.

Various machines have their own defaultCharType. It may beUnsigned charOr it may beSigned Char.

Ideally, a portable program should always useSigned CharOrUnsigned charBut many programs have been written as simpleCharAnd expect this to be a signed number (or an unsigned number, depending on the target machine of the program ). this option, and its negative option, enables such a program to work on the corresponding default value.

CharShould always be clearly definedSigned CharOrUnsigned char, Even if it is exactly the same as one of them.

-Fsigned-Char
Set CharIt is defined as a signed type, like Signed Char.

This option is equivalent'-Fno-Unsigned-Char', He is the negative form'-Funsigned-Char'Opposite options. Similarly ,'-Fno-signed-Char'Equivalent'-Funsigned-Char'.

-Fsigned-bitfields
-Funsigned-bitfields
-Fno-signed-bitfields
-Fno-Unsigned-bitfields
If no explicit statement is made' Signed'Or' Unsigned'Modifier. These options are used to define a signed field or a non-Signed field. By default, bit fields are signed because they inherit the basic integer type, such IntIs a signed number.

However, if'-Traditional'Option. The bit field is always the number of unsigned characters.

-Fwritable-strings
Store string constants in writable data segments without special treatment. This is to be compatible with some old programs. They assume that string constants are writable .' -Traditional'Options also have the same effect.

Tampering with string constants is a very bad idea; ''constant ''should be a constant.

Preprocessor Option)

The following options are for the c Preprocessor, which is used to process the C source file before official compilation.

If'-E'Option. GCC only performs preprocessing. Some of the following options must be'-E'Options make sense, because their output results cannot be used for compilation.

-Include File
Before processing a regular input file, you must first process the file FileThe result is that the file FileFirst get the compilation. command line on any' -D'And' -U'Option is always on' -Include File'Previous processing, no matter how orderly they are on the command line. However' -Include'And' -Imacros'Options are processed in writing order.

-Imacros File
Before processing a regular input file, you must first process the file FileBut the output result is ignored. The file is discarded. FileThe output content ,' -Imacros File'The only effect of the option is to make the file FileThe macro definition in can be used for other input files. In processing' -Imacros File'Preprocessor first Process' -D'And' -U'Option, and do not care about their order on the command line. However' -Include'And' -Imacros'Options are processed in writing order.

-Idirafter Dir
Directory DirAdd to the second include path. If a header file is in the main include path (use' -IThe pre-processor searches for the second inclusion path.

-Iprefix Prefix
Specify PrefixAs follow' -Iwithprefix'Option prefix.

-Iwithprefix Dir
Add the directory to the second include path. The directory name is PrefixAnd DirMerged. Here PrefixBy the previous' -Iprefix'Option is specified.

-Nostdinc
Do not search for header files in the standard system directory. Only search' -I'Specifies the directory (and the current directory, if appropriate ).

Combined'-Nostdinc'And'-I-'Option, you can restrict the search containing files to explicitly specified directories.

-Nostdinc ++
Do not search for header files in the C ++ standard directory, but still search for other Standard Directories' Libg ++.)
-UNDEF
Do not predefine any non-standard macros (including system structure flag ).

-E
Only run C Preprocessor. pre-process all specified C source files and send the results to standard output or specified output files.

-C
Tell the Preprocessor not to discard comments. Cooperation' -E'Option.

-P
Tell the Preprocessor not to generate' # Line'COMMAND. core' -E'Option.

-M [-Mg]
Tells the Preprocessor output a suitable MakeTo describe the dependencies of each target file. For each source file, the pre-processor outputs MakeRule. The target item (target) of the rule is the target file name corresponding to the source file, and the dependency item (dependency) is' # IncludeAll referenced files. The generated rule can be a single line, but if it is too long, use' /'-The linefeed is continued to multiple rows. The rule is displayed in the standard output and no pre-processed C Programs are generated.

`-M'Implicit'-E'Option.

`-Mg'Requires that the missing header files be treated as existing, and assume that they are in the same directory as the source file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.