JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
The categories list for each CodeSonar warning includes any relevant JPL rule numbers.
A broader set of correspondences is shown in Broad Mapping: JPL.
CSV tables of warning classes by JPL rule are provided in JPL-mapping.csv.
The phrase "JPL Rules" is shorthand for JPL Institutional Coding Standard for the C Programming Language [*]. There is some overlap with The Power of Ten Rules.
The following table shows the CodeSonar warning classes that are associated with JPL rules.
| JPL | C/C++ Warning Classes |
|---|---|
| JPL:1 Do not stray outside the language definition. | |
| JPL:2 Compile with all warnings enabled; use static source code analyzers. | |
| JPL:3 Use verifiable loop bounds for all loops meant to be terminating. | |
| JPL:4 Do not use direct or indirect recursion. | |
| JPL:5 Do not use dynamic memory allocation after task initialization. | |
| JPL:6 Use IPC messages for task communication. | - |
| JPL:7 Do not use task delays for task synchronization. | |
| JPL:8 Explicitly transfer write-permission (ownership) for shared data objects. | - |
| JPL:9 Place restrictions on the use of semaphores and locks. | |
| JPL:10 Use memory protection, safety margins, barrier patterns. | - |
| JPL:11 Do not use goto, setjmp or longjmp. | |
| JPL:12 Do not use selective value assignments to elements of an enum list. | |
| JPL:13 Declare data objects at smallest possible level of scope. | |
| JPL:14 Check the return value of non-void functions, or explicitly cast to (void). | |
| JPL:15 Check the validity of values passed to functions. | |
| JPL:16 Use static and dynamic assertions as sanity checks. | |
| JPL:17 Use U32, I16, etc instead of predefined C data types such as int, short, etc. | |
| JPL:18 Make the order of evaluation in compound expressions explicit. | |
| JPL:19 Do not use expressions with side effects. |
|
| JPL:20 Make only very limited use of the C pre-processor. |
|
| JPL:21 Do not define macros within a function or a block. | |
| JPL:22 Do not undefine or redefine macros. | |
| JPL:23 Place #else, #elif, and #endif in the same file as the matching #if or #ifdef. | |
| JPL:24 Place no more than one statement or declaration per line of text. | |
| JPL:25 Use short functions with a limited number of parameters. | |
| JPL:26 Use no more than two levels of indirection per declaration. | |
| JPL:27 Use no more than two levels of dereferencing per object reference. | |
| JPL:28 Do not hide dereference operations inside macros or typedefs. | |
| JPL:29 Do not use non-constant function pointers. | - |
| JPL:30 Do not cast function pointers into other types. | |
| JPL:31 Do not place code or declarations before an #include directive. |
Because the rules are extremely strict, most of the associated checks are disabled by default.
CodeSonar ships with a taxonomy preset for JPL checks:
| jpl |
Enables warning classes such that a given class C is
enabled if all of the following are true.
|
You can apply the jpl preset to the CodeSonar build/analysis as shown in the following table.
| Command Line |
Specify -preset jpl as part of your
build/analysis command. For example:
codesonar analyze MyProj -preset jpl localhost:7340 make
|
|---|---|
| Define as a default preset | Copy jpl.conf from $CSONAR/codesonar/presets/ to $CSONAR/codesonar/default_presets/. OR Use the CodeSonar Configuration Tool Modify Analysis Settings option. |
| Windows Build Wizard | Select jpl from the Preset list on screen 2. |
| Eclipse Plug-In | Select jpl from the Presets list in the Properties dialog. |
| Visual Studio Plug-In | Select jpl from the Presets list in the Project Properties dialog. |
To enable checks for all the warning classes associated with a specific JPL rule, include the following in the project configuration file:
WARNING_FILTER += allow categories:"JPL:num" RETAIN_UNNORMALIZED_C_AST = yes
To enable a single warning class check, follow the instructions in the documentation for the corresponding warning class. Warning class documentation links are provided above.
[*] http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_ext.pdf
To report problems with this documentation, please visit https://support.codesecure.com/.