📄 arm-linux-gcc.1
字号:
language supported by \s-1GCC\s0..PPHere is a list of options that are \fIonly\fR for compiling \*(C+ programs:.IP "\fB\-fabi\-version=\fR\fIn\fR" 4.IX Item "-fabi-version=n"Use version \fIn\fR of the \*(C+ \s-1ABI\s0. Version 2 is the version of the\&\*(C+ \s-1ABI\s0 that first appeared in G++ 3.4. Version 1 is the version ofthe \*(C+ \s-1ABI\s0 that first appeared in G++ 3.2. Version 0 will always bethe version that conforms most closely to the \*(C+ \s-1ABI\s0 specification.Therefore, the \s-1ABI\s0 obtained using version 0 will change as \s-1ABI\s0 bugsare fixed..SpThe default is version 2..IP "\fB\-fno\-access\-control\fR" 4.IX Item "-fno-access-control"Turn off all access checking. This switch is mainly useful for workingaround bugs in the access control code..IP "\fB\-fcheck\-new\fR" 4.IX Item "-fcheck-new"Check that the pointer returned by \f(CW\*(C`operator new\*(C'\fR is non-nullbefore attempting to modify the storage allocated. This check isnormally unnecessary because the \*(C+ standard specifies that\&\f(CW\*(C`operator new\*(C'\fR will only return \f(CW0\fR if it is declared\&\fB\f(BIthrow()\fB\fR, in which case the compiler will always check thereturn value even without this option. In all other cases, when\&\f(CW\*(C`operator new\*(C'\fR has a non-empty exception specification, memoryexhaustion is signalled by throwing \f(CW\*(C`std::bad_alloc\*(C'\fR. See also\&\fBnew (nothrow)\fR..IP "\fB\-fconserve\-space\fR" 4.IX Item "-fconserve-space"Put uninitialized or runtime-initialized global variables into thecommon segment, as C does. This saves space in the executable at thecost of not diagnosing duplicate definitions. If you compile with thisflag and your program mysteriously crashes after \f(CW\*(C`main()\*(C'\fR hascompleted, you may have an object that is being destroyed twice becausetwo definitions were merged..SpThis option is no longer useful on most targets, now that support hasbeen added for putting variables into \s-1BSS\s0 without making them common..IP "\fB\-fno\-const\-strings\fR" 4.IX Item "-fno-const-strings"Give string constants type \f(CW\*(C`char *\*(C'\fR instead of type \f(CW\*(C`constchar *\*(C'\fR. By default, G++ uses type \f(CW\*(C`const char *\*(C'\fR as required bythe standard. Even if you use \fB\-fno\-const\-strings\fR, you cannotactually modify the value of a string constant, unless you also use\&\fB\-fwritable\-strings\fR..SpThis option might be removed in a future release of G++. For maximumportability, you should structure your code so that it works withstring constants that have type \f(CW\*(C`const char *\*(C'\fR..IP "\fB\-fno\-elide\-constructors\fR" 4.IX Item "-fno-elide-constructors"The \*(C+ standard allows an implementation to omit creating a temporarywhich is only used to initialize another object of the same type.Specifying this option disables that optimization, and forces G++ tocall the copy constructor in all cases..IP "\fB\-fno\-enforce\-eh\-specs\fR" 4.IX Item "-fno-enforce-eh-specs"Don't check for violation of exception specifications at runtime. Thisoption violates the \*(C+ standard, but may be useful for reducing codesize in production builds, much like defining \fB\s-1NDEBUG\s0\fR. The compilerwill still optimize based on the exception specifications..IP "\fB\-ffor\-scope\fR" 4.IX Item "-ffor-scope".PD 0.IP "\fB\-fno\-for\-scope\fR" 4.IX Item "-fno-for-scope".PDIf \fB\-ffor\-scope\fR is specified, the scope of variables declared ina \fIfor-init-statement\fR is limited to the \fBfor\fR loop itself,as specified by the \*(C+ standard.If \fB\-fno\-for\-scope\fR is specified, the scope of variables declared ina \fIfor-init-statement\fR extends to the end of the enclosing scope,as was the case in old versions of G++, and other (traditional)implementations of \*(C+..SpThe default if neither flag is given to follow the standard,but to allow and give a warning for old-style code that wouldotherwise be invalid, or have different behavior..IP "\fB\-fno\-gnu\-keywords\fR" 4.IX Item "-fno-gnu-keywords"Do not recognize \f(CW\*(C`typeof\*(C'\fR as a keyword, so that code can use thisword as an identifier. You can use the keyword \f(CW\*(C`_\|_typeof_\|_\*(C'\fR instead.\&\fB\-ansi\fR implies \fB\-fno\-gnu\-keywords\fR..IP "\fB\-fno\-implicit\-templates\fR" 4.IX Item "-fno-implicit-templates"Never emit code for non-inline templates which are instantiatedimplicitly (i.e. by use); only emit code for explicit instantiations..IP "\fB\-fno\-implicit\-inline\-templates\fR" 4.IX Item "-fno-implicit-inline-templates"Don't emit code for implicit instantiations of inline templates, either.The default is to handle inlines differently so that compiles with andwithout optimization will need the same set of explicit instantiations..IP "\fB\-fno\-implement\-inlines\fR" 4.IX Item "-fno-implement-inlines"To save space, do not emit out-of-line copies of inline functionscontrolled by \fB#pragma implementation\fR. This will cause linkererrors if these functions are not inlined everywhere they are called..IP "\fB\-fms\-extensions\fR" 4.IX Item "-fms-extensions"Disable pedantic warnings about constructs used in \s-1MFC\s0, such as implicitint and getting a pointer to member function via non-standard syntax..IP "\fB\-fno\-nonansi\-builtins\fR" 4.IX Item "-fno-nonansi-builtins"Disable built-in declarations of functions that are not mandated by\&\s-1ANSI/ISO\s0 C. These include \f(CW\*(C`ffs\*(C'\fR, \f(CW\*(C`alloca\*(C'\fR, \f(CW\*(C`_exit\*(C'\fR,\&\f(CW\*(C`index\*(C'\fR, \f(CW\*(C`bzero\*(C'\fR, \f(CW\*(C`conjf\*(C'\fR, and other related functions..IP "\fB\-fno\-operator\-names\fR" 4.IX Item "-fno-operator-names"Do not treat the operator name keywords \f(CW\*(C`and\*(C'\fR, \f(CW\*(C`bitand\*(C'\fR,\&\f(CW\*(C`bitor\*(C'\fR, \f(CW\*(C`compl\*(C'\fR, \f(CW\*(C`not\*(C'\fR, \f(CW\*(C`or\*(C'\fR and \f(CW\*(C`xor\*(C'\fR assynonyms as keywords..IP "\fB\-fno\-optional\-diags\fR" 4.IX Item "-fno-optional-diags"Disable diagnostics that the standard says a compiler does not need toissue. Currently, the only such diagnostic issued by G++ is the one fora name having multiple meanings within a class..IP "\fB\-fpermissive\fR" 4.IX Item "-fpermissive"Downgrade some diagnostics about nonconformant code from errors towarnings. Thus, using \fB\-fpermissive\fR will allow somenonconforming code to compile..IP "\fB\-frepo\fR" 4.IX Item "-frepo"Enable automatic template instantiation at link time. This option alsoimplies \fB\-fno\-implicit\-templates\fR. .IP "\fB\-fno\-rtti\fR" 4.IX Item "-fno-rtti"Disable generation of information about every class with virtualfunctions for use by the \*(C+ runtime type identification features(\fBdynamic_cast\fR and \fBtypeid\fR). If you don't use those partsof the language, you can save some space by using this flag. Note thatexception handling uses the same information, but it will generate it asneeded..IP "\fB\-fstats\fR" 4.IX Item "-fstats"Emit statistics about front-end processing at the end of the compilation.This information is generally only useful to the G++ development team..IP "\fB\-ftemplate\-depth\-\fR\fIn\fR" 4.IX Item "-ftemplate-depth-n"Set the maximum instantiation depth for template classes to \fIn\fR.A limit on the template instantiation depth is needed to detectendless recursions during template class instantiation. \s-1ANSI/ISO\s0 \*(C+conforming programs must not rely on a maximum depth greater than 17..IP "\fB\-fuse\-cxa\-atexit\fR" 4.IX Item "-fuse-cxa-atexit"Register destructors for objects with static storage duration with the\&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR function rather than the \f(CW\*(C`atexit\*(C'\fR function.This option is required for fully standards-compliant handling of staticdestructors, but will only work if your C library supports\&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR..IP "\fB\-fno\-weak\fR" 4.IX Item "-fno-weak"Do not use weak symbol support, even if it is provided by the linker.By default, G++ will use weak symbols if they are available. Thisoption exists only for testing, and should not be used by end\-users;it will result in inferior code and has no benefits. This option maybe removed in a future release of G++..IP "\fB\-nostdinc++\fR" 4.IX Item "-nostdinc++"Do not search for header files in the standard directories specific to\&\*(C+, but do still search the other standard directories. (This optionis used when building the \*(C+ library.).PPIn addition, these optimization, warning, and code generation optionshave meanings only for \*(C+ programs:.IP "\fB\-fno\-default\-inline\fR" 4.IX Item "-fno-default-inline"Do not assume \fBinline\fR for functions defined inside a class scope. Note that thesefunctions will have linkage like inline functions; they just won't beinlined by default..IP "\fB\-Wabi\fR (\*(C+ only)" 4.IX Item "-Wabi ( only)"Warn when G++ generates code that is probably not compatible with thevendor-neutral \*(C+ \s-1ABI\s0. Although an effort has been made to warn aboutall such cases, there are probably some cases that are not warned about,even though G++ is generating incompatible code. There may also becases where warnings are emitted even though the code that is generatedwill be compatible..SpYou should rewrite your code to avoid these warnings if you areconcerned about the fact that code generated by G++ may not be binarycompatible with code generated by other compilers..SpThe known incompatibilities at this point include:.RS 4.IP "\(bu" 4Incorrect handling of tail-padding for bit\-fields. G++ may attempt topack data into the same byte as a base class. For example:.Sp.Vb 2\& struct A { virtual void f(); int f1 : 1; };\& struct B : public A { int f2 : 1; };.Ve.SpIn this case, G++ will place \f(CW\*(C`B::f2\*(C'\fR into the same byteas\f(CW\*(C`A::f1\*(C'\fR; other compilers will not. You can avoid this problemby explicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of thebyte size on your platform; that will cause G++ and other compilers tolayout \f(CW\*(C`B\*(C'\fR identically..IP "\(bu" 4Incorrect handling of tail-padding for virtual bases. G++ does not usetail padding when laying out virtual bases. For example:.Sp.Vb 3\& struct A { virtual void f(); char c1; };\& struct B { B(); char c2; };\& struct C : public A, public virtual B {};.Ve.SpIn this case, G++ will not place \f(CW\*(C`B\*(C'\fR into the tail-padding for\&\f(CW\*(C`A\*(C'\fR; other compilers will. You can avoid this problem byexplicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of itsalignment (ignoring virtual base classes); that will cause G++ and othercompilers to layout \f(CW\*(C`C\*(C'\fR identically..IP "\(bu" 4Incorrect handling of bit-fields with declared widths greater than thatof their underlying types, when the bit-fields appear in a union. Forexample:.Sp.Vb 1\& union U { int i : 4096; };.Ve.SpAssuming that an \f(CW\*(C`int\*(C'\fR does not have 4096 bits, G++ will make theunion too small by the number of bits in an \f(CW\*(C`int\*(C'\fR..IP "\(bu" 4Empty classes can be placed at incorrect offsets. For example:.Sp.Vb 1\& struct A {};.Ve.Sp.Vb 4\& struct B {\& A a;\& virtual void f ();\& };.Ve.Sp.Vb 1\& struct C : public B, public A {};.Ve.SpG++ will place the \f(CW\*(C`A\*(C'\fR base class of \f(CW\*(C`C\*(C'\fR at a nonzero offset;it should be placed at offset zero. G++ mistakenly believes that the\&\f(CW\*(C`A\*(C'\fR data member of \f(CW\*(C`B\*(C'\fR is already at offset zero..IP "\(bu" 4Names of template functions whose types involve \f(CW\*(C`typename\*(C'\fR ortemplate template parameters can be mangled incorrectly..Sp.Vb 2\& template <typename Q>\& void f(typename Q::X) {}.Ve.Sp.Vb 2\& template <template <typename> class Q>\& void f(typename Q<int>::X) {}.Ve.SpInstantiations of these templates may be mangled incorrectly..RE.RS 4.RE.IP "\fB\-Wctor\-dtor\-privacy\fR (\*(C+ only)" 4.IX Item "-Wctor-dtor-privacy ( only)"Warn when a class seems unusable because all the constructors ordestructors in that class are private, and it has neither friends norpublic static member functions..IP "\fB\-Wnon\-virtual\-dtor\fR (\*(C+ only)" 4.IX Item "-Wnon-virtual-dtor ( only)"Warn when a class appears to be polymorphic, thereby requiring a virtualdestructor, yet it declares a non-virtual one.This warning is enabled by \fB\-Wall\fR..IP "\fB\-Wreorder\fR (\*(C+ only)" 4.IX Item "-Wreorder ( only)"Warn when the order of member initializers given in the code does notmatch the order in which they must be executed. For instance:.Sp.Vb 5\& struct A {\& int i;\& int j;\& A(): j (0), i (1) { }\& };.Ve.SpThe compiler will rearrange the member initializers for \fBi\fRand \fBj\fR to match the declaration order of the members, emittinga warning to that effect. This warning is enabled by \fB\-Wall\fR..PPThe following \fB\-W...\fR options are not affected by \fB\-Wall\fR..IP "\fB\-Weffc++\fR (\*(C+ only)" 4.IX Item "-Weffc++ ( only)"Warn about violations of the following style guidelines from Scott Meyers'\&\fIEffective
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -