X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=cparser.1;h=87dedd2d2e6d0a028cc867a577ddc226edd47601;hb=b61f7ce7016548248bab93843c2f3fe37a0cab78;hp=7f82286a988ff5cbcedbd51581b2b90c228b60da;hpb=33e7411a4293b6e7f6c689ae0d7e04c056633927;p=cparser diff --git a/cparser.1 b/cparser.1 index 7f82286..87dedd2 100644 --- a/cparser.1 +++ b/cparser.1 @@ -1,5 +1,5 @@ .\" Please adjust this date whenever revising the manpage. -.Dd November 29, 2008 +.Dd June 21, 2011 .Dt CPARSER 1 .Sh NAME .Nm cparser @@ -7,22 +7,27 @@ .Sh SYNOPSIS .Nm .Op Fl c | S | E | -print-ast +.Op Fl -print-implicit-cast +.Op Fl -print-parenthesis .Op Fl std= Ns Ar standard .Op Fl - Ns Oo Cm no- Oc Ns Cm gcc .Op Fl - Ns Oo Cm no- Oc Ns Cm ms .Op Fl g .Op Fl O Ns Ar level -.Op Fl W Ns Oo Cm no- Oc Ns Ar warn +.Op Fl W Ns Oo Cm no- Oc Ns Oo Cm error= Oc Ns Ar warning .Op Fl w .Op Fl I Ar dir .Op Fl L Ar dir .Op Fl D Ns Ar macro Ns Op Ar =defn .Op Fl U Ns Ar macro .Op Fl f Ar option +.Op Fl finput-charset= Ns Ar encoding .Op Fl b Ar option .Op Fl l Ar library .Op Fl o Ar outfile .Op Fl x Ar language +.Op Fl Wl, Ns Ar option +.Op Fl Wp, Ns Ar option .Ar .Sh DESCRIPTION .Nm @@ -43,6 +48,14 @@ Preprocess the input file only. By default the result is output to stdout. .It Fl -print-ast Output the abstract syntax tree of the parsed input file as C again. +.It Fl -print-implicit-cast +When using +.Fl -print-ast , +show casts, which are inserted by the semantic checks. +.It Fl -print-parenthesis +When using +.Fl -print-ast , +show all expressions fully parenthesized. .It Fl std= Ns Ar standard Select the language standard. Supported values are: @@ -78,14 +91,21 @@ format. .\" TODO expand Select the optimization level. Sensible values are between 0 and 4, inclusive. -.It Fl W Ns Oo Cm no- Oc Ns Ar warn .\" TODO expand -Disable/enable a specific warning. -Every warning option has a corresponding -.Cm no- -switch to deactivate it. +.It Fl W Ns Ar warning +Enable the specified warning. +.It Fl Wno- Ns Ar warning +Disable the specified warning. +.It Fl Werror= Ns Ar warning +Enable the specified warning and turn it into an error. +.It Fl Wno-error= Ns Ar warning +Force the specified warning to only be a warning, even in the presence of +.Fl Werror . +This neither enables nor disables the warning itself. .It Fl Waddress Warn about suspicious use of addresses, like using the address of a function or variable as boolean condition or comparing with the address of a string literal. +.It Fl Waggregate-return +Warn about defining or calling a function, which returns a struct or union by value. .It Fl Wall Activate most warnings. In particular these are @@ -100,10 +120,11 @@ In particular these are .Fl Winit-self , .Fl Wmain , .Fl Wnonnull , +.Fl Wparentheses , .Fl Wpointer-arith , .Fl Wredundant-decls , .Fl Wreturn-type , -.Fl Wshadow , +.Fl Wshadow-local , .Fl Wsign-compare , .Fl Wstrict-prototypes , .Fl Wswitch-enum , @@ -114,19 +135,31 @@ In particular these are .Fl Wunused-parameter , .Fl Wunused-value , .Fl Wunused-variable . +.It Fl Wcast-qual +Warn whenever a pointer cast removes qualifiers from the pointed-to type, e.g. casting a const char* to char*. +.It Fl Wchar-subscripts +Warn about using an expression of type char as array subscript, e.g. char\ c; arr[c]. .It Fl Wdeclaration-after-statement Warn about mixing declarations and statements, which is not allowed prior to C99. +.It Fl Wdiv-by-zero +Warn about compile-time integer division by zero. .It Fl Wempty-statement -Warn about empty statements, i.e. statements which only consist of a single ';'. +Warn about empty statements, i.e. statements which only consist of a single +.Sq \&; . Use {} as replacement to avoid this warning. .It Fl Werror -Treat warnings as errors, i.e. abort compilation when a warning is encountered. +Treat warnings as errors, i.e. do not continue after parsing when a warning is encountered. .It Fl Wextra +(Alias +.Fl W Ns ) Activate some more warnings. In particular these are .Fl Wempty-statement , +.Fl Wshadow , .Fl Wunused-parameter , .Fl Wunused-value . +.It Fl Wfatal-errors +Immediately abort compilation when encountering an error. .It Fl Wformat Check format strings of char and wchar_t functions. .It Fl Wimplicit @@ -137,8 +170,51 @@ Activate Warn about calling a function without a prior declaration. .It Fl Wimplicit-int Warn about declarations whose declaration specifiers do not include a type specifier. +.It Fl Winit-self +Warn about uninitialized variables which are initialized with themselves. +.It Fl Wlong-long +Warn if the type +.Sq long long +is used. +.It Fl Wmain +Warn if the type of +.Sq main +is suspicious, i.e. if it is not a non-static function declared as either int\ main(void), int\ main(int,\ char**) or, as an extension, int\ main(int,\ char**,\ char**). +.It Fl Wmissing-declarations +Warn if a non-static function or a global variable without a storage class is defined without a prior declaration. +This is typically a sign of a missing #include or that the object should be static. +.It Fl Wmissing-noreturn +Warn about functions, which are candidates for the attribute +.Sq noreturn . +.It Fl Wmissing-prototypes +Warn if a global function is defined without a previous prototype declaration. +.It Fl Wmultichar +Warn if a multicharacter constant +.Pf ( Sq FOOF ) +is used. +.It Fl Wnested-externs +Warn if an +.Sq extern +declaration is encountered within a function. +.It Fl Wparentheses +Warn if parentheses are omitted in certain contexts. +Warn if an assignment is used as condition, e.g. if\ (x\ =\ 23). +Warn if && without parentheses is used within ||, e.g. if\ (x\ ||\ y\ &&\ z). +Warn if it there may be confusion which +.Sq if Ns +-statement an +.Sq else Ns +-branch belongs to, e.g. if\ (x)\ if\ (y)\ {}\ else\ {}. +Warn if cascaded comparisons appear which do not have their mathematical meaning, e.g. if\ (23\ <=\ x\ <\ 42). +Warn if + or - is used as operand of << or >>, e.g. x\ +\ y\ <<\ z. .It Fl Wredundant-decls Warn about redundant declarations, i.e. multiple declarations of the same object or static forward declarations which have no use before their definition. +.It Fl Wshadow +Warn when a new declaration shadows another declaration with the same name in an outer scope. +.It Fl Wshadow-local +Like +.Fl Wshadow , +but only warn if the shadowed declaration is not global, e.g. a local variable shadows a parameter or another local variable. .It Fl Wunreachable-code Warn when the compiler determines that a statement (or in some cases a part thereof) will never be executed. .It Fl Wunused @@ -149,9 +225,9 @@ Activate .Fl Wunused-value , .Fl Wunused-variable . .It Fl Wunused-parameter -Warn when a parameter is never used or only ever read to calculate its own new value, e.g. x = x + 1. +Warn when a parameter is never used or only ever read to calculate its own new value, e.g. x\ =\ x\ +\ 1. .It Fl Wunused-variable -Warn when a variable is never used or only ever read to calculate its own new value, e.g. x = x + 1. +Warn when a variable is never used or only ever read to calculate its own new value, e.g. x\ =\ x\ +\ 1. .It Fl w Suppress all warnings. .It Fl I Ar dir @@ -179,6 +255,51 @@ Set a frontend or optimizer option. Use .Fl fhelp to get a list of supported optimizer options. +.It Fl f Ns Oo Cm no- Oc Ns Cm diagnostics-show-option +Show the switch, which controls a warning, after each warning. +Default is on. +.It Fl finput-charset= Ns Ar encoding +Select the encoding of the input. +Supported values are +.Cm ISO_8859-1:1987 +(aliases +.Cm CP819 , +.Cm IBM819 , +.Cm ISO-8859-1 , +.Cm ISO8859-1 , +.Cm ISO_8859-1 , +.Cm csISOLatin1 , +.Cm iso-ir-100 , +.Cm l1 +and +.Cm latin1 Ns +), +.Cm ISO-8859-15 +(aliases +.Cm ISO8859-15 , +.Cm ISO_8859-15 +and +.Cm Latin-9 Ns +), +.Cm windows-1252 +(alias +.Cm cp1252 Ns +) and +.Cm UTF-8 +(default). +Case is ignored. +.It Fl f Ns Oo Cm no- Oc Ns Cm show-column +Show the column number in diagnostic messages. +.It Fl fsigned-char +Define +.Sq char +to have the same range, representation and behaviour as +.Sq signed char . +.It Fl funsigned-char +Define +.Sq char +to have the same range, representation and behaviour as +.Sq unsigned char . .It Fl b Ar option Set a backend option. Use @@ -210,6 +331,14 @@ C++ file .It Cm none Revert to auto-detection .El +.It Fl Wl, Ns Ar option +Pass +.Ar option +to the linker. +.It Fl Wp, Ns Ar option +Pass +.Ar option +to the preprocessor. .El .Sh SEE ALSO .Xr gcc 1 , @@ -219,6 +348,8 @@ Probably many - if you hit one, please report it. .Pp .Nm needs to support more switches for better GCC compatibility. +.Pp +This manual page is incomplete. .Sh AUTHORS .An -nosplit .Nm