Fix Polyspace Compilation Errors Related to
#error Directive
Issue
The analysis stops with a message containing a #error directive.
For instance, the following message appears: #error
directive: !Unsupported platform; stopping!.
Cause
You typically use the #error directive in
your code to trigger a fatal error in case certain macros are not
defined. Your compiler implicitly defines the macros, therefore the
error is not triggered when you compile your code. However, the default Polyspace® compilation
does not consider the macros as defined, therefore, the error occurs.
For instance, in the following example, the #error directive
is reached only if the macros __BORLANDC__, __VISUALC32__ or __GNUC__ are
not defined. If you use a GNU® C compiler, for instance, the compiler
considers the macro __GNUC__ as defined and the
error does not occur. However, if you use the default Polyspace compilation,
it does not consider the macros as defined.
#if defined(__BORLANDC__) || defined(__VISUALC32__) #define MYINT int #elif defined(__GNUC__) #define MYINT long #else #error !Unsupported platform; stopping! #endif
Solution
For successful compilation, do one of the following:
Specify a compiler such as
visual12.0orgnu4.9. Specifying a compiler defines some of the compilation flags for the analysis.For more information, see
Compiler (-compiler).If the available compiler options do not match your compiler, explicitly define one of the compilation flags
__BORLANDC__,__VISUALC32__, or__GNUC__.For more information, see
Preprocessor definitions (-D).