Language Options > C tab

To get to this tab, from the Builder, choose Project > Language Options for Selected Files..., and choose the C tab.

The following are descriptions of the items in the C tab.

C version (drop-down list)

K+R

For C source files, interpret the source code as the C version documented in Kernighan & Ritchie, first edition, and compatible with the portable C compiler, or PCC. Equivalent to the -k+r and -Xs C options.

Transition Mode

Selects a mode of ANSI C compatibility similar to AT&T C Issues 5.0 transition mode supporting function prototypes and the new ANSI keywords signed and volatile in a non-ANSI environment. This is the default. Equivalent to the -Xt C option.

ANSI

Sets the compiler in Permissive ANSI compatibility mode. With some systems, this uses the header files in /usr/green/include and /usr/green/ansi before those in /usr/include.

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. Equivalent to the -ansi C option.

Strict ANSI

Strict ANSI mode is 100% compliant with the ANSI X3.159-1989 standard and does not allow non-standard constructs. This also uses the header files in /usr/green/include and /usr/green/ansi before those in /usr/include. Equivalent to the -ANSI C option.

Type of wchar_t (drop-down list)

Specifies the type of wchar_t, the type of all wide-characters. This allows you to set the size of all wide characters and determine whether they are signed or unsigned. Equivalent to the -shortwchar and -signedwchar C and C++ compiler options. The type selected here has the following effects:

Only the default selection works with the libraries provided.

short

Default for SunOS 4.x.

unsigned short

int

Default for Ultrix on DEC station.

unsigned int

long

Default on UNIX System V.4, Solaris, and all embedded products.

unsigned long

Not supported for all target processors. See your target Development Guide for more information.

long long

Not supported for all target processors. See your target Development Guide for more information.

unsigned long long

Not supported for all target processors. See your target Development Guide for more information.

Target kanji (drop-down list)

Host kanji (drop-down list)

The Target kanji and Host kanji drop-down list boxes control the internal representation of kanji characters recognizable in C host code, comments, and character strings. If Host kanji > EUC and Target kanji > Shift-JIS are both selected, then the compiler automatically translates character string literals from EUC to Shift-JIS format. The combination of Host kanji > Shift JIS and Target kanji > EUC is not supported. On SunOS, Host kanji defaults to EUC. On Windows and HP/UX, Host kanji defaults to Shift-JIS. Target kanji defaults to Host kanji. Equivalent to the -kanji= command line option.

The following are descriptions of the check boxes in the C tab.

Ignore Duplicate #include

Ignores an #include directive if attempting to include a file already included. The file must appear with exactly the same name in both #include directives to ignore the second #include directive.

If a filename appears in more than one #include directive during a single compilation, it skips all of the directives except the first one. Equivalent to the -includeonce C preprocessor option.

Ignore All #include

Ignores all #include file directives. Equivalent to the -includenever C preprocessor option.

Allow Macros to be Re#defined

Suppresses the warning or error normally given when two #define directives provide different values for the same preprocessor symbol. Equivalent to the -redefine C preprocessor option.

Allow Wrong #directives inside #if 0

During preprocessing, lines inside of false #if, #elif, #ifdef, and #ifndef are ignored. With the exception that a warning or error is given for lines beginning with #, they do not contain legal preprocessor directives. This option suppresses these warnings and errors. Equivalent to the -nocpperror C and C++ preprocessor option.

Warn for Unknown #pragma

Generates a warning for unknown #pragma lines. Normally, unknown #pragmae are ignored silently. Equivalent to the -unknownpragmawarn command line option.

No Warning for Incorrect #pragma

Suppresses warnings for errors in #pragma that are recognized by the compiler and that are incorrect. Equivalent to the -nopragmawarn C and C++ preprocessor option.

Allow #pragma asm and #pragma inline

Allows the use of #pragma asm, #pragma endasm, and #pragma inline in C source files. See the Green Hills C User's Guide for more information on these pragmae. Equivalent to the -pragma_asm_inline command line option.

No Output for #ident or #pragma ident

Prevents the compiler from outputting an ident directive in the assembly language output or from placing the same information in the .comment section when generating COFF or ELF object files directly. This option is primarily intended for an assembler or linker that does not support the ident directive. Equivalent to the -noidentoutput C compiler option.

Allow // style comments in C

Allows C++ style comments (beginning with // and terminating with a new line to be used in C). This option is also used with preprocessed assembly files. Equivalent to the -slashcomment command line option.

Keep Comments in Preprocessor Output

Includes comments in the preprocessor output. The default strips comments from the output. Equivalent to the -C C and C++ preprocessor option.

Concat 2 Symbols Separated by Comment

Allows /* */ as concatenation in K&R C. You can turn off this option with the -Zconcatcomments option. Equivalent to the -concatcomments C option.

Warn for Function Used without Prototype

Generates a warning if a function is referenced or called but no prototype is given for that function. This is an extension to ANSI C, ensuring that prototypes exist for all functions used. Equivalent to the -wantprototype C compiler option.

Disallow Function Used without Prototype

Generates a fatal error if a function is referenced or called but no prototype is given for that function. This is an extension to ANSI C, ensuring that prototypes exist for all functions used. Equivalent to the -needprototype C compiler option.

Allow `noalias' keyword in C

Adds noalias keyword to C. You can turn off this option with the -Znoalias option. Equivalent to the -noalias C option.

Disable ANSI aliasing rules

Disables ANSI aliasing rules. Equivalent to the -no_ansi_alias build-time option.

No Warning for asm()

Does not give warnings for asm statements. Equivalent to the -asmwarn build-time option.

Do not reserve asm keyword

By default, the compiler recognizes asm as a keyword and gives a syntax error if any variable, structure field, macro, or function has the name asm. Selecting this option causes the compiler to treat asm as an ordinary identifier in C. Any attempt to use an asm statement with this option enabled causes the compiler to call a function asm() with a character string as its argument.

This option is implied by Strict ANSI mode. The _ _asm keyword is always recognized; only the asm directive without leading underscores is affected by this switch. This switch is enabled with -ANSI. Equivalent to the -noasm C compiler option.

Give fatal error for asm statement

Generates a fatal error if an asm statement is used. Equivalent to the -asmillegal command line option.

Allow Some Gnu Syntax Extensions

Supports GNU extensions, such as #import, zero size arrays, compound statements as part of expressions, inline functions, and the _ _inline_ _ keyword. Equivalent to the -gnu_c C compiler option.

Japanese Automotive C

Enables a set of extensions to ANSI C used by Japanese automobile manufacturers. This option implies the following option settings:

Allow #pragma asm and #pragma inline
No warning for asm()
Do not reserve asm keyword


Refer to the Green Hills C User's Guide for more information on this option. Equivalent to the -japanese_automotive_c command line option.

Allow extern to be Initialized

Allows variables declared with the extern storage class to accept initial values. In the K+R definition of C this is an error, but is legal in ANSI C. This option only affects K+R. Equivalent to the -initextern command line option.

Disallow Old Fashioned Syntax

Does not recognize outdated syntax for initializing variables, such as int i 5;, and for assignment operators like =+, =-, =*. If this option is not set, these are accepted with a warning message. If this option is set, old fashioned initializations give the error:

expected '=' got constant

and an equal sign followed by the symbols:


+ - * / % & | ^ << >>

is recognized as two separate tokens. This results in a syntax error for the symbols:


+ / % | ^ << >>

but is correct for the symbols:


- * &

which are legal unary operators in C. Therefore, this option is required to correctly compile the following lines because no space appears after the equal sign:


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

By default, this option is only set on native UNIX 68K compilers. In all other Green Hills compilers, this is turned off by default. Equivalent to the -nooldfashioned C option.

Use ANSI C Semantics for Assignment

Uses ANSI rules for ++ and *= in K&R C. Equivalent to the -ansiopeq command line option.

Allocate Small Enums as char or short

Allocates enumerated types to the smallest storage possible. Equivalent to the -shortenum C compiler option.

Consider char to be signed

Specifies type char as signed. Equivalent to the -signedchar C compiler option.

Consider Bit-fields to be Signed

Specifies a bit field whose type is signed to be interpreted as a signed quantity. Equivalent to the -signedfield C compiler option.

Consider Pointers to be Signed

Specifies pointers and addresses as signed. This is the default. Equivalent to the -signedptr C compiler option.

Truncate External Symbols to 8 characters

Truncates all symbol names to eight characters for compatibility with older compilers and linkers. Equivalent to the -T C compiler option.

Allocate unique space for all strings

Creates separate space for each string. Normally, the compiler performs an optimization in which equivalent strings are combined to share the same space. This reduces code size, but could cause problems if the strings are modified. This option disables the optimization and forces each string to have unique storage. Equivalent to the -uniquestrings C compiler option.


Previous

Next



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