File tree Expand file tree Collapse file tree
common/test/rules/nullptrnottheonlyformofthenullpointerconstant
misra/test/rules/RULE-7-0-6 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11| test.cpp:10:13:10:13 | 0 | 0 is used as the null-pointer-constant but is not nullptr. |
22| test.cpp:11:6:11:6 | 0 | 0 is used as the null-pointer-constant but is not nullptr. |
33| test.cpp:17:6:17:9 | 0 | NULL is used as the null-pointer-constant but is not nullptr. |
4- | test.cpp:18:6:18:9 | 0 | '\\0' is used as the null-pointer-constant but is not nullptr. |
Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ void test_nullptr() {
1515 int l3 = 0 ; // COMPLIANT - use of 0 literal with no conversion to pointer
1616 f3 (f1, nullptr ); // COMPLIANT - use of nullptr
1717 f1 (NULL ); // NON_COMPLIANT - use of NULL macro
18- f1 (' \0 ' ); // NON_COMPLIANT - use of octal escape 0
18+ // f1('\0'); // NON_COMPLIANT - use of octal escape 0 - Not accepted by clang or by CodeQL when mimicking clang
1919 f3 (" 0" ); // COMPLIANT - "0" is not a literal zero
20- }
20+ }
Original file line number Diff line number Diff line change 5353| test.cpp:340:12:340:13 | s8 | Assignment between incompatible numeric types from 'int8_t' to 'int32_t'. |
5454| test.cpp:342:32:342:33 | s8 | Assignment between incompatible numeric types from 'int8_t' to 'int32_t'. |
5555| test.cpp:362:25:362:27 | u32 | Assignment between incompatible numeric types from 'uint32_t' to 'unsigned long'. |
56- | test.cpp:374:19:374:25 | ... + ... | Assignment between incompatible numeric types from 'int' to 'int16_t'. |
5756| test.cpp:379:10:379:12 | u32 | Assignment between incompatible numeric types from 'uint32_t' to 'int32_t'. |
5857| test.cpp:412:8:412:9 | l6 | Assignment between incompatible numeric types from 'uint32_t &' to 'uint8_t'. |
5958| test.cpp:413:8:413:9 | l7 | Assignment between incompatible numeric types from 'int8_t &' to 'uint8_t'. |
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ std::int32_t f12(std::int8_t l1) {
371371 std::int16_t l2 = l1; // COMPLIANT
372372 std::int16_t l3{l1}; // COMPLIANT
373373 std::int16_t l4 (l1); // COMPLIANT
374- std::int16_t l5{l1 + l1}; // NON_COMPLIANT
374+ // std::int16_t l5{l1 + l1}; // NON_COMPLIANT - Not accepted by clang or by CodeQL when mimicking clang
375375 return l1; // COMPLIANT
376376}
377377
@@ -640,4 +640,4 @@ void test_explicit_casts() {
640640 // Function calls with explicit casts
641641 f1 (static_cast <std::int64_t >(l4)); // COMPLIANT
642642 f2 (static_cast <std::int32_t >(l4)); // COMPLIANT
643- }
643+ }
You can’t perform that action at this time.
0 commit comments