diff options
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 198 |
1 files changed, 138 insertions, 60 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2397e5d..d5103f4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -274,7 +274,7 @@ in the following sections. -Wsuggest-final-types -Wsuggest-override -Wno-template-body -Wno-template-id-cdtor -Wtemplate-names-tu-local -Wno-terminate -Wno-vexing-parse -Wvirtual-inheritance --Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant} +-Wno-virtual-move-assign -Wvolatile} @item Objective-C and Objective-C++ Language Options @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling @@ -394,7 +394,8 @@ Objective-C and Objective-C++ Dialects}. -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute --Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile +-Wmissing-include-dirs -Wmissing-noreturn -Wmusttail-local-addr +-Wmaybe-musttail-local-addr -Wno-missing-profile -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} -Wnull-dereference -Wno-odr @@ -405,7 +406,9 @@ Objective-C and Objective-C++ Dialects}. -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor --Wredundant-decls -Wrestrict -Wno-return-local-addr -Wreturn-type +-Wno-psabi +-Wredundant-decls -Wrestrict +-Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local -Wno-shadow-ivar @@ -442,6 +445,7 @@ Objective-C and Objective-C++ Dialects}. -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings -Wno-xor-used-as-pow +-Wzero-as-null-pointer-constant -Wzero-length-bounds} @item Static Analyzer Options @@ -671,7 +675,7 @@ Objective-C and Objective-C++ Dialects}. -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} -fsanitize-trap -fsanitize-trap=@var{style} -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... --fsanitize-undefined-trap-on-error -fbounds-check +-fsanitize-undefined-trap-on-error -fbounds-check -fcf-protection -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} -fharden-compares -fharden-conditional-branches -fhardened -fharden-control-flow-redundancy -fhardcfr-skip-leaf @@ -991,6 +995,7 @@ Objective-C and Objective-C++ Dialects}. -mtrap-precision=@var{mode} -mbuild-constants -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -mbwx -mmax -mfix -mcix +-msafe-bwa -msafe-partial -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data -mlarge-data -msmall-text -mlarge-text @@ -2613,8 +2618,8 @@ ISO C23. @item -fno-builtin @itemx -fno-builtin-@var{function} Don't recognize built-in functions that do not begin with -@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in -functions provided by GCC}, for details of the functions affected, +@samp{__builtin_} as prefix. @xref{Library Builtins}, +for details of the functions affected, including those which are not built-in functions when @option{-ansi} or @option{-std} options for strict ISO C conformance are used because they do not have an ISO standard meaning. @@ -4689,11 +4694,6 @@ non-class type, @code{volatile}-qualified function return type, Enabled by default with @option{-std=c++20}. Before @option{-std=c++20}, enabled with explicit @option{-Wdeprecated}. -@opindex Wzero-as-null-pointer-constant -@opindex Wno-zero-as-null-pointer-constant -@item -Wzero-as-null-pointer-constant -Warn when a literal @samp{0} is used as null pointer constant. - @opindex Waligned-new @opindex Wno-aligned-new @item -Waligned-new @@ -6147,12 +6147,12 @@ Inhibit all warning messages. @opindex Werror @opindex Wno-error @item -Werror -Make all warnings into errors. +Turn all warnings into errors. @opindex Werror= @opindex Wno-error= @item -Werror= -Make the specified warning into an error. The specifier for a warning +Turn the specified warning into an error. The specifier for a warning is appended; for example @option{-Werror=switch} turns the warnings controlled by @option{-Wswitch} into errors. This switch takes a negative form, to be used to negate @option{-Werror} for specific @@ -6499,7 +6499,8 @@ of a derived class. Warn about code affected by ABI changes. This includes code that may not be compatible with the vendor-neutral C++ ABI as well as the psABI -for the particular target. +for the particular target. The latter warnings are also controlled +separately by @option{-Wpsabi}, which is implied by @option{-Wabi}. Since G++ now defaults to updating the ABI with each major release, normally @option{-Wabi} warns only about C++ ABI compatibility @@ -6602,27 +6603,21 @@ This was fixed in @option{-fabi-version=10}, the default for GCC 6.1. @end itemize -This option also enables warnings about psABI-related changes. -The known psABI changes at this point include: - -@itemize @bullet - -@item -For SysV/x86-64, unions with @code{long double} members are -passed in memory as specified in psABI. Prior to GCC 4.4, this was not -the case. For example: - -@smallexample -union U @{ - long double ld; - int i; -@}; -@end smallexample +@opindex Wpsabi +@opindex Wno-psabi +@item -Wpsabi @r{(C, Objective-C, C++ and Objective-C++ only)} -@noindent -@code{union U} is now always passed in memory. +@option{-Wpsabi} enables warnings about processor-specific ABI +changes, such as changes in alignment requirements or how function +arguments are passed. On several targets, including AArch64, ARM, +x86, MIPS, RS6000/PowerPC, and S/390, these details have changed +between different versions of GCC and/or different versions of the C +or C++ language standards in ways that affect binary compatibility of +compiled code. With @option{-Wpsabi}, GCC can detect potentially +incompatible usages and warn you about them. -@end itemize +@option{-Wpsabi} is enabled by default, and is also implied by +@option{-Wabi}. @opindex Wchanges-meaning @opindex Wno-changes-meaning @@ -6975,6 +6970,55 @@ is only active when @option{-fdelete-null-pointer-checks} is active, which is enabled by optimizations in most targets. The precision of the warnings depends on the optimization options used. +@opindex Wno-musttail-local-addr +@opindex -Wmusttail-local-addr +@item -Wno-musttail-local-addr +Do not warn about passing a pointer (or in C++, a reference) to a +local variable or label to argument of a @code{musttail} call. Those +variables go out of scope before the tail call instruction. + +@opindex Wmaybe-musttail-local-addr +@opindex -Wno-maybe-musttail-local-addr +@item -Wmaybe-musttail-local-addr +Warn when address of a local variable can escape to a @code{musttail} +call, unless it goes out of scope already before the @code{musttail} +call. + +@smallexample +int foo (int *); + +int +bar (int *x) +@{ + if (x[0] == 1) + @{ + int a = 42; + foo (&a); + /* Without the @code{musttail} attribute this call would not + be tail called, because address of the @code{a} variable escapes + and the second foo call could dereference it. With the attribute + the local variables are assumed to go out of scope immediately + before the tail call instruction and the compiler warns about + this. */ + [[gnu::musttail]] return foo (nullptr); + @} + else + @{ + @{ + int a = 42; + foo (&a); + @} + /* The @code{a} variable isn't already in scope, so even when it + escaped, even without @code{musttail} attribute it would be + undefined behavior to dereference it and the compiler could + turn this into a tail call. No warning is diagnosed here. */ + [[gnu::musttail]] return foo (nullptr); + @} +@} +@end smallexample + +This warning is enabled by @option{-Wextra}. + @opindex Wnrvo @opindex Wno-nrvo @item -Wnrvo @r{(C++ and Objective-C++ only)} @@ -8919,6 +8963,11 @@ error alone, with @option{-Wno-error=int-conversion}. This warning is upgraded to an error by @option{-pedantic-errors}. +@opindex Wzero-as-null-pointer-constant +@opindex Wno-zero-as-null-pointer-constant +@item -Wzero-as-null-pointer-constant +Warn when a literal @samp{0} is used as null pointer constant. + @opindex Wzero-length-bounds @opindex Wzero-length-bounds @item -Wzero-length-bounds @@ -10060,8 +10109,9 @@ a warning.) @opindex Wno-aggressive-loop-optimizations @opindex Waggressive-loop-optimizations @item -Wno-aggressive-loop-optimizations -Warn if in a loop with constant number of iterations the compiler detects -undefined behavior in some statement during one or more of the iterations. +Do not warn if the compiler detects undefined behavior in a loop with +a constant number of iterations. @option{-Waggressive-loop-optimizations} +is enabled by default. @opindex Wno-attributes @opindex Wattributes @@ -18321,7 +18371,8 @@ operand constant, @code{__sanitizer_cov_trace_cmpf} or @opindex fcf-protection @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} -Enable code instrumentation of control-flow transfers to increase +@itemx -fcf-protection +Enable code instrumentation to increase program security by checking that target addresses of control-flow transfer instructions (such as indirect function call, function return, indirect jump) are valid. This prevents diverting the flow of control @@ -18329,22 +18380,30 @@ to an unexpected target. This is intended to protect against such threats as Return-oriented Programming (ROP), and similarly call/jmp-oriented programming (COP/JOP). +The @option{-fcf-protection=} keywords are interpreted as follows. + The value @code{branch} tells the compiler to implement checking of validity of control-flow transfer at the point of indirect branch -instructions, i.e.@: call/jmp instructions. The value @code{return} -implements checking of validity at the point of returning from a -function. The value @code{full} is an alias for specifying both -@code{branch} and @code{return}. The value @code{none} turns off -instrumentation. +instructions, i.e.@: call/jmp instructions. + +The value @code{return} implements checking of validity at the point of +returning from a function. -To override @option{-fcf-protection}, @option{-fcf-protection=none} -needs to be added and then with @option{-fcf-protection=xxx}. +The value @code{full} is an alias for specifying both +@code{branch} and @code{return}. The value @code{check} is used for the final link with link-time optimization (LTO). An error is issued if LTO object files are compiled with different @option{-fcf-protection} values. The value @code{check} is ignored at the compile time. +The value @code{none} turns off instrumentation. + +@option{-fcf-protection} is an alias for @option{-fcf-protection=full}. +To override a previous @option{-fcf-protection} option on the command +line, add @option{-fcf-protection=none} and then +@option{-fcf-protection=@var{kind}}. + The macro @code{__CET__} is defined when @option{-fcf-protection} is used. The first bit of @code{__CET__} is set to 1 for the value @code{branch} and the second bit of @code{__CET__} is set to 1 for @@ -22094,7 +22153,8 @@ Enable the Pointer Authentication Extension. @item cssc Enable the Common Short Sequence Compression instructions. @item sme -Enable the Scalable Matrix Extension. +Enable the Scalable Matrix Extension. This is only supported when SVE2 is also +enabled. @item sme-i16i64 Enable the FEAT_SME_I16I64 extension to SME. This also enables SME instructions. @@ -26302,6 +26362,24 @@ CIX, FIX and MAX instruction sets. The default is to use the instruction sets supported by the CPU type specified via @option{-mcpu=} option or that of the CPU on which GCC was built if none is specified. +@opindex msafe-bwa +@opindex mno-safe-bwa +@item -msafe-bwa +@itemx -mno-safe-bwa +Indicate whether in the absence of the optional BWX instruction set +GCC should generate multi-thread and async-signal safe code for byte +and aligned word memory accesses. + +@opindex msafe-partial +@opindex mno-safe-partial +@item -msafe-partial +@itemx -mno-safe-partial +Indicate whether GCC should generate multi-thread and async-signal +safe code for partial memory accesses, including piecemeal accesses +to unaligned data as well as block accesses to leading and trailing +parts of aggregate types or other objects in memory that do not +respectively start and end on an aligned 64-bit data boundary. + @opindex mfloat-vax @opindex mfloat-ieee @item -mfloat-vax @@ -28000,8 +28078,8 @@ Use (do not use) @code{amcas[_db].@{b/h/w/d@}} instructions. When build with @opindex mno-ld-seq-sa @item -mld-seq-sa @itemx -mno-ld-seq-sa -Whether a load-load barrier (@code{dbar 0x700}) is needed. When build with -@option{-march=la664}, it is enabled by default. The default is +Whether a same-address load-load barrier (@code{dbar 0x700}) is needed. When +build with @option{-march=la664}, it is enabled by default. The default is @option{-mno-ld-seq-sa}, the load-load barrier is needed. @opindex mtls-dialect @@ -28009,6 +28087,14 @@ Whether a load-load barrier (@code{dbar 0x700}) is needed. When build with This option controls which tls dialect may be used for general dynamic and local dynamic TLS models. +@table @samp +@item trad +Use traditional TLS. This is the default. + +@item desc +Use TLS descriptors. +@end table + @opindex mannotate-tablejump @opindex mno-annotate-tablejump @item -mannotate-tablejump @@ -28020,14 +28106,6 @@ tools, for example @file{objtool} of the Linux kernel building system, need the annotation to analysis the control flow. The default is @option{-mno-annotate-tablejump}. -@table @samp -@item trad -Use traditional TLS. This is the default. - -@item desc -Use TLS descriptors. -@end table - @item --param loongarch-vect-unroll-limit=@var{n} The vectorizer will use available tuning information to determine whether it would be beneficial to unroll the main vectorized loop and by how much. This @@ -32372,18 +32450,18 @@ and for AIX: @samp{vec-extabi}, @samp{vec-default}@. Change the current ABI to use IBM extended-precision long double. This is not likely to work if your system defaults to using IEEE extended-precision long double. If you change the long double type -from IEEE extended-precision, the compiler will issue a warning unless -you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} -to be enabled. +from IEEE extended-precision, the compiler issues a warning unless +you use the @option{-Wno-psabi} option (@pxref{Warning Options}). +Requires @option{-mlong-double-128} to be enabled. @opindex mabi=ieeelongdouble @item -mabi=ieeelongdouble Change the current ABI to use IEEE extended-precision long double. This is not likely to work if your system defaults to using IBM extended-precision long double. If you change the long double type -from IBM extended-precision, the compiler will issue a warning unless -you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} -to be enabled. +from IBM extended-precision, the compiler issues a warning unless +you use the @option{-Wno-psabi} option (@pxref{Warning Options}). +Requires @option{-mlong-double-128} to be enabled. @opindex mabi=elfv1 @item -mabi=elfv1 |