Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
CPARSER(1)		FreeBSD	General	Commands Manual		    CPARSER(1)

     cparser --	C compiler

     cparser [-c | -S |	-E | --print-ast] [--print-implicit-cast]
	     [--print-parenthesis] [-ansi] [-std=standard] [--[no-]gcc]
	     [--[no-]ms] [-g] [-Olevel]	[-W[no-][error=]warning] [-w] [-I dir]
	     [-L dir] [-Dmacro[=defn]] [-Umacro] [-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 warn-
     ings 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 file-
	     name is the input filename	with the extension replaced by .s.

     -E	     Preprocess	the input file only.  By default the result is output
	     to	stdout.

	     Output the	abstract syntax	tree of	the parsed input file as C

	     When using	--print-ast, show casts, which are inserted by the se-
	     mantic checks.

	     When using	--print-ast, show all expressions fully	parenthesized.

     -ansi   Same as -std=c90 (for C) or -std=c++98 (for C++).

	     Select the	language standard.  Supported values are:
	     iso9899:1990  ISO C90
	     gnu89	   ISO C90 with	GCC extensions
	     iso9899:1999  ISO C99
	     gnu99	   ISO C99 with	GCC extensions
	     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

	     Disable/enable GCC	extensions.  This switch supersedes -std.

	     Disable/enable MSC	extensions.

     -g	     When compiling C files, add debug information in stabs format.

	     Select the	optimization level.  Sensible values are between 0 and
	     4,	inclusive.

	     Enable the	specified warning.

	     Disable the specified warning.

	     Enable the	specified warning and turn it into an error.

	     Force the specified warning to only be a warning, even in the
	     presence of -Werror.  This	neither	enables	nor disables the warn-
	     ing itself.

	     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.

	     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.

	     Warn whenever a pointer cast removes qualifiers from the pointed-
	     to	type, e.g. casting a const char* to char*.

	     Warn about	using an expression of type char as array subscript,
	     e.g. char c; arr[c].

	     Warn about	mixing declarations and	statements, which is not al-
	     lowed prior to C99.

	     Warn about	compile-time integer division by zero.

	     Warn about	empty statements, i.e. statements which	only consist
	     of	a single `;'.  Use {} as replacement to	avoid this warning.

	     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.

	     Immediately abort compilation when	encountering an	error.

	     Check format strings of char and wchar_t functions.

	     Activate -Wimplicit-function-declaration, -Wimplicit-int.

	     Warn about	calling	a function without a prior declaration.

	     Warn about	declarations whose declaration specifiers do not in-
	     clude a type specifier.

	     Warn about	uninitialized variables	which are initialized with

	     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**).

	     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.

	     Warn about	functions, which are candidates	for the	attribute

	     Warn if a global function is defined without a previous prototype

	     Warn if a multicharacter constant (`FOOF')	is used.

	     Warn if an	`extern' declaration is	encountered within a function.

	     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 oper-
	     and of << or >>, e.g. x + y << z.

	     Warn about	redundant declarations,	i.e. multiple declarations of
	     the same object or	static forward declarations which have no use
	     before their definition.

	     Warn when a new declaration shadows another declaration with the
	     same name in an outer scope.

	     Like -Wshadow, but	only warn if the shadowed declaration is not
	     global, e.g. a local variable shadows a parameter or another lo-
	     cal variable.

	     Warn when the compiler determines that a statement	(or in some
	     cases a part thereof) will	never be executed.

	     Activate -Wunused-function, -Wunused-label, -Wunused-parameter,
	     -Wunused-value, -Wunused-variable.

	     Warn when a parameter is never used or only ever read to calcu-
	     late 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.

     -w	     Suppress all warnings.

     -I	dir  Add the directory dir to the paths	to be searched for include

     -L	dir  Add the directory dir to the paths	to be searched for libraries.

	     Define the	preprocessor macro macro which will expand to 1.

	     Define the	preprocessor macro macro and set its expanded value to

	     Undefine the preprocessor macro macro.

     -f	option
	     Set a frontend or optimizer option.  Use -fhelp to	get a list of
	     supported optimizer options.

	     Show the switch, which controls a warning,	after each warning.
	     Default is	on.

	     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.

	     Show the column number in diagnostic messages.

	     Define `char' to have the same range, representation and behav-
	     iour as `signed char'.

	     Define `char' to have the same range, representation and behav-
	     iour as `unsigned char'.

     -b	option
	     Set a backend option.  Use	-bhelp to get a	list of	supported op-

     -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 prepro-
	     c-header		 C file
	     c++-header		 C++ file
	     none		 Revert	to auto-detection

	     Pass option to the	linker.

	     Pass option to the	preprocessor.


     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 <>, Christoph
     Mallon <> and Michael Beck.

				 July 9, 2012


Want to link to this manual page? Use this URL:

home | help