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

📄 invoke.texi

📁 早期freebsd实现
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@itemize @bullet@cindex @code{longjmp} warnings@itemA nonvolatile automatic variable might be changed by a call to@code{longjmp}.  These warnings as well are possible only inoptimizing compilation.The compiler sees only the calls to @code{setjmp}.  It cannot knowwhere @code{longjmp} will be called; in fact, a signal handler couldcall it at any point in the code.  As a result, you may get a warningeven when there is in fact no problem because @code{longjmp} cannotin fact be called at the place which would cause a problem.@itemA function can return either with or without a value.  (Fallingoff the end of the function body is considered returning withouta value.)  For example, this function would evoke such awarning:@examplefoo (a)@{  if (a > 0)    return a;@}@end example@itemAn expression-statement contains no side effects.@itemAn unsigned value is compared against zero with @samp{>} or @samp{<=}.@itemA comparison like @samp{x<=y<=z} appears; this is equivalent to@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation fromthat of ordinary mathematical notation.@itemStorage-class specifiers like @code{static} are not the first things ina declaration.  According to the C Standard, this usage is obsolescent.@itemAn aggregate has a partly bracketed initializer.For example, the following code would evoke such a warning,because braces are missing around the initializer for @code{x.h}:@examplestruct s @{ int f, g; @};struct t @{ struct s h; int i; @};struct t x = @{ 1, 2, 3 @};@end example@end itemize@item -Wenum-clashWarn about conversion between different enumeration types (C++ only).@item -WimplicitWarn whenever a function or parameter is implicitly declared.@item -Wreturn-typeWarn whenever a function is defined with a return-type that defaultsto @code{int}.  Also warn about any @code{return} statement with noreturn-value in a function whose return-type is not @code{void}.@item -WunusedWarn whenever a local variable is unused aside from its declaration,whenever a function is declared static but never defined, and whenevera statement computes a result that is explicitly not used.If you want to prevent a warning for a particular variable, you can usethis macro:@example#define USE(var) \  static void * use_##var = (&use_##var, (void *) &var)USE (string);@end example@item -WswitchWarn whenever a @code{switch} statement has an index of enumeral typeand lacks a @code{case} for one or more of the named codes of thatenumeration.  (The presence of a @code{default} label prevents thiswarning.)  @code{case} labels outside the enumeration range alsoprovoke warnings when this option is used.@item -WcommentWarn whenever a comment-start sequence @samp{/*} appears in a comment.@item -WtrigraphsWarn if any trigraphs are encountered (assuming they are enabled).@item -WformatCheck calls to @code{printf} and @code{scanf}, etc., to make sure thatthe arguments supplied have types appropriate to the format stringspecified.@item -Wchar-subscriptsWarn if an array subscript has type @code{char}.  This is a common causeof error, as programmers often forget that this type is signed on somemachines.@item -WuninitializedAn automatic variable is used without first being initialized.These warnings are possible only in optimizing compilation,because they require data flow information that is computed onlywhen optimizing.  If you don't specify @samp{-O}, you simply won'tget these warnings.These warnings occur only for variables that are candidates forregister allocation.  Therefore, they do not occur for a variable thatis declared @code{volatile}, or whose address is taken, or whose sizeis other than 1, 2, 4 or 8 bytes.  Also, they do not occur forstructures, unions or arrays, even when they are in registers.Note that there may be no warning about a variable that is used onlyto compute a value that itself is never used, because suchcomputations may be deleted by data flow analysis before the warningsare printed.These warnings are made optional because GNU CC is not smartenough to see all the reasons why the code might be correctdespite appearing to have an error.  Here is one example of howthis can happen:@example@{  int x;  switch (y)    @{    case 1: x = 1;      break;    case 2: x = 4;      break;    case 3: x = 5;    @}  foo (x);@}@end example@noindentIf the value of @code{y} is always 1, 2 or 3, then @code{x} isalways initialized, but GNU CC doesn't know this.  Here isanother common case:@example@{  int save_y;  if (change_y) save_y = y, y = new_y;  @dots{}  if (change_y) y = save_y;@}@end example@noindentThis has no bug because @code{save_y} is used only if it is set.Some spurious warnings can be avoided if you declare as@code{volatile} all the functions you use that never return.@xref{Function Attributes}.@item -WparenthesesWarn if parentheses are omitted in certain contexts.@item -WallAll of the above @samp{-W} options combined.  These are all theoptions which pertain to usage that we recommend avoiding and that webelieve is easy to avoid, even in conjunction with macros.@end tableThe remaining @samp{-W@dots{}} options are not implied by @samp{-Wall}because they warn about constructions that we consider reasonable touse, on occasion, in clean programs.@table @code@item -WtraditionalWarn about certain constructs that behave differently in traditional andANSI C.@itemize @bullet@itemMacro arguments occurring within string constants in the macro body.These would substitute the argument in traditional C, but are part ofthe constant in ANSI C.@itemA function declared external in one block and then used after the end ofthe block.@itemA @code{switch} statement has an operand of type @code{long}.@end itemize@item -WshadowWarn whenever a local variable shadows another local variable.@item -Wid-clash-@var{len}Warn whenever two distinct identifiers match in the first @var{len}characters.  This may help you prepare a program that will compilewith certain obsolete, brain-damaged compilers.@item -Wpointer-arithWarn about anything that depends on the ``size of'' a function type orof @code{void}.  GNU C assigns these types a size of 1, forconvenience in calculations with @code{void *} pointers and pointersto functions.@item -Wcast-qualWarn whenever a pointer is cast so as to remove a type qualifier fromthe target type.  For example, warn if a @code{const char *} is castto an ordinary @code{char *}.@item -Wcast-alignWarn whenever a pointer is cast such that the required alignment of thetarget is increased.  For example, warn if a @code{char *} is cast toan @code{int *} on machines where integers can only be accessed attwo- or four-byte boundaries.@item -Wwrite-stringsGive string constants the type @code{const char[@var{length}]} so thatcopying the address of one into a non-@code{const} @code{char *}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 @code{const} indeclarations and prototypes.  Otherwise, it will just be a nuisance;this is why we did not make @samp{-Wall} request these warnings.@item -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.@item -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.)@item -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.)@item -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.@item -Wredundant-declsWarn if anything is declared more than once in the same scope, even incases where multiple declaration is valid and changes nothing.@item -Wnested-externsWarn if an @code{extern} declaration is encountered within an function.@item -WinlineWarn if a function can not be inlined, and either it was declared as inline,or else the @samp{-finline-functions} option was given.@item -WerrorMake all warnings into errors.@end table@node Debugging Options@section Options for Debugging Your Program or GNU CC@cindex options, debugging@cindex debugging information optionsGNU CC has various special options that are used for debuggingeither your program or GCC:@table @code@item -gProduce debugging information in the operating system's native format(stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugginginformation.On most systems that use stabs format, @samp{-g} enables use of extradebugging information that only GDB can use; this extra informationmakes debugging work better in GDB but will probably make other debuggerscrash orrefuse to read the program.  If you want to control for certain whetherto generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},@samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf+}, or @samp{-gdwarf}(see below).Unlike most other C compilers, GNU CC allows you to use @samp{-g} with@samp{-O}.  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 generated with thecapability for more than one debugging format.@item -ggdbProduce debugging information in the native format (if that is supported),including GDB extensions if at all possible.@item -gstabsProduce debugging information in stabs format (if that is supported),without GDB extensions.  This is the format used by DBX on most BSDsystems.@item -gstabs+Produce debugging information in stabs format (if that is supported),using GNU extensions understood only by the GNU debugger (GDB).  Theuse of these extensions is likely to make other debuggers crash orrefuse to read the program.@item -gcoffProduce debugging information in COFF format (if that is supported).This is the format used by SDB on most System V systems prior toSystem V Release 4.@item -gxcoffProduce debugging information in XCOFF format (if that is supported).This is the format used by the DBX debugger on IBM RS/6000 systems.@item -gxcoff+Produce debugging information in XCOFF format (if that is supported),using GNU extensions understood only by the GNU debugger (GDB).  Theuse of these extensions is likely to make other debuggers crash orrefuse to read the program.@item -gdwarfProduce debugging information in DWARF format (if that is supported).This is the format used by SDB on most System V Release 4 systems.@item -gdwarf+Produce debugging information in DWARF format (if that is supported),using GNU extensions understood only by the GNU debugger (GDB).  Theuse of these extensions is likely to make other debuggers crash orrefuse to read the program.

⌨️ 快捷键说明

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