|
|
| |
CPARSER(1) |
FreeBSD General Commands Manual |
CPARSER(1) |
cparser |
[-c | -S |
-E | --print-ast ]
[--print-implicit-cast ]
[--print-parenthesis ]
[-ansi ]
[-std= standard]
[-- [no- ]gcc ]
[-- [no- ]ms ]
[-g ]
[-O level]
[-W [no- ][error= ]warning]
[-w ] [-I
dir] [-L
dir]
[-D macro[=defn]]
[-U macro]
[-f option]
[-finput-charset= encoding]
[-b option]
[-l library]
[-o outfile]
[-x language]
[-Wl, option]
[-Wp, option]
file ... |
cparser is a C compiler, which can parse C90 and C99 as
well as many GCC and some MSC extensions. It also provides many useful
analyses for warnings and generates concise messages in case of error. It uses
libFIRM for optimization and code generation. The compiler driver is largely
compatible with GCC.
-c
- Compile the input files to object files. The default output filename is
the input filename with the extension replaced by .o.
-S
- Compile the input files to assembler. The default output filename is the
input filename with the extension replaced by .s.
-E
- Preprocess the input file only. By default the result is output to
stdout.
--print-ast
- Output the abstract syntax tree of the parsed input file as C again.
--print-implicit-cast
- When using
--print-ast , show casts, which are
inserted by the semantic checks.
--print-parenthesis
- When using
--print-ast , show all expressions fully
parenthesized.
-ansi
- Same as -std=c90 (for C) or -std=c++98 (for C++).
-std= standard
- Select the language standard. Supported values are:
c89
-
c90
-
iso9899:1990
- ISO C90
gnu89
- ISO C90 with GCC extensions
c99
-
iso9899:1999
- ISO C99
gnu99
- ISO C99 with GCC extensions
c11
-
iso9899:2011
- ISO C11
gnu11
- ISO C11 with GCC extensions
c++98
- ISO C++ 1998. Not supported yet.
gnu++98
- ISO C++ 1998 with GCC extensions. Not supported yet.
-- [no- ]gcc
- Disable/enable GCC extensions. This switch supersedes
-std .
-- [no- ]ms
- Disable/enable MSC extensions.
-g
- When compiling C files, add debug information in stabs format.
-O level
- Select the optimization level. Sensible values are between 0 and 4,
inclusive.
-W warning
- Enable the specified warning.
-Wno- warning
- Disable the specified warning.
-Werror= warning
- Enable the specified warning and turn it into an error.
-Wno-error= warning
- Force the specified warning to only be a warning, even in the presence of
-Werror . This neither enables nor disables the
warning itself.
-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.
-Waggregate-return
- Warn about defining or calling a function, which returns a struct or union
by value.
-Wall
- Activate most warnings. In particular these are
-Waddress , -Wattribute ,
-Wchar-subscripts ,
-Wcomment ,
-Wempty-statement ,
-Wformat ,
-Wimplicit-function-declaration ,
-Wimplicit-int ,
-Winit-self , -Wmain ,
-Wnonnull , -Wparentheses ,
-Wpointer-arith ,
-Wredundant-decls ,
-Wreturn-type ,
-Wshadow-local ,
-Wsign-compare ,
-Wstrict-prototypes ,
-Wswitch-enum ,
-Wunknown-pragmas ,
-Wunreachable-code ,
-Wunused-function ,
-Wunused-label ,
-Wunused-parameter ,
-Wunused-value ,
-Wunused-variable .
-Wcast-qual
- Warn whenever a pointer cast removes qualifiers from the pointed-to type,
e.g. casting a const char* to char*.
-Wchar-subscripts
- Warn about using an expression of type char as array subscript, e.g.
char c; arr[c].
-Wdeclaration-after-statement
- Warn about mixing declarations and statements, which is not allowed prior
to C99.
-Wdiv-by-zero
- Warn about compile-time integer division by zero.
-Wempty-statement
- Warn about empty statements, i.e. statements which only consist of a
single ‘;’. Use {} as replacement to avoid this
warning.
-Werror
- Treat warnings as errors, i.e. do not continue after parsing when a
warning is encountered.
- (Alias
-W ) Activate some more warnings. In
particular these are -Wempty-statement ,
-Wshadow ,
-Wunused-parameter ,
-Wunused-value .
-Wfatal-errors
- Immediately abort compilation when encountering an error.
-Wformat
- Check format strings of char and wchar_t functions.
-Wimplicit
- Activate
-Wimplicit-function-declaration ,
-Wimplicit-int .
-Wimplicit-function-declaration
- Warn about calling a function without a prior declaration.
-Wimplicit-int
- Warn about declarations whose declaration specifiers do not include a type
specifier.
-Winit-self
- Warn about uninitialized variables which are initialized with
themselves.
-Wlong-long
- Warn if the type ‘long long’ is used.
-Wmain
- Warn if the type of ‘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**).
-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.
-Wmissing-noreturn
- Warn about functions, which are candidates for the attribute
‘noreturn’.
-Wmissing-prototypes
- Warn if a global function is defined without a previous prototype
declaration.
-Wmultichar
- Warn if a multicharacter constant (‘FOOF’) is used.
-Wnested-externs
- Warn if an ‘extern’ declaration is encountered within a
function.
-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 ‘if’-statement an
‘else’-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.
-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.
-Wshadow
- Warn when a new declaration shadows another declaration with the same name
in an outer scope.
-Wshadow-local
- Like
-Wshadow , but only warn if the shadowed
declaration is not global, e.g. a local variable shadows a parameter or
another local variable.
-Wunreachable-code
- Warn when the compiler determines that a statement (or in some cases a
part thereof) will never be executed.
-Wunused
- Activate
-Wunused-function ,
-Wunused-label ,
-Wunused-parameter ,
-Wunused-value ,
-Wunused-variable .
-Wunused-parameter
- Warn when a parameter is never used or only ever read to calculate its own
new value, e.g. x = x + 1.
-Wunused-variable
- Warn when a variable is never used or only ever read to calculate its own
new value, e.g. x = x + 1.
-w
- Suppress all warnings.
-I
dir
- Add the directory dir to the paths to be searched
for include files.
-L
dir
- Add the directory dir to the paths to be searched
for libraries.
-D macro
- Define the preprocessor macro macro which will
expand to 1.
-D macro=defn
- Define the preprocessor macro macro and set its
expanded value to defn.
-U macro
- Undefine the preprocessor macro macro.
-f
option
- Set a frontend or optimizer option. Use
-fhelp to
get a list of supported optimizer options.
-f [no- ]diagnostics-show-option
- Show the switch, which controls a warning, after each warning. Default is
on.
-finput-charset= encoding
- Select the encoding of the input. Supported values are
ISO_8859-1:1987 (aliases
CP819 , IBM819 ,
ISO-8859-1 , ISO8859-1 ,
ISO_8859-1 , csISOLatin1 ,
iso-ir-100 , l1 and
latin1 ), ISO-8859-15
(aliases ISO8859-15 ,
ISO_8859-15 and Latin-9 ),
windows-1252 (alias
cp1252 ) and UTF-8
(default). Case is ignored.
-f [no- ]show-column
- Show the column number in diagnostic messages.
-fsigned-char
- Define ‘char’ to have the same range, representation and
behaviour as ‘signed char’.
-funsigned-char
- Define ‘char’ to have the same range, representation and
behaviour as ‘unsigned char’.
-b
option
- Set a backend option. Use
-bhelp to get a list of
supported options.
-l
library
- Link with the specified library.
-o
outfile
- Specify the output filename. This is only valid when using a single input
filename.
- as filename uses stdout for
output.
-x
language
- Overwrite the language auto-detection for the following filenames by the
specified language. Supported values are:
assembler
- Assembler file
assembler-with-cpp
- Assembler file, which needs to be preprocessed
c
-
- C file
c++
-
- C++ file
none
- Revert to auto-detection
-Wl, option
- Pass option to the linker.
-Wp, option
- Pass option to the preprocessor.
gcc(1),
http://www.libfirm.org/
Probably many - if you hit one, please report it.
cparser needs to support more switches for
better GCC compatibility.
This manual page is incomplete.
cparser was written by Matthias
Braun ⟨matze@braunis.de⟩, Christoph
Mallon ⟨christoph.mallon@gmx.de⟩ and
Michael Beck.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |