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

📄 invoke.texi

📁 GCC
💻 TEXI
📖 第 1 页 / 共 5 页
字号:

This option is deprecated.

@item -ffor-scope
@itemx -fno-for-scope
@opindex ffor-scope
@opindex fno-for-scope
If @option{-ffor-scope} is specified, the scope of variables declared in
a @i{for-init-statement} is limited to the @samp{for} loop itself,
as specified by the C++ standard.
If @option{-fno-for-scope} is specified, the scope of variables declared in
a @i{for-init-statement} extends to the end of the enclosing scope,
as was the case in old versions of gcc, and other (traditional)
implementations of C++.

The default if neither flag is given to follow the standard,
but to allow and give a warning for old-style code that would
otherwise be invalid, or have different behavior.

@item -fno-gnu-keywords
@opindex fno-gnu-keywords
Do not recognize @code{typeof} as a keyword, so that code can use this
word as an identifier. You can use the keyword @code{__typeof__} instead.
@option{-ansi} implies @option{-fno-gnu-keywords}.

@item -fno-honor-std
@opindex fno-honor-std
Ignore @code{namespace std}, instead of treating it as a real namespace.
With this switch, the compiler will ignore
@code{namespace-declarations}, @code{using-declarations},
@code{using-directives}, and @code{namespace-names}, if they involve
@code{std}.  

This option is only useful if you have manually compiled the C++
run-time library with the same switch.  Otherwise, your programs will
not link.  The use of this option is not recommended, and the option may
be removed from a future version of G++.

@item -fno-implicit-templates
@opindex fno-implicit-templates
Never emit code for non-inline templates which are instantiated
implicitly (i.e. by use); only emit code for explicit instantiations.
@xref{Template Instantiation}, for more information.

@item -fno-implicit-inline-templates
@opindex 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 and
without optimization will need the same set of explicit instantiations.

@item -fno-implement-inlines
@opindex fno-implement-inlines
To save space, do not emit out-of-line copies of inline functions
controlled by @samp{#pragma implementation}.  This will cause linker
errors if these functions are not inlined everywhere they are called.

@item -fms-extensions
@opindex fms-extensions
Disable pedantic warnings about constructs used in MFC, such as implicit
int and getting a pointer to member function via non-standard syntax.

@item -fno-nonansi-builtins
@opindex fno-nonansi-builtins
Disable built-in declarations of functions that are not mandated by
ANSI/ISO C.  These include @code{ffs}, @code{alloca}, @code{_exit},
@code{index}, @code{bzero}, @code{conjf}, and other related functions.

@item -fno-operator-names
@opindex fno-operator-names
Do not treat the operator name keywords @code{and}, @code{bitand},
@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
synonyms as keywords.

@item -fno-optional-diags
@opindex fno-optional-diags
Disable diagnostics that the standard says a compiler does not need to
issue.  Currently, the only such diagnostic issued by g++ is the one for
a name having multiple meanings within a class.

@item -fpermissive
@opindex fpermissive
Downgrade messages about nonconformant code from errors to warnings.  By
default, g++ effectively sets @option{-pedantic-errors} without
@option{-pedantic}; this option reverses that.  This behavior and this
option are superseded by @option{-pedantic}, which works as it does for GNU C.

@item -frepo
@opindex frepo
Enable automatic template instantiation.  This option also implies
@option{-fno-implicit-templates}.  @xref{Template Instantiation}, for more
information.

@item -fno-rtti
@opindex fno-rtti
Disable generation of information about every class with virtual
functions for use by the C++ runtime type identification features
(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
of the language, you can save some space by using this flag.  Note that
exception handling uses the same information, but it will generate it as
needed.

@item -fstats
@opindex fstats
Emit statistics about front-end processing at the end of the compilation.
This information is generally only useful to the G++ development team.

@item -ftemplate-depth-@var{n}
@opindex ftemplate-depth
Set the maximum instantiation depth for template classes to @var{n}.
A limit on the template instantiation depth is needed to detect
endless recursions during template class instantiation. ANSI/ISO C++
conforming programs must not rely on a maximum depth greater than 17.

@item -fuse-cxa-atexit
@opindex fuse-cxa-atexit
Register destructors for objects with static storage duration with the
@code{__cxa_atexit} function rather than the @code{atexit} function.
This option is required for fully standards-compliant handling of static
destructors, but will only work if your C library supports
@code{__cxa_atexit}.

@item -fno-weak
@opindex 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.  This
option exists only for testing, and should not be used by end-users;
it will result in inferior code and has no benefits.  This option may
be removed in a future release of G++.

@item -nostdinc++
@opindex nostdinc++
Do not search for header files in the standard directories specific to
C++, but do still search the other standard directories.  (This option
is used when building the C++ library.)
@end table

In addition, these optimization, warning, and code generation options
have meanings only for C++ programs:

@table @gcctabopt
@item -fno-default-inline
@opindex fno-default-inline
Do not assume @samp{inline} for functions defined inside a class scope.
@xref{Optimize Options,,Options That Control Optimization}.  Note that these
functions will have linkage like inline functions; they just won't be
inlined by default.

@item -Wctor-dtor-privacy (C++ only)
@opindex Wctor-dtor-privacy
Warn when a class seems unusable, because all the constructors or
destructors in a class are private and the class has no friends or
public static member functions.

@item -Wnon-virtual-dtor (C++ only)
@opindex Wnon-virtual-dtor
Warn when a class declares a non-virtual destructor that should probably
be virtual, because it looks like the class will be used polymorphically.

@item -Wreorder (C++ only)
@opindex Wreorder
@cindex reordering, warning
@cindex warning for reordering of member initializers
Warn when the order of member initializers given in the code does not
match the order in which they must be executed.  For instance:

@smallexample
struct A @{
  int i;
  int j;
  A(): j (0), i (1) @{ @}
@};
@end smallexample

Here the compiler will warn that the member initializers for @samp{i}
and @samp{j} will be rearranged to match the declaration order of the
members.
@end table

The following @option{-W@dots{}} options are not affected by @option{-Wall}.

@table @gcctabopt
@item -Weffc++ (C++ only)
@opindex Weffc++
Warn about violations of various style guidelines from Scott Meyers'
@cite{Effective C++} books.  If you use this option, you should be aware
that the standard library headers do not obey all of these guidelines;
you can use @samp{grep -v} to filter out those warnings.

@item -Wno-deprecated (C++ only)
@opindex Wno-deprecated
Do not warn about usage of deprecated features. @xref{Deprecated Features}.

@item -Wno-non-template-friend (C++ only)
@opindex Wno-non-template-friend
Disable warnings when non-templatized friend functions are declared
within a template. With the advent of explicit template specification
support in g++, if the name of the friend is an unqualified-id (i.e.,
@samp{friend foo(int)}), the C++ language specification demands that the
friend declare or define an ordinary, nontemplate function. (Section
14.5.3). Before g++ implemented explicit specification, unqualified-ids
could be interpreted as a particular specialization of a templatized
function. Because this non-conforming behavior is no longer the default
behavior for g++, @option{-Wnon-template-friend} allows the compiler to
check existing code for potential trouble spots, and is on by default.
This new compiler behavior can be turned off with
@option{-Wno-non-template-friend} which keeps the conformant compiler code
but disables the helpful warning.

@item -Wold-style-cast (C++ only)
@opindex Wold-style-cast
Warn if an old-style (C-style) cast is used within a C++ program.  The
new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and
@samp{const_cast}) are less vulnerable to unintended effects, and much
easier to grep for.

@item -Woverloaded-virtual (C++ only)
@opindex Woverloaded-virtual
@cindex overloaded virtual fn, warning
@cindex warning for overloaded virtual fn
Warn when a derived class function declaration may be an error in
defining a virtual function.  In a derived class, the
definitions of virtual functions must match the type signature of a
virtual function declared in the base class.  With this option, the
compiler warns when you define a function with the same name as a
virtual function, but with a type signature that does not match any
declarations from the base class.

@item -Wno-pmf-conversions (C++ only)
@opindex Wno-pmf-conversions
Disable the diagnostic for converting a bound pointer to member function
to a plain pointer.

@item -Wsign-promo (C++ only)
@opindex Wsign-promo
Warn when overload resolution chooses a promotion from unsigned or
enumeral type to a signed type over a conversion to an unsigned type of
the same size.  Previous versions of g++ would try to preserve
unsignedness, but the standard mandates the current behavior.

@item -Wsynth (C++ only)
@opindex Wsynth
@cindex warning for synthesized methods
@cindex synthesized methods, warning
Warn when g++'s synthesis behavior does not match that of cfront.  For
instance:

@smallexample
struct A @{
  operator int ();
  A& operator = (int);
@};

main ()
@{
  A a,b;
  a = b;
@}
@end smallexample

In this example, g++ will synthesize a default @samp{A& operator =
(const A&);}, while cfront will use the user-defined @samp{operator =}.
@end table

@node Objective-C Dialect Options
@section Options Controlling Objective-C Dialect

@cindex compiler options, Objective-C
@cindex Objective-C options, command line
@cindex options, Objective-C
This section describes the command-line options that are only meaningful
for Objective-C programs; but you can also use most of the GNU compiler
options regardless of what language your program is in.  For example,
you might compile a file @code{some_class.m} like this:

@example
gcc -g -fgnu-runtime -O -c some_class.m
@end example

@noindent
In this example, only @option{-fgnu-runtime} is an option meant only for
Objective-C programs; you can use the other options with any language
supported by GCC.

Here is a list of options that are @emph{only} for compiling Objective-C
programs:

@table @gcctabopt
@item -fconstant-string-class=@var{class-name}
@opindex fconstant-string-class
Use @var{class-name} as the name of the class to instantiate for each
literal string specified with the syntax @code{@@"@dots{}"}.  The default
class name is @code{NXConstantString}.

@item -fgnu-runtime
@opindex fgnu-runtime
Generate object code compatible with the standard GNU Objective-C
runtime.  This is the default for most types of systems.

@item -fnext-runtime
@opindex fnext-runtime
Generate output compatible with the NeXT runtime.  This is the default
for NeXT-based systems, including Darwin and Mac OS X.

@item -gen-decls
@opindex gen-decls
Dump interface declarations for all classes seen in the source file to a
file named @file{@var{sourcename}.decl}.

@item -Wno-protocol
@opindex Wno-protocol
Do not warn if methods required by a protocol are not implemented
in the class adopting it.

@item -Wselector
@opindex Wselector
Warn if a selector has multiple methods of different types defined.

@c not documented because only avail via -Wp
@c @item -print-objc-runtime-info

@end table

@node Language Independent Options
@section Options to Control Diagnostic Messages Formatting
@cindex options to control diagnostics formatting
@cindex diagnostic messages
@cindex message formatting

Traditionally, diagnostic messages have been formatted irrespective of
the output device's aspect (e.g. its width, @dots{}).  The options described
below can be used to control the diagnostic messages formatting
algor

⌨️ 快捷键说明

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