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

📄 gcc.hlp

📁 gcc帮助文档!对linux c/c++开发大有帮助!
💻 HLP
📖 第 1 页 / 共 5 页
字号:
	   cialization of a templatized function.  Because this non-conforming	   behavior is no longer the default behavior for G++, -Wnon-tem-	   plate-friend allows the compiler to check existing code for poten-	   tial trouble spots, and is on by default.  This new compiler behav-	   ior can be turned off with -Wno-non-template-friend which keeps the	   conformant compiler code but disables the helpful warning.       -Wold-style-cast (C++ only)	   Warn if an old-style (C-style) cast to a non-void type is used	   within a C++ program.  The new-style casts (static_cast, reinter-	   pret_cast, and const_cast) are less vulnerable to unintended	   effects, and much easier to grep for.       -Woverloaded-virtual (C++ only)	   Warn when a function declaration hides virtual functions from a	   base class.	For example, in:		   struct A {		     virtual void f();		   };		   struct B: public A {		     void f(int);		   };	   the "A" class version of "f" is hidden in "B", and code like this:		   B* b;		   b->f();	   will fail to compile.       -Wno-pmf-conversions (C++ only)	   Disable the diagnostic for converting a bound pointer to member	   function to a plain pointer.       -Wsign-promo (C++ only)	   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 pre-	   serve unsignedness, but the standard mandates the current behavior.       -Wsynth (C++ only)	   Warn when G++'s synthesis behavior does not match that of cfront.	   For instance:		   struct A {		     operator int ();		     A& operator = (int);		   };		   main ()		   {		     A a,b;		     a = b;		   }	   In this example, G++ will synthesize a default A& operator = (const	   A&);, while cfront will use the user-defined operator =.       Options Controlling Objective-C Dialect       This section describes the command-line options that are only meaning-       ful for Objective-C programs; but you can also use most of the GNU com-       piler options regardless of what language your program is in.  For       example, you might compile a file "some_class.m" like this:	       gcc -g -fgnu-runtime -O -c some_class.m       In this example, only -fgnu-runtime is an option meant only for Objec-       tive-C programs; you can use the other options with any language sup-       ported by GCC.       Here is a list of options that are only for compiling Objective-C pro-       grams:       -fconstant-string-class=class-name	   Use class-name as the name of the class to instantiate for each	   literal string specified with the syntax "@"..."".  The default	   class name is "NXConstantString".       -fgnu-runtime	   Generate object code compatible with the standard GNU Objective-C	   runtime.  This is the default for most types of systems.       -fnext-runtime	   Generate output compatible with the NeXT runtime.  This is the	   default for NeXT-based systems, including Darwin and Mac OS X.       -gen-decls	   Dump interface declarations for all classes seen in the source file	   to a file named sourcename.decl.       -Wno-protocol	   Do not warn if methods required by a protocol are not implemented	   in the class adopting it.       -Wselector	   Warn if a selector has multiple methods of different types defined.       Options to Control Diagnostic Messages Formatting       Traditionally, diagnostic messages have been formatted irrespective of       the output device's aspect (e.g. its width, ...).  The options       described below can be used to control the diagnostic messages format-       ting algorithm, e.g. how many characters per line, how often source       location information should be reported.	 Right now, only the C++ front       end can honor these options.  However it is expected, in the near       future, that the remaining front ends would be able to digest them cor-       rectly.       -fmessage-length=n	   Try to format error messages so that they fit on lines of about n	   characters.	The default is 72 characters for g++ and 0 for the	   rest of the front ends supported by GCC.  If n is zero, then no	   line-wrapping will be done; each error message will appear on a	   single line.       -fdiagnostics-show-location=once	   Only meaningful in line-wrapping mode.  Instructs the diagnostic	   messages reporter to emit once source location information; that	   is, in case the message is too long to fit on a single physical	   line and has to be wrapped, the source location won't be emitted	   (as prefix) again, over and over, in subsequent continuation lines.	   This is the default behavior.       -fdiagnostics-show-location=every-line	   Only meaningful in line-wrapping mode.  Instructs the diagnostic	   messages reporter to emit the same source location information (as	   prefix) for physical lines that result from the process of breaking	   a message which is too long to fit on a single line.       Options to Request or Suppress Warnings       Warnings are diagnostic messages that report constructions which are       not inherently erroneous but which are risky or suggest there may have       been an error.       You can request many specific warnings with options beginning -W, for       example -Wimplicit to request warnings on implicit declarations.	 Each       of these specific warning options also has a negative form beginning       -Wno- to turn off warnings; for example, -Wno-implicit.	This manual       lists only one of the two forms, whichever is not the default.       The following options control the amount and kinds of warnings produced       by GCC; for further, language-specific options also refer to @ref{C++       Dialect Options} and @ref{Objective-C Dialect Options}.       -fsyntax-only	   Check the code for syntax errors, but don't do anything beyond	   that.       -pedantic	   Issue all the warnings demanded by strict ISO C and ISO C++; reject	   all programs that use forbidden extensions, and some other programs	   that do not follow ISO C and ISO C++.  For ISO C, follows the ver-	   sion of the ISO C standard specified by any -std option used.	   Valid ISO C and ISO C++ programs should compile properly with or	   without this option (though a rare few will require -ansi or a -std	   option specifying the required version of ISO C).  However, without	   this option, certain GNU extensions and traditional C and C++ fea-	   tures are supported as well.	 With this option, they are rejected.	   -pedantic does not cause warning messages for use of the alternate	   keywords whose names begin and end with __.	Pedantic warnings are	   also disabled in the expression that follows "__extension__".  How-	   ever, only system header files should use these escape routes;	   application programs should avoid them.	   Some users try to use -pedantic to check programs for strict ISO C	   conformance.	 They soon find that it does not do quite what they	   want: it finds some non-ISO practices, but not all---only those for	   which ISO C requires a diagnostic, and some others for which diag-	   nostics have been added.	   A feature to report any failure to conform to ISO C might be useful	   in some instances, but would require considerable additional work	   and would be quite different from -pedantic.	 We don't have plans	   to support such a feature in the near future.	   Where the standard specified with -std represents a GNU extended	   dialect of C, such as gnu89 or gnu99, there is a corresponding base	   standard, the version of ISO C on which the GNU extended dialect is	   based.  Warnings from -pedantic are given where they are required	   by the base standard.  (It would not make sense for such warnings	   to be given only for features not in the specified GNU C dialect,	   since by definition the GNU dialects of C include all features the	   compiler supports with the given option, and there would be nothing	   to warn about.)       -pedantic-errors	   Like -pedantic, except that errors are produced rather than warn-	   ings.       -w  Inhibit all warning messages.       -Wno-import	   Inhibit warning messages about the use of #import.       -Wchar-subscripts	   Warn if an array subscript has type "char".	This is a common cause	   of error, as programmers often forget that this type is signed on	   some machines.       -Wcomment	   Warn whenever a comment-start sequence /* appears in a /* comment,	   or whenever a Backslash-Newline appears in a // comment.       -Wformat	   Check calls to "printf" and "scanf", etc., to make sure that the	   arguments supplied have types appropriate to the format string	   specified, and that the conversions specified in the format string	   make sense.	This includes standard functions, and others specified	   by format attributes, in the "printf", "scanf", "strftime" and	   "strfmon" (an X/Open extension, not in the C standard) families.	   The formats are checked against the format features supported by	   GNU libc version 2.2.  These include all ISO C89 and C99 features,	   as well as features from the Single Unix Specification and some BSD	   and GNU extensions.	Other library implementations may not support	   all these features; GCC does not support warning about features	   that go beyond a particular library's limitations.  However, if	   -pedantic is used with -Wformat, warnings will be given about for-	   mat features not in the selected standard version (but not for	   "strfmon" formats, since those are not in any version of the C	   standard).	   -Wformat is included in -Wall.  For more control over some aspects	   of format checking, the options -Wno-format-y2k, -Wno-for-	   mat-extra-args, -Wformat-nonliteral, -Wformat-security and -Wfor-	   mat=2 are available, but are not included in -Wall.       -Wno-format-y2k	   If -Wformat is specified, do not warn about "strftime" formats	   which may yield only a two-digit year.       -Wno-format-extra-args	   If -Wformat is specified, do not warn about excess arguments to a	   "printf" or "scanf" format function.	 The C standard specifies that	   such arguments are ignored.	   Where the unused arguments lie between used arguments that are	   specified with $ operand number specifications, normally warnings	   are still given, since the implementation could not know what type	   to pass to "va_arg" to skip the unused arguments.  However, in the	   case of "scanf" formats, this option will suppress the warning if	   the unused arguments are all pointers, since the Single Unix Speci-	   fication says that such unused arguments are allowed.       -Wformat-nonliteral	   If -Wformat is specified, also warn if the format string is not a	   string literal and so cannot be checked, unless the format function	   takes its format arguments as a "va_list".       -Wformat-security	   If -Wformat is specified, also warn about uses of format functions	   that represent possible security problems.  At present, this warns	   about calls to "printf" and "scanf" functions where the format	   string is not a string literal and there are no format arguments,	   as in "printf (foo);".  This may be a security hole if the format	   string came from untrusted input and contains %n.  (This is cur-	   rently a subset of what -Wformat-nonliteral warns about, but in	   future warnings may be added to -Wformat-security that are not	   included in -Wformat-nonliteral.)       -Wformat=2	   Enable -Wformat plus format checks not included in -Wformat.	 Cur-	   rently equivalent to -Wformat -Wformat-nonliteral -Wformat-secu-	   rity.       -Wimplicit-int	   Warn when a declaration does not specify a type.       -Wimplicit-function-declaration       -Werror-implicit-function-declaration	   Give a warning (or error) whenever a function is used before being	   declared.       -Wimplicit	   Same as -Wimplicit-int and -Wimplicit-function-declaration.       -Wmain	   Warn if the type of main is suspicious.  main should be a function	   with external linkage, returning int, taking either zero arguments,	   two, or three arguments of appropriate types.       -Wmissing-braces	   Warn if an aggregate or union initializer is not fully bracketed.	   In the following example, the initializer for a is not fully brack-	   eted, but that for b is fully bracketed.		   int a[2][2] = { 0, 1, 2, 3 };		   int b[2][2] = { { 0, 1 }, { 2, 3 } };       -Wparentheses	   Warn if parentheses are omitted in certain contexts, such as when	   there is an assignment in a context where a truth value is	   expected, or when operators are nested whose precedence people	   often get confused about.	   Also warn about constructions where there may be confusion to which	   "if" statement an "else" branch belongs.  Here is an example of	   such a case:		   {		     if (a)		       if (b)			

⌨️ 快捷键说明

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