⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gcc.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 5 页
字号:
.B const char[\c.I length\c\&]\c\& so thatcopying the address of one into a non-\c.B const\c\& \c.B char *\c\&pointer will get a warning.  These warnings will help you find atcompile time code that can try to write into a string constant, butonly if you have been very careful about using \c.B const\c\& indeclarations and prototypes.  Otherwise, it will just be a nuisance;this is why we did not make `\|\c.B \-Wall\c\&\|' request these warnings..TP.B \-WconversionWarn if a prototype causes a type conversion that is different from whatwould happen to the same argument in the absence of a prototype.  Thisincludes conversions of fixed point to floating and vice versa, andconversions changing the width or signedness of a fixed point argumentexcept when the same as the default promotion..TP.B \-Waggregate\-returnWarn if any functions that return structures or unions are defined orcalled.  (In languages where you can return an array, this also elicitsa warning.).TP.B \-Wstrict\-prototypesWarn if a function is declared or defined without specifying theargument types.  (An old-style function definition is permitted withouta warning if preceded by a declaration which specifies the argumenttypes.).TP.B \-Wmissing\-prototypesWarn if a global function is defined without a previous prototypedeclaration.  This warning is issued even if the definition itselfprovides a prototype.  The aim is to detect global functions that failto be declared in header files..TP.B \-Wenum\-clash.I (C++ only.)Warn when converting between different enumeration types..TP.B \-Woverloaded\-virtual.I (C++ only.)In a derived class, the definitions of virtual functions must matchthe type signature of a virtual function declared in the base class.Use this option to request warnings when a derived class declares afunction that may be an erroneous attempt to define a virtualfunction: that is, warn when a function with the same name as avirtual function in the base class, but with a type signature thatdoesn't match any virtual functions from the base class..TP.B \-WinlineWarn if a function can not be inlined, and either it was declared as inline,or else the.B \-finline\-functionsoption was given..TP.B \-WerrorTreat warnings as errors; abort compilation after any warning..PP.SH DEBUGGING OPTIONSGNU CC has various special options that are used for debuggingeither your program or GCC:.TP.B \-gProduce debugging information in the operating system's native format(for DBX or SDB or DWARF).  GDB also can work with this debugginginformation.  On most systems that use DBX format, `\|\c.B \-g\c\&\|' enables useof extra debugging information that only GDB can use; if you want tocontrol for certain whether to generate this information, use`\|\c.B \-ggdb\c\&\|' or `\|\c.B \-gdbx\c\&\|'.Unlike most other C compilers, GNU CC allows you to use `\|\c.B \-g\c\&\|' with`\|\c.B \-O\c\&\|'.  The shortcuts taken by optimized code may occasionallyproduce surprising results: some variables you declared may not existat all; flow of control may briefly move where you did not expect it;some statements may not be executed because they compute constantresults or their values were already at hand; some statements mayexecute in different places because they were moved out of loops.Nevertheless it proves possible to debug optimized output.  This makesit reasonable to use the optimizer for programs that might have bugs.The following options are useful when GNU CC is configured andcompiled with the capability for more than one debugging format. .TP.B \-ggdbProduce debugging information in DBX format (if that is supported),including GDB extensions..TP.B \-gdbxProduce debugging information in DBX format (if that is supported),without GDB extensions..TP.B \-gsdbProduce debugging information in SDB format (if that is supported)..TP.B \-gdwarfProduce debugging information in DWARF format (if that is supported)..PP.BI "\-g" "level".br.BI "\-ggdb" "level".br.BI "\-gdbx" "level".br.BI "\-gsdb" "level".TP.BI "\-gdwarf" "level"Request debugging information and also use \c.I level\c\& to specify howmuch information.  The default level is 2.Level 1 produces minimal information, enough for making backtraces inparts of the program that you don't plan to debug.  This includesdescriptions of functions and external variables, but no informationabout local variables and no line numbers..TP.B \-pGenerate extra code to write profile information suitable for theanalysis program \c.B prof\c\&..TP.B \-pgGenerate extra code to write profile information suitable for theanalysis program \c.B gprof\c\&..TP.B \-aGenerate extra code to write profile information for basic blocks,which will record the number of times each basic block is executed.This data could be analyzed by a program like \c.B tcov\c\&.  Note,however, that the format of the data is not what \c.B tcov\c\& expects.Eventually GNU \c.B gprof\c\& should be extended to process this data..TP.BI "\-d" "letters"\c\&Says to make debugging dumps during compilation at times specified by\c.I letters\c\&.  This is used for debugging the compiler.  The file namesfor most of the dumps are made by appending a word to the source filename (e.g.,  `\|\c.B foo.c.rtl\c\&\|' or `\|\c.B foo.c.jump\c\&\|')..TP.B \-dMDump all macro definitions, at the end of preprocessing, and write nooutput..TP.B \-dNDump all macro names, at the end of preprocessing..TP.B \-dDDump all macro definitions, at the end of preprocessing, in addition tonormal output..TP.B \-dyDump debugging information during parsing, to the standard error..TP.B \-drDump after RTL generation, to `\|\c.B \c.I file\c\&.rtl\c\&\|'..TP.B \-dxJust generate RTL for a function instead of compiling it.  Usually usedwith `\|\c.B r\c\&\|'..TP.B \-djDump after first jump optimization, to `\|\c.B \c.I file\c\&.jump\c\&\|'..TP.B \-dsDump after CSE (including the jump optimization that sometimesfollows CSE), to `\|\c.B \c.I file\c\&.cse\c\&\|'..TP.B \-dLDump after loop optimization, to `\|\c.B \c.I file\c\&.loop\c\&\|'..TP.B \-dtDump after the second CSE pass (including the jump optimization thatsometimes follows CSE), to `\|\c.B \c.I file\c\&.cse2\c\&\|'..TP.B \-dfDump after flow analysis, to `\|\c.B \c.I file\c\&.flow\c\&\|'..TP.B \-dcDump after instruction combination, to `\|\c.B \c.I file\c\&.combine\c\&\|'..TP.B \-dSDump after the first instruction scheduling pass, to`\|\c.B \c.I file\c\&.sched\c\&\|'..TP.B \-dlDump after local register allocation, to `\|\c.B \c.I file\c\&.lreg\c\&\|'..TP.B \-dgDump after global register allocation, to `\|\c.B \c.I file\c\&.greg\c\&\|'..TP.B \-dRDump after the second instruction scheduling pass, to`\|\c.B \c.I file\c\&.sched2\c\&\|'..TP.B \-dJDump after last jump optimization, to `\|\c.B \c.I file\c\&.jump2\c\&\|'..TP.B \-ddDump after delayed branch scheduling, to `\|\c.B \c.I file\c\&.dbr\c\&\|'..TP.B \-dkDump after conversion from registers to stack, to `\|\c.B \c.I file\c\&.stack\c\&\|'..TP.B \-dmPrint statistics on memory usage, at the end of the run, tothe standard error..TP.B \-dpAnnotate the assembler output with a comment indicating whichpattern and alternative was used..TP.B \-fpretend\-floatWhen running a cross-compiler, pretend that the target machine uses thesame floating point format as the host machine.  This causes incorrectoutput of the actual floating constants, but the actual instructionsequence will probably be the same as GNU CC would make when running onthe target machine..TP.B \-save\-tempsStore the usual ``temporary'' intermediate files permanently; place themin the current directory and name them based on the source file.  Thus,compiling `\|\c.B foo.c\c\&\|' with `\|\c.B \-c \-save\-temps\c\&\|' would produce files`\|\c.B foo.cpp\c\&\|' and `\|\c.B foo.s\c\&\|', as well as `\|\c.B foo.o\c\&\|'..PP.SH OPTIMIZATION OPTIONSThese options control various sorts of optimizations:.TP.B \-OOptimize.  Optimizing compilation takes somewhat more time, and a lotmore memory for a large function.Without `\|\c.B \-O\c\&\|', the compiler's goal is to reduce the cost ofcompilation and to make debugging produce the expected results.Statements are independent: if you stop the program with a breakpointbetween statements, you can then assign a new value to any variable orchange the program counter to any other statement in the function andget exactly the results you would expect from the source code.Without `\|\c.B \-O\c\&\|', only variables declared \c.B register\c\& areallocated in registers.  The resulting compiled code is a little worsethan produced by PCC without `\|\c.B \-O\c\&\|'.With `\|\c.B \-O\c\&\|', the compiler tries to reduce code size and executiontime.When you specify `\|\c.B \-O\c\&\|', `\|\c.B \-fthread\-jumps\c\&\|' and`\|\c.B \-fdelayed\-branch\c\&\|' are turned on.  On some machines otherflags may also be turned on..TP.B \-O2Highly optimize.  As compared to `\|\c.B \-O\c\&\|', thisoption will increase both compilation time and the performance of thegenerated code.All `\|\c.B \-f\c.I flag\c\&\c\&\|' options that control optimization are turned onwhen you specify `\|\c.B \-O2\c\&\|', except `\|\c.B \-funroll\-loops\c\&\|'and `\|\c.B \-funroll\-all\-loops\c\&\|'.  .PPOptions of the form `\|\c.B \-f\c.I flag\c\&\c\&\|' specify machine-independentflags.  Most flags have both positive and negative forms; the negativeform of `\|\c.B \-ffoo\c\&\|' would be `\|\c.B \-fno\-foo\c\&\|'.  The following list showsonly one form\(em\&the one which is not the default.You can figure out the other form by either removing `\|\c.B no\-\c\&\|' oradding it..TP.B \-ffloat\-storeDo not store floating point variables in registers.  Thisprevents undesirable excess precision on machines such as the68000 where the floating registers (of the 68881) keep moreprecision than a \c.B double\c\& is supposed to have.For most programs, the excess precision does only good, but a fewprograms rely on the precise definition of IEEE floating point.Use `\|\c.B \-ffloat\-store\c\&\|' for such programs..TP.B \-fmemoize\-lookups.TP.B \-fsave\-memoized.I(C++ only.)These flags are used to get the compiler to compile programs fasterusing heuristics.  They are not on by default since they are only effectiveabout half the time.  The other half of the time programs compile moreslowly (and take more memory).The first time the compiler must build a call to a member function (orreference to a data member), it must (1) determine whether the classimplements member functions of that name; (2) resolve which memberfunction to call (which involves figuring out what sorts of typeconversions need to be made); and (3) check the visibility of the memberfunction to the caller.  All of this adds up to slower compilation.Normally, the second time a call is made to that member function (orreference to that data member), it must go through the same lengthyprocess again.  This means that code like this.sp.br\ \ cout\ <<\ "This\ "\ <<\ p\ <<\ "\ has\ "\ <<\ n\ <<\ "\ legs.\en";.br.spmakes six passes through all three steps.  By using a software cache,a ``hit'' significantly reduces this cost.  Unfortunately, using thecache introduces another layer of mechanisms which must be implemented,and so incurs its own overhead.  `\|\c.B \-fmemoize\-lookups\c\&\|' enablesthe software cache.Because access privileges (visibility) to members and member functionsmay differ from one function context to the next, .B g++may need to flush the cache. With the `\|\c.B \-fmemoize\-lookups\c\&\|' flag, the cache is flushed after everyfunction that is compiled.  The `\|\c\-fsave\-memoized\c\&\|' flag enables the same software cache, but when the compilerdetermines that the context of the last function compiled would yieldthe same access privileges of the next function to compile, itpreserves the cache. This is most helpful when defining many member functions for the sameclass: with the exception of member functions which are friends ofother classes, each member function has exactly the same accessprivileges as every other, and the cache need not be flushed..TP.B \-fno\-default\-inline.I(C++ only.)If `\|\c.B \-fdefault\-inline\c\&\|' is enabled then member functions defined inside classscope are compiled inline by default; i.e., you don't need toadd `\|\c.B inline\c\&\|' in front of the member function name.  By populardemand, this option is now the default.  To keep GNU C++ from inliningthese member functions, specify `\|\c.B \-fno\-default\-inline\c\&\|'..TP.B \-fno\-defer\-popAlways pop the arguments to each function call as soon as thatfunction returns.  For machines which must pop arguments after afunction call, the compiler normally lets arguments accumulate on thestack for several function calls and pops them all at once..TP.B \-fforce\-memForce memory operands to be copied into registers before doingarithmetic on them.  This may produce better code by making allmemory references potential common subexpressions.  When they arenot common subexpressions, instruction combination shouldeliminate the separate register-load.  I am interested in hearingabout the difference this makes..TP.B \-fforce\-addrForce memory address constants to be copied into registers beforedoing arithmetic on them.  This may produce better code just as`\|\c.B \-fforce\-mem\c\&\|' may.  I am interested in hearing about thedifference this makes..TP.B \-fomit\-frame\-pointerDon't keep the frame pointer in a register for functions thatdon't need one.  This avoids the instructions to save, set up andrestore frame pointers; it also makes an extra register availablein many functions.  \c.I It also makes debugging impossible onmost machines.\c\&On some machines, such as the Vax, this flag has no effect, becausethe standard calling sequence automatically handles the frame pointerand nothing is saved by pretending it doesn't exist.  Themachine-description macro \c.B FRAME_POINTER_REQUIRED\c\& controlswhether a target machine supports this flag.  .TP.B \-finlinePay attention the \c.B inline\c\& keyword.  Normally the negation of thisoption `\|\c.B \-fno\-inline\c\&\|' is used to keep the compiler from expandingany functions inline.  However, the opposite effect may be desirablewhen compiling with `\|\c.B \-g\c\&\|', since `\|\c.B \-g\c\&\|' normally turns off allinline function expansion..TP.B \-finline\-functionsIntegrate all simple functions into their callers.  The compilerheuristically decides which functions are simple enough to be worthintegrating in this way.If all calls to a given function are integrated, and the function isdeclared \c.B static\c\&, then GCC normally does not output the function asassembler code in its own right..TP.B \-fcaller\-savesEnable values to be allocated in registers that will be clobbered by

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -