-Xcheck


This option checks the compatibility of a C source file.

[Specification format]

-Xcheck=comp

 

-

Interpretation when omitted

The compatibility of a C source file is not checked.

[Detailed description]

-

This option checks the C source file coded for the compiler specified as comp. It checks for option specifications and source code that will impact compatibility when compiled with this compiler, and outputs warnings or errors about any impacts found.

-

The items that can be specified as comp are shown below.
An error will occur if any other item is specified.

shc

Checks the C source file that has been coded for the SH compiler.

 

-

An error will occur if comp is omitted.

-

The main check items are shown below.

-

Options: -Xbit_order=pos

The settings which are not defined in the language specification and depend on implementation differ in each compiler.

Confirm the selections of the options which were output in the message.

-

Extended functions: #pragma section, #pragma entry#pragma stacksize, #pragma address, #pragma global_register

There is a possibility that extended specifications will affect program operation.

Confirm the descriptions on the extended specifications which were output in the message.

-

volatile qualified variables

The sizes of reads and writes may differ between compilers.

This compiler may access bit fields with a volatile decorator as a smaller size than the declared type, but the SH compiler will access them as the size of the declared type.

-

Integer promotion of binary operations

The result of binary operation (such as addition, subtraction, multiplication, division, or comparison) using unsigned int-type and long-type operands may differ from that obtained by using the SH compiler.

The SH compiler calculates this operation in signed long if the -strict_ansi option is not specified.

This compiler calculates this operation after converting the operands to the unsigned int type.

-

Types of integer constants exceeding type signed long

The SH compiler makes values in the range that can be expressed as type unsigned long into type signed long long.

This compiler makes values in the range that can be expressed as type unsigned long into type unsigned long.

-

Bit field allocation

The SH compiler does not allocate bits to contiguous areas when the type of a bit field differs from that of the previous bit field.

This compiler may allocate bits to contiguous areas according to the -Xpack option setting.

-

No message will be output for structure and bit field member allocation.
See "4.1.6 Internal representation and value area of data" about declarations that take assignment into account.

[Example of use]

-

To check the C source file that has been coded for the SH compiler, describe as:

>ccrh -Xcheck=shc -Xcommon=rh850 main.c