C Compiler Options

-ANSI

Sets the compiler in Strict ANSI mode. Strict ANSI mode is 100% compliant with the ANSI X3.159-1989 standard and does not allow any non-standard constructs.

-ansi

Sets the compiler in Permissive ANSI compatibility mode. This mode supports the language features of the ANSI X3.159-1989 standard, while allowing certain useful, but non-compliant, constructs in an ANSI C framework.

-column=n

Sets the length of a line for error messages and warnings to n characters. The default line length is 80. The compiler will break up errors and warnings into multiple lines, inserting a new line and tab between words. If the length of a single word (such as a filename or symbol name) exceeds the maximum line length, then that word will appear alone on a line, but will not be truncated to fit on the line. If the length is set to zero, then errors and warnings will not break into separate lines regardless of their length. Line lengths less than 40 are ignored.

-noansi

Equivalent to -Xt.

-asmwarn

Prints a warning for every asm statement encountered. This is the default.

-noasmwarn

Prevents the compiler from printing warning messages for asm statements.

-k+r

Interprets the source code as the C version documented in Kernighan & Ritchie, first edition, and compatible with the portable C compiler (PCC). See also -noansi.

-gnu_c

Supports Gnu extensions, such as #import, zero size arrays, compound statements as part of expressions, inline functions and the _ _inline_ _ keyword. This is the default in C. Ignored for C++.

-nognu_c

Does not allow Gnu C extensions. This is the default in C++. Ignored for C++.

-shortenum

Allocates enumerated types to the smallest storage possible.

-noshortenum

Does not allocate enumerated types to the smallest storage possible.[default]

-shortwchar

Specifies the size of the type wchar_t in ANSI C and C++ as 2 bytes.

-noshortwchar

Specifies the size of type wchar_t in ANSI C and C++ as 4 bytes. [default]

-signedchar

Specifies type char as signed.

-unsignedchar

Specifies type char as unsigned. [default]

-signedfield

Specifies a bit-field whose type is signed and is interpreted as a signed quantity.

-unsignedfield

Specifies all bit-fields as an unsigned quantity. This is the default. If the ANSI type declaration signed is used, then that bit-field is signed even if the program is compiled with the -unsignedfield option.

-signedwchar

Specifies type wchar_t in ANSI C and C++ as signed. [default]

-unsignedwchar

Specifies type wchar_t in ANSI C and C++ as unsigned.

-signedptr

Specifies pointers and addresses as signed.

-unsignedptr

Specifies pointers and addresses as unsigned. [default]

-T

Truncates all symbol names to eight characters for compatibility with older UNIX compilers and linkers.

-tmp=dir

Causes temporary files to be placed in the directory specified by dir instead of /tmp. This is useful if /tmp is on a small file system which might run out of disk space during compiles with inlining or template processing. On Win32, the default temporary directory is the current directory. This is also set with the TMPDIR environment variable. For example:

setenv TMPDIR /usr/tmp

-Xa

Selects Permissive ANSI compatibility mode. Equivalent to -ansi.

-Xansiopeq

Uses ANSI rules for ++ and *= in K&R C. This is turned off by the -Zansiopeq option.

-Xc

Selects Strict ANSI compatibility mode. Equivalent to -ANSI.

-Xconcatcomments

Allows /* */ as concatenation in K&R C. This option may be turned off with the -Zconcatcomments option.

-Xinitextern

Allows variables declared, with the extern storage class in a function, to accept initial values. In the K+R mode, this normally gives a warning and in ANSI C mode, it normally is illegal.

-Xjapanese_automotive_c

Enables a set of extensions to ANSI C used by Japanese automobile manufacturers. This option implies -Xpragma_asm_inline.

-Xneedprototype

Generates a fatal error if a function is referenced or called but no prototype is provided for that function. This is an extension to ANSI C and shows that the prototypes exist for all functions.

-Xwantprototype

Generates a warning if a function is referenced or called but no prototype is provided for that function. This is an extension to ANSI C and shows that the prototypes exist for all functions.

-Xnoalias

Adds noalias keyword to C. This option may be turned off with the -Znoalias option.

-Xnoasm

asm inline directive is not recognized. The _ _asm directive is recognized; only the asm directive without leading underscores is affected by this switch. This switch is enabled with -ANSI. See also -[no]asmwarn.

-Xnooldfashioned

Does not recognize old-fashioned syntax for initializing variables such as int i 5, and for assignment operators such as =+, =-,and =*. -Znooldfashioned turns off this option. If this option is not enabled when compiling in non-ansi mode, the old-fashioned syntax is accepted with a warning message. When compiling in non-ansi mode or using -Xnooldfashioned in K&R mode, old-fashioned initializations give the error:

expected: '=' got: constant

and an equal sign followed by the symbols are recognized as two separate tokens: + - * / % & | ^ << >>. This results in a syntax error for the symbols: + / % | ^ << >> but is correct for the following symbols which are legal unary operators in C: - * &.

For example when not compiling in ANSI mode, -Xnooldfashioned is required to correctly compile the following lines since no space appears after the equal sign:

int i, *p; i =-3; p =&i; i =*p;

By default, this option is disabled.

-Xpragma_asm_inline

Enables the following pragmae: #pragma asm, #pragma endasm, and #pragma inline.

-Xs

Equivalent to -k+r.

-Xslashslashcomments

Allows C++ style // comments.

-Xt

Selects a mode of ANSI C compatibility similar to AT&T C Issue 5.0 transition mode supporting function prototypes and the new ANSI keywords signed and volatile in a non-ANSI environment.

-Zansiopeq

Does not use ANSI rules for ++ and *= in K&R C. This option is turned off with the option -Xansiopeq.

-Zconcatcomments

Does not allow /* */ as concatenation in K&R C. This option is turned off with the option -Xconcatcomments.

-Znoalias

Turns off the -Xnoalias option.

-Znooldfashioned

Turns off the -Xnooldfashioned option.

Compile-Time Error Checking

These options control various forms of error checking performed during compilation.

-strict=comperr

Generates compile-time errors for division by constant zero, overflow of constant expressions, assignment of a constant to a variable where the constant value is outside the range of the variable, passing a constant to a parameter where the constant value is outside the range of the parameter, and constant array index outside of the array bounds.

-strict=compwarn

Provides warnings for unused variables, wrong pragmae, unknown pragmae, and overflow of constant expressions.

-strict

Same as -strict=compwarn plus -strict=comperr. Also performs parameter count checking.

-STRICT=COMPERR

Same as -strict=comperr, plus gives an error for any use of a function without an ANSI C prototype.

STRICT=COMPWARN

Same as -strict=compwarn, plus gives a warning for any use of a function without an ANSI C prototype.

-STRICT

Same as -strict, plus gives an error for any use of a function without an ANSI C prototype. Also performs parameter count checking.

-strict=nocompwarn

Turns off -strict=compwarn.

-STRICT=noCOMPWARN

Turns off -STRICT=COMPWARN.

-strict=nocomperr

Turns off -strict=comperr.

-STRICT=noCOMPERR

Turns off -STRICT=COMPERR.


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.