-enum-type-definition)Specify how to represent an enum with a base
type
Allow the analysis to use different base types to represent an enumerated type,
depending on the enumerator values and the selected definition. When using this option,
each enum type is represented by the smallest integral type that can
hold its enumeration values.
This option is available on the Target & Compiler node in the Configuration pane.
User interface (desktop products only): In your project configuration, the option is on the Target & Compiler node.
Command line and options file: Use the option
-enum-type-definition. See Command-Line Information.
Your compiler represents enum variables as constants of a base
integer type. Use this option so that you can emulate your compiler.
To check your compiler settings:
Compile this code using the compiler settings that you typically use:
enum { MAXSIGNEDBYTE=127 } mysmallenum_t;
int dummy[(int)sizeof(mysmallenum_t) - (int)sizeof(int)];
auto-signed-first or
auto-unsigned-first.Compile this code using the compiler settings that you typically use:
#include <limits.h>
enum { MYINTMAX = INT_MAX } myintenum_t;
int dummy[(MYINTMAX + 1) < 0 ? -1:1];
If compilation fails, use auto-signed-first
for this option, otherwise use
auto-unsigned-first.
Default:
defined-by-compiler
defined-by-compilerUses the signed integer type for all compilers except gnu, clang and tasking.
For the gnu and clang compilers, it uses the first type that can hold
all of the enumerator values from this list:
unsigned int, signed int,
unsigned long, signed long,
unsigned long long and signed long
long.
For the tasking compiler, it uses the first type that can hold
all of the enumerator values from this list:
char, unsigned char,
short, unsigned short,
int, and unsigned int.
auto-signed-firstUses the first type that can hold all of
the enumerator values from this list: signed char,
unsigned char, signed short,
unsigned short, signed int,
unsigned int, signed long,
unsigned long, signed long long,
and unsigned long long.
auto-unsigned-firstUses the first type that can hold all of the enumerator values from these lists:
If enumerator values are positive: unsigned
char, unsigned short,
unsigned int, unsigned
long, and unsigned long long.
If one or more enumerator values are negative: signed
char, signed short, signed
int, signed long, and
signed long long.
Parameter:
-enum-type-definition |
Value:
defined-by-compiler | auto-signed-first |
auto-unsigned-first |
Default:
defined-by-compiler |
Example (Bug Finder):
polyspace-bug-finder -enum-type-definition
auto-signed-first |
Example (Code Prover):
polyspace-code-prover -enum-type-definition
auto-signed-first |
Example (Bug Finder Server): polyspace-bug-finder-server -enum-type-definition auto-signed-first |
Example (Code Prover Server):
polyspace-code-prover-server -enum-type-definition
auto-signed-first |