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

JSF++ Checks

The categories list for each CodeSonar warning includes any relevant "Guideline" identifiers from the Joint Strike Fighter Air Vehicle C++ Coding Standards for the System Development and Demonstration Program.

A broader set of correspondences is shown in Broad Mappings: JSF++.

CSV versions of these tables are provided in JSF++-mapping.csv.



Introduction

The categories list for each CodeSonar warning includes any relevant "Guideline" identifiers from the:

Joint Strike Fighter Air Vehicle C++ Coding Standards for the System Development and Demonstration Program
Document Number 2RDU00001 Rev C
December 2005
Copyright 2005 by Lockheed Martin Corporation

Relevant Warning Classes

The following table shows the CodeSonar warning classes that are associated with JSF++ guidelines.

A CSV version of this table is provided in JSF++-mapping.csv

JSF++ CategoryC/C++ Warning Classes
JSF++:1 Any one function (or method) will contain no more than 200 logical source lines of code (L-SLOCs). Will
JSF++:2 There shall not be any self-modifying code. Shall-
JSF++:3 All functions shall have a cyclomatic complexity number of 20 or less. Shall
JSF++:4 To break a "should" rule, the following approval must be received by the developer:
  • approval from the software engineering lead (obtained by the unit approval in the developmental CM tool)

Abbreviated form used elsewhere in this manual: "To break a "should" rule, specific approval must be received by the developer."

Shall-
JSF++:5 To break a "will" or a "shall" rule, the following approvals must be received by the developer:
  • approval from the software engineering lead (obtained by the unit approval in the developmental CM tool)
  • approval from the software product manager (obtained by the unit approval in the developmental CM tool)

Abbreviated form used elsewhere in this manual: "To break a "will" or a "shall" rule, specific approvals must be received by the developer."

Shall-
JSF++:6 Each deviation from a "shall" rule shall be documented in the file that contains the deviation. Deviations from this rule shall not be allowed, AV Rule 5 notwithstanding. Shall-
JSF++:7 Approval will not be required for a deviation from a "shall" or "will" rule that complies with an exception specified by that rule. Will-
JSF++:8 All code shall conform to ISO/IEC 14882:2002(E) standard C++. Shall-
JSF++:9 Only those characters specified in the C++ basic source character set will be used. This set includes 96 characters: the space character, the control characters representing horizontal tab, vertical tab, form feed, and newline, and the following 91 graphical characters:
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9
_ { } [ ] # ( ) < > % : ; . ? * + -
/ ^ & | ~ ! = , \ " '

Abbreviated form used elsewhere in this manual: "Only those characters specified in the C++ basic source character set will be used."

Will
JSF++:10 Values of character types will be restricted to a defined and documented subset of ISO 10646-1. Will-
JSF++:11 Trigraphs will not be used. Will
JSF++:12 The following digraphs will not be used:
Alternative Primary alternative Primary
<% { :> ]
%> } %: #
<: [ %:%: ##

Abbreviated form used elsewhere in this manual: "Certain digraphs will not be used."

Will-
JSF++:13 Multi-byte characters and wide string literals will not be used. Will
JSF++:14 Literal suffixes shall use uppercase rather than lowercase letters. Shall
JSF++:15 Provision shall be made for run-time checking (defensive programming). Shall-
JSF++:16 Only DO-178B level A certifiable or SEAL 1 C/C++ libraries shall be used with safety-critical (i.e. SEAL 1) code. Shall-
JSF++:17 The error indicator errno shall not be used. Shall
JSF++:18 The macro offsetof, in library <stddef.h>, shall not be used. Shall
JSF++:19 <locale.h> and the setlocale function shall not be used. Shall
JSF++:20 The setjmp macro and the longjmp function shall not be used. Shall
JSF++:21 The signal handling facilities of <signal.h> shall not be used. Shall
JSF++:22 The input/output library <stdio.h> shall not be used. Shall
JSF++:23 The library functions atof, atoi and atol from library <stdlib.h> shall not be used. Shall
JSF++:24 The library functions abort, exit, getenv and system from library <stdlib.h> shall not be used. Shall
JSF++:25 The time handling functions of library <time.h> shall not be used. Shall
JSF++:26 Only the following pre-processor directives shall be used:
  1. #ifndef
  2. #define
  3. #endif
  4. #include

Abbreviated form used elsewhere in this manual: "Only the following pre-processor directives shall be used: #ifndef, #define, #endif, #include."

Shall
JSF++:27 #ifndef, #define and #endif will be used to prevent multiple inclusions of the same header file. Other techniques to prevent the multiple inclusions of header files will not be used. Will-
JSF++:28 The #ifndef and #endif pre-processor directives will only be used as defined in AV Rule 27 to prevent multiple inclusions of the same header file. Will
JSF++:29 The #define pre-processor directive shall not be used to create inline macros. Inline functions shall be used instead. Shall
JSF++:30 The #define pre-processor directive shall not be used to define constant values. Instead, the const qualifier shall be applied to variable declarations to specify constant values. Shall
JSF++:31 The #define pre-processor directive will only be used as part of the technique to prevent multiple inclusions of the same header file. Will
JSF++:32 The #include pre-processor directive will only be used to include header (*.h) files. Will
JSF++:33 The #include directive shall use the <filename.h> notation to include header files. Shall
JSF++:34 Header files should contain logically related declarations only. Should-
JSF++:35 A header file will contain a mechanism that prevents multiple inclusions of itself. Will-
JSF++:36 Compilation dependencies should be minimized when possible. Should-
JSF++:37 Header (include) files should include only those header files that are required for them to successfully compile. Files that are only used by the associated .cpp file should be placed in the .cpp file-not the .h file. Should-
JSF++:38 Declarations of classes that are only accessed via pointers (*) or references (&) should be supplied by forward headers that contain only forward declarations. Should-
JSF++:39 Header files (*.h) will not contain non-const variable definitions or function definitions. Will
JSF++:40 Every implementation file shall include the header files that uniquely define the inline functions, types, and templates used. Shall
JSF++:41 Source lines will be kept to a length of 120 characters or less. Will-
JSF++:42 Each expression-statement will be on a separate line. Will
JSF++:43 Tabs should be avoided. Should-
JSF++:44 All indentations will be at least two spaces and be consistent within the same source file. Will-
JSF++:45 All words in an identifier will be separated by the '_' character. Will-
JSF++:46 User-specified identifiers (internal and external) will not rely on significance of more than 64 characters. Will
JSF++:47 Identifiers will not begin with the underscore character '_'. Will
JSF++:48 Identifiers will not differ by:
  • Only a mixture of case
  • The presence/absence of the underscore character
  • The interchange of the letter 'O', with the number '0' or the letter 'D'
  • The interchange of the letter 'I', with the number '1' or the letter 'l'
  • The interchange of the letter 'S' with the number '5'
  • The interchange of the letter 'Z' with the number 2
  • The interchange of the letter 'n' with the letter 'h'.

Abbreviated form used elsewhere in this manual: "Identifiers will not be typographically ambiguous."

Will
JSF++:49 All acronyms in an identifier will be composed of uppercase letters. Will-
JSF++:50 The first word of the name of a class, structure, namespace, enumeration, or type created with typedef will begin with an uppercase letter. All others letters will be lowercase. Will
JSF++:51 All letters contained in function and variable names will be composed entirely of lowercase letters. Will
JSF++:52 Identifiers for constant and enumerator values shall be lowercase. Shall
JSF++:53 Header files will always have a file name extension of ".h". Will-
JSF++:53.1 The following character sequences shall not appear in header file names: ', \, /*, //, or ". Shall
JSF++:54 Implementation files will always have a file name extension of ".cpp". Will-
JSF++:55 The name of a header file should reflect the logical entity for which it provides declarations. Should-
JSF++:56 The name of an implementation file should reflect the logical entity for which it provides definitions and have a ".cpp" extension (this name will normally be identical to the header file that provides the corresponding declarations.) At times, more than one .cpp file for a given logical entity will be required. In these cases, a suffix should be appended to reflect a logical differentiation.

Abbreviated form used elsewhere in this manual: "The name of an implementation file should reflect the logical entity for which it provides definitions and have a ".cpp" extension."

Should-
JSF++:57 The public, protected, and private sections of a class will be declared in that order (the public section is declared before the protected section which is declared before the private section). Will-
JSF++:58 When declaring and defining functions with more than two parameters, the leading parenthesis and the first argument will be written on the same line as the function name. Each additional argument will be written on a separate line (with the closing parenthesis directly after the last argument). Will-
JSF++:59 The statements forming the body of an if, else if, else, while, do...while or for statement shall always be enclosed in braces, even if the braces form an empty block. Shall
JSF++:60 Braces ("{}") which enclose a block will be placed in the same column, on separate lines directly before and after the block. Will-
JSF++:61 Braces ("{}") which enclose a block will have nothing else on the line except comments (if necessary). Will-
JSF++:62 The dereference operator '*' and the address-of operator '&' will be directly connected with the type-specifier. Will-
JSF++:63 Spaces will not be used around '.' or '->', nor between unary operators and operands. Will-
JSF++:64 A class interface should be complete and minimal. Should-
JSF++:65 A structure should be used to model an entity that does not require an invariant. Should-
JSF++:66 A class should be used to model an entity that maintains an invariant. Should-
JSF++:67 Public and protected data should only be used in structs-not classes. Should-
JSF++:68 Unneeded implicitly generated member functions shall be explicitly disallowed. Shall
JSF++:69 A member function that does not affect the state of an object (its instance variables) will be declared const. Will-
JSF++:70 A class will have friends only when a function or object requires access to the private elements of the class, but is unable to be a member of the class for logical or efficiency reasons. Will-
JSF++:70.1 An object shall not be improperly used before its lifetime begins or after its lifetime ends. Shall
JSF++:71 Calls to an externally visible operation of an object, other than its constructors, shall not be allowed until the object has been fully initialized. Shall
JSF++:71.1 A class's virtual functions shall not be invoked from its destructor or any of its constructors. Shall
JSF++:72 The invariant for a class should be:
  • a part of the postcondition of every class constructor,
  • a part of the precondition of the class destructor (if any),
  • a part of the precondition and postcondition of every other publicly accessible operation.

Abbreviated form used elsewhere in this manual: "The invariant for a class should be part of class member pre- and/or post-conditions as specified."

Should-
JSF++:73 Unnecessary default constructors shall not be defined. Shall-
JSF++:74 Initialization of nonstatic class members will be performed through the member initialization list rather than through assignment in the body of a constructor. Will-
JSF++:75 Members of the initialization list shall be listed in the order in which they are declared in the class. Shall
JSF++:76 A copy constructor and an assignment operator shall be declared for classes that contain pointers to data items or nontrivial destructors. Shall
JSF++:77 A copy constructor shall copy all data members and bases that affect the class invariant (a data element representing a cache, for example, would not need to be copied). Shall-
JSF++:77.1 The definition of a member function shall not contain default arguments that produce a signature identical to that of the implicitly-declared copy constructor for the corresponding class/structure. Shall
JSF++:78 All base classes with a virtual function shall define a virtual destructor. Shall
JSF++:79 All resources acquired by a class shall be released by the class's destructor. Shall
JSF++:80 The default copy and assignment operators will be used for classes when those operators offer reasonable semantics. Will
JSF++:81 The assignment operator shall handle self-assignment correctly. Shall
JSF++:82 An assignment operator shall return a reference to *this. Shall
JSF++:83 An assignment operator shall assign all data members and bases that affect the class invariant (a data element representing a cache, for example, would not need to be copied). Shall-
JSF++:84 Operator overloading will be used sparingly and in a conventional manner. Will-
JSF++:85 When two operators are opposites (such as == and !=), both will be defined and one will be defined in terms of the other. Will-
JSF++:86 Concrete types should be used to represent simple independent concepts. Should-
JSF++:87 Hierarchies should be based on abstract classes. Should-
JSF++:88 Multiple inheritance shall only be allowed in the following restricted form: n interfaces plus m private implementations, plus at most one protected implementation. Shall
JSF++:88.1 A stateful virtual base shall be explicitly declared in each derived class that accesses it. Shall
JSF++:89 A base class shall not be both virtual and non-virtual in the same hierarchy. Shall
JSF++:90 Heavily used interfaces should be minimal, general and abstract. Should-
JSF++:91 Public inheritance will be used to implement "is-a" relationships. Will-
JSF++:92 A subtype (publicly derived classes) will conform to the following guidelines with respect to all classes involved in the polymorphic assignment of different subclass instances to the same variable or parameter during the execution of the system:
  • Preconditions of derived methods must be at least as weak as the preconditions of the methods they override.
  • Postconditions of derived methods must be at least as strong as the postconditions of the methods they override.
In other words, subclass methods must expect less and deliver more than the base class methods they override. This rule implies that subtypes will conform to the Liskov Substitution Principle.

Abbreviated form used elsewhere in this manual: "Subclass methods must expect less and deliver more than the base class methods they override"

Will-
JSF++:93 "has-a" or "is-implemented-in-terms-of" relationships will be modeled through membership or non-public inheritance. Will-
JSF++:94 An inherited nonvirtual function shall not be redefined in a derived class. Shall
JSF++:95 An inherited default parameter shall never be redefined. Shall
JSF++:96 Arrays shall not be treated polymorphically. Shall
JSF++:97 Arrays shall not be used in interfaces. Instead, the Array class should be used. Shall-
JSF++:97.1 Neither operand of an equality operator (== or !=) shall be a pointer to a virtual member function. Shall
JSF++:98 Every nonlocal name, except main(), should be placed in some namespace. Should-
JSF++:99 Namespaces will not be nested more than two levels deep. Will-
JSF++:100 Elements from a namespace should be selected as follows:
  • using declaration or explicit qualification for few (approximately five) names,
  • using directive for many names.

Abbreviated form used elsewhere in this manual: "Elements from a namespace should be selected as specified."

Should-
JSF++:101 Templates shall be reviewed as follows:
  1. with respect to the template in isolation considering assumptions or requirements placed on its arguments.
  2. with respect to all functions instantiated by actual arguments.

Abbreviated form used elsewhere in this manual: "Templates shall be reviewed as specified."

Shall-
JSF++:102 Template tests shall be created to cover all actual template instantiations. Shall-
JSF++:103 Constraint checks should be applied to template arguments. Should-
JSF++:104 A template specialization shall be declared before its use. Shall
JSF++:105 A template definition's dependence on its instantiation contexts should be minimized. Should-
JSF++:106 Specializations for pointer types should be made where appropriate. Should-
JSF++:107 Functions shall always be declared at file scope. Shall
JSF++:108 Functions with variable numbers of arguments shall not be used. Shall
JSF++:109 A function definition should not be placed in a class specification unless the function is intended to be inlined. Should-
JSF++:110 Functions with more than 7 arguments will not be used. Will
JSF++:111 A function shall not return a pointer or reference to a non-static local object. Shall
JSF++:112 Function return values should not obscure resource ownership. Should-
JSF++:113 Functions will have a single exit point. Will
JSF++:114 All exit points of value-returning functions shall be through return statements. Shall
JSF++:115 If a function returns error information, then that error information will be tested. Will
JSF++:116 Small, concrete-type arguments (two or three words in size) should be passed by value if changes made to formal parameters should not be reflected in the calling function. Should-
JSF++:117 Arguments should be passed by reference if NULL values are not possible Should-
JSF++:117.1 An object should be passed as const T& if the function should not change the value of the object. Should
JSF++:117.2 An object should be passed as T& if the function may change the value of the object. Should-
JSF++:118 Arguments should be passed via pointers if NULL values are possible. Should-
JSF++:118.1 An object should be passed as const T* if its value should not be modified. Should-
JSF++:118.2 An object should be passed as T* if its value may be modified. Should-
JSF++:119 Functions shall not call themselves, either directly or indirectly (i.e. recursion shall not be allowed). Shall
JSF++:120 Overloaded operations or methods should form families that use the same semantics, share the same name, have the same purpose, and that are differentiated by formal parameters. Should-
JSF++:121 Only functions with 1 or 2 statements should be considered candidates for inline functions. Should-
JSF++:122 Trivial accessor and mutator functions should be inlined. Should-
JSF++:123 The number of accessor and mutator functions should be minimized. Should-
JSF++:124 Trivial forwarding functions should be inlined. Should-
JSF++:125 Unnecessary temporary objects should be avoided. Should-
JSF++:126 Only valid C++ style comments (//) shall be used. Shall
JSF++:127 Code that is not used (commented out) shall be deleted. Shall
JSF++:128 Comments that document actions or sources (e.g. tables, figures, paragraphs, etc.) outside of the file being documented will not be allowed. Will-
JSF++:129 Comments in header files should describe the externally visible behavior of the functions or classes being documented. Should-
JSF++:130 The purpose of every line of executable code should be explained by a comment, although one comment may describe more than one line of code. Should-
JSF++:131 One should avoid stating in comments what is better stated in code (i.e. do not simply repeat what is in the code). Should-
JSF++:132 Each variable declaration, typedef, enumeration value, and structure member will be commented. Will-
JSF++:133 Every source file will be documented with an introductory comment that provides information on the file name, its contents, and any program-required information (e.g. legal statements, copyright information, etc). Will-
JSF++:134 Assumptions (limitations) made by functions should be documented in the function's preamble. Should-
JSF++:135 Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier. Shall
JSF++:136 Declarations should be at the smallest feasible scope. Should
JSF++:137 All declarations at file scope should be static where possible. Should
JSF++:138 Identifiers shall not simultaneously have both internal and external linkage in the same translation unit. Shall-
JSF++:139 External objects will not be declared in more than one file. Will
JSF++:140 The register storage class specifier shall not be used. Shall
JSF++:141 A class, structure, or enumeration will not be declared in the definition of its type. Will-
JSF++:142 All variables shall be initialized before use. Shall
JSF++:143 Variables will not be introduced until they can be initialized with meaningful values. Will-
JSF++:144 Braces shall be used to indicate and match the structure in the non-zero initialization of arrays and structures. Shall
JSF++:145 In an enumerator list, the '=' construct shall not be used to explicitly initialize members other than the first, unless all items are explicitly initialized. Shall
JSF++:146 Floating point implementations shall comply with a defined floating point standard. The standard that will be used is the ANSI/IEEE Std 754. Shall-
JSF++:147 The underlying bit representations of floating point numbers shall not be used in any way by the programmer. Shall
JSF++:148 Enumeration types shall be used instead of integer types (and constants) to select from a limited series of choices. Shall
JSF++:149 Octal constants (other than zero) shall not be used. Shall
JSF++:150 Hexadecimal constants will be represented using all uppercase letters. Will
JSF++:151 Numeric values in code will not be used; symbolic values will be used instead. Will-
JSF++:151.1 A string literal shall not be modified. Shall
JSF++:152 Multiple variable declarations shall not be allowed on the same line. Shall
JSF++:153 Unions shall not be used. Shall
JSF++:154 Bit-fields shall have explicitly unsigned integral or enumeration types only. Shall
JSF++:155 Bit-fields will not be used to pack data into a word for the sole purpose of saving space. Will-
JSF++:156 All the members of a structure (or class) shall be named and shall only be accessed via their names. Shall
JSF++:157 The right hand operand of a && or || operator shall not contain side effects. Shall
JSF++:158 The operands of a logical && or || shall be parenthesized if the operands contain binary operators. Shall
JSF++:159 Operators ||, &&, and unary & shall not be overloaded. Shall
JSF++:160 An assignment expression shall be used only as the expression in an expression statement. Shall
JSF++:162 Signed and unsigned values shall not be mixed in arithmetic or comparison operations. Shall
JSF++:163 Unsigned arithmetic shall not be used. Shall-
JSF++:164 The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the left-hand operand (inclusive). Shall
JSF++:164.1 The left-hand operand of a right-shift operator shall not have a negative value. Shall
JSF++:165 The unary minus operator shall not be applied to an unsigned expression. Shall
JSF++:166 The sizeof operator will not be used on expressions that contain side effects. Will
JSF++:167 The implementation of integer division in the chosen compiler shall be determined, documented and taken into account. Shall-
JSF++:168 The comma operator shall not be used. Shall
JSF++:169 Pointers to pointers should be avoided when possible. Should
JSF++:170 More than 2 levels of pointer indirection shall not be used. Shall
JSF++:171 Relational operators shall not be applied to pointer types except where both operands are of the same type and point to:
  • the same object,
  • the same function,
  • members of the same object, or
  • elements of the same array (including one past the end of the same array).
Note that if either operand is null, then both shall be null. Also, "members of the same object" should not be construed to include base class subobjects.

Abbreviated form used elsewhere in this manual: "Relational operators shall not be applied to pointer types except where both operands are of the same type and point to the same entity."

Shall
JSF++:173 The address of an object with automatic storage shall not be assigned to an object which persists after the object has ceased to exist. Shall
JSF++:174 The null pointer shall not be de-referenced. Shall
JSF++:175 A pointer shall not be compared to NULL or be assigned NULL; use plain 0 instead. Shall
JSF++:176 A typedef will be used to simplify program syntax when declaring function pointers. Will-
JSF++:177 User-defined conversion functions should be avoided. Should
JSF++:178 Down casting (casting from base to derived class) shall only be allowed through one of the following mechanism:
  • Virtual functions that act like dynamic casts (most likely useful in relatively simple cases)
  • Use of the visitor (or similar) pattern (most likely useful in complicated cases)

Abbreviated form used elsewhere in this manual: "Down casting (casting from base to derived class) shall only be allowed through certain mechanisms."

Shall
JSF++:179 A pointer to a virtual base class shall not be converted to a pointer to a derived class. Shall
JSF++:180 Implicit conversions that may result in a loss of information shall not be used. Shall
JSF++:181 Redundant explicit casts will not be used. Will-
JSF++:182 Type casting from any type to or from pointers shall not be used. Shall
JSF++:183 Every possible measure should be taken to avoid type casting. Should
JSF++:184 Floating point numbers shall not be converted to integers unless such a conversion is a specified algorithmic requirement or is necessary for a hardware interface. Shall
JSF++:185 C++ style casts (const_cast, reinterpret_cast, and static_cast) shall be used instead of the traditional C-style casts. Shall
JSF++:186 There shall be no unreachable code. Shall
JSF++:187 All non-null statements shall potentially have a side-effect. Shall
JSF++:188 Labels will not be used, except in switch statements. Will-
JSF++:189 The goto statement shall not be used. Shall
JSF++:190 The continue statement shall not be used. Shall
JSF++:191 The break statement shall not be used (except to terminate the cases of a switch statement). Shall
JSF++:192 All if, else if constructs will contain either a final else clause or a comment indicating why a final else clause is not necessary. Will
JSF++:193 Every non-empty case clause in a switch statement shall be terminated with a break statement. Shall
JSF++:194 All switch statements that do not intend to test for every enumeration value shall contain a final default clause. Shall
JSF++:195 A switch expression will not represent a Boolean value. Will
JSF++:196 Every switch statement will have at least two cases and a potential default. Will
JSF++:197 Floating point variables shall not be used as loop counters. Shall
JSF++:198 The initialization expression in a for loop will perform no actions other than to initialize the value of a single for loop parameter. Note that the initialization expression may invoke an accessor that returns an initial element in a sequence:
for (Iter_type p = c.begin() ; p != c.end() ; ++p) // Good
{
...
}

Abbreviated form used elsewhere in this manual: "The initialization expression in a for loop will perform no actions other than to initialize the value of a single for loop parameter."

Will
JSF++:199 The increment expression in a for loop will perform no action other than to change a single loop parameter to the next value for the loop. Will
JSF++:200 Null initialize or increment expressions in for loops will not be used; a while loop will be used instead. Will
JSF++:201 Numeric variables being used within a for loop for iteration counting shall not be modified in the body of the loop. Shall
JSF++:202 Floating point variables shall not be tested for exact equality or inequality. Shall
JSF++:203 Evaluation of expressions shall not lead to overflow/underflow (unless required algorithmically and then should be heavily documented). Shall
JSF++:204 A single operation with side-effects shall only be used in the following contexts:
  1. by itself
  2. the right-hand side of an assignment
  3. a condition
  4. the only argument expression with a side-effect in a function call
  5. condition of a loop
  6. switch condition
  7. single part of a chained operation.

Abbreviated form used elsewhere in this manual: "A single operation with side-effects shall only be used in certain contexts."

Shall
JSF++:204.1 The value of an expression shall be the same under any order of evaluation that the standard permits. Shall
JSF++:205 The volatile keyword shall not be used unless directly interfacing with hardware. Shall
JSF++:206 Allocation/deallocation from/to the free store (heap) shall not occur after initialization. Shall
JSF++:207 Unencapsulated global data will be avoided. Will-
JSF++:208 C++ exceptions shall not be used (i.e. throw, catch and try shall not be used.) Shall
JSF++:209 The basic types of int, short, long, float and double shall not be used, but specific-length equivalents should be typedef'd accordingly for each compiler, and these type names used in the code. Shall
JSF++:210 Algorithms shall not make assumptions concerning how data is represented in memory (e.g. big endian vs. little endian, base class subobject ordering in derived classes, nonstatic data member ordering across access specifiers, etc.) Shall
JSF++:210.1 Algorithms shall not make assumptions concerning the order of allocation of nonstatic data members separated by an access specifier. Shall
JSF++:211 Algorithms shall not assume that shorts, ints, longs, floats, doubles or long doubles begin at particular addresses. Shall
JSF++:212 Underflow or overflow functioning shall not be depended on in any special way. Shall
JSF++:213 No dependence shall be placed on C++'s operator precedence rules, below arithmetic operators, in expressions. Shall
JSF++:214 Assuming that non-local static objects, in separate translation units, are initialized in a special order shall not be done. Shall
JSF++:215 Pointer arithmetic will not be used. Will
JSF++:216 Programmers should not attempt to prematurely optimize code. Should-
JSF++:217 Compile-time and link-time errors should be preferred over run-time errors. Should-
JSF++:218 Compiler warning levels will be set in compliance with project policies. Will
JSF++:219 All tests applied to a base class interface shall be applied to all derived class interfaces as well. If the derived class poses stronger postconditions/invariants, then the new postconditions /invariants shall be substituted in the derived class tests. Shall-
JSF++:220 Structural coverage algorithms shall be applied against flattened classes. Shall-
JSF++:221 Structural coverage of a class within an inheritance hierarchy containing virtual functions shall include testing every possible resolution for each set of identical polymorphic references. Shall-

Enabling JSF++ Checks

CodeSonar ships with two taxonomy presets for JSF++ checks:

jsf++ Enables warning classes for C++ compilation units. A given class C is enabled if all of the following are true.
  • C is closely mapped to one or more JSF++ guidelines (that is, it appears in the table above), and
  • no other classes enabled by the preset are more closely related to the same rules, and
  • C is not diagnostic-only (that is, it does not have a DIAG.* mnemonic).
jsf++_inc Enables warning classes in C++ compilation units. A given class is enabled if it meets all the requirements listed for jsf++ and is supported in incremental analysis.

You can apply the jsf++ preset to the CodeSonar build/analysis as shown in the following table.

Command Line Specify -preset jsf++ as part of your build/analysis command. For example:
codesonar analyze MyProj -preset jsf++ localhost:7340 make
Define as a default preset Copy jsf++.conf from $CSONAR/codesonar/presets/ to $CSONAR/codesonar/default_presets/.
OR
Use the CodeSonar Configuration Tool Modify Analysis Settings option.
Windows Build Wizard Select jsf++ from the Preset list on screen 2.
Eclipse Plug-In Select jsf++ from the Presets list in the Properties dialog.
Visual Studio Plug-In Select jsf++ from the Presets list in the Project Properties dialog.

Use the same techniques to apply the jsf++_inc preset.

Enabling Individual Classes

To enable an individual warning class, follow the instructions in the warning class documentation page (linked in the table above). The requirements will depend on the class: some classes only require a WARNING_FILTER allow rule, but others require additional settings in order to work correctly.

 

To report problems with this documentation, please visit https://support.codesecure.com/.