-c-version)Specify C language standard followed in source code
Specify the C language standard that you follow in your source code.
User interface (desktop products only): In your project configuration, the option is on the Target & Compiler node. See Dependencies for other options that you must enable.
Command line and options file: Use the option
-c-version. See Command-Line Information.
Use this option so that Polyspace® can allow features specific to a C standard version during
compilation. For instance, if you compile with GCC using the flag
-ansi or -std=c90, specify
c90 for this option. If you are not sure of the
language standard, specify defined-by-compiler.
For instance, suppose you use the boolean data type _Bool in
your code. This type is defined in the C99 standard but unknown in prior standards
such as C90. If the Polyspace compilation follows the C90 standard, you can see compilation
errors.
Some MISRA C® rules are different based on whether you use the C90 or C99 standard. For instance, MISRA C C:2012 Rule 5.2 requires that identifiers in the same scope and name space shall be distinct. If you use the C90 standard, different identifiers that have the same first 31 characters violate this rule. If you use the C99 standard, the number of characters increase to 63.
Default:
defined-by-compiler
defined-by-compilerThe analysis uses a standard based on your specification for Compiler (-compiler).
c90The analysis uses the C90 Standard (ISO®/IEC 9899:1990).
c99The analysis uses the C99 Standard (ISO/IEC 9899:1999).
c11The analysis uses the C11 Standard (ISO/IEC 9899:2011).
This option is available only if you set Source code language (-lang) to C or
C-CPP.
If you create a project or options file from your build system using the
polyspace-configure command or
polyspaceConfigure function, the value of this option is
automatically determined from your build system.
If the build system uses different standards for different files, the
subsequent Polyspace analysis can emulate your build system and use different standards
for compiling those files. If you open such a project in the Polyspace user interface, the option value is shown as
defined-by-compiler. However, instead of one
standard, Polyspace uses the hidden option -options-for-sources to associate different standards with
different files.
Parameter:
-c-version |
Value: defined-by-compiler |
c90 | c99 |
c11 |
Default:
defined-by-compiler |
Example (Bug Finder):
polyspace-bug-finder -lang c -sources
|
Example (Code Prover):
polyspace-code-prover -lang c -sources
|
Example (Bug Finder
Server):
polyspace-bug-finder-server -lang c
-sources |
Example (Code Prover
Server):
polyspace-code-prover-server -lang c
-sources |