File tree Expand file tree Collapse file tree 4 files changed +63
-0
lines changed
cpp/common/test/deviations
deviations_report_deviated Expand file tree Collapse file tree 4 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1010| main.cpp:21:15:21:16 | d6 | Use of long double type. |
1111| main.cpp:30:15:30:17 | d10 | Use of long double type. |
1212| main.cpp:38:15:38:17 | d14 | Use of long double type. |
13+ | main.cpp:42:15:42:17 | d15 | Use of long double type. |
14+ | main.cpp:43:113:43:115 | d18 | Use of long double type. |
Original file line number Diff line number Diff line change @@ -37,5 +37,10 @@ int main(int argc, char **argv) {
3737 // codeql::autosar_deviation_end(a-0-4-2-deviation)
3838 long double d14; // NON_COMPLIANT (A0-4-2)
3939 getX (); // NON_COMPLIANT (A0-1-2)
40+
41+ // clang-format off
42+ long double d15; /* NON_COMPLIANT*/ /* codeql::autosar_deviation_begin(a-0-4-2-deviation) */ long double d16; // COMPLIANT[DEVIATED]
43+ long double d17; /* COMPLIANT[DEVIATED] */ /* codeql::autosar_deviation_end(a-0-4-2-deviation) */ long double d18; // NON_COMPLIANT
44+ // clang-format on
4045 return 0 ;
4146}
Original file line number Diff line number Diff line change 1+ | main.cpp:11:15:11:16 | d1 | Use of long double type. |
2+ | main.cpp:12:15:12:16 | d2 | Use of long double type. |
3+ | main.cpp:14:15:14:16 | d3 | Use of long double type. |
4+ | main.cpp:16:15:16:16 | d4 | Use of long double type. |
5+ | main.cpp:18:15:18:16 | d5 | Use of long double type. |
6+ | main.cpp:19:15:19:16 | d6 | Use of long double type. |
7+ | main.cpp:22:15:22:16 | d7 | Use of long double type. |
8+ | main.cpp:24:15:24:16 | d8 | Use of long double type. |
9+ | main.cpp:26:15:26:16 | d9 | Use of long double type. |
10+ | main.cpp:28:15:28:17 | d10 | Use of long double type. |
11+ | main.cpp:30:15:30:17 | d11 | Use of long double type. |
12+ | main.cpp:32:15:32:17 | d12 | Use of long double type. |
13+ | main.cpp:34:15:34:17 | d13 | Use of long double type. |
14+ | main.cpp:36:15:36:17 | d14 | Use of long double type. |
15+ | main.cpp:40:15:40:17 | d15 | Use of long double type. |
16+ | main.cpp:40:108:40:110 | d16 | Use of long double type. |
17+ | main.cpp:41:15:41:17 | d17 | Use of long double type. |
18+ | main.cpp:41:113:41:115 | d18 | Use of long double type. |
Original file line number Diff line number Diff line change 1+ /**
2+ * @id cpp/autosar/type-long-double-used
3+ * @name A0-4-2: Type long double shall not be used
4+ * @description The type long double has an implementation-defined width and therefore shall not be
5+ * used.
6+ * @kind problem
7+ * @precision very-high
8+ * @problem.severity warning
9+ * @tags external/autosar/id/a0-4-2
10+ * correctness
11+ * readability
12+ * external/autosar/allocated-target/implementation
13+ * external/autosar/enforcement/automated
14+ * external/autosar/obligation/required
15+ */
16+
17+ import cpp
18+ import codingstandards.cpp.CodingStandards
19+ import codingstandards.cpp.exclusions.cpp.RuleMetadata
20+
21+ predicate isUsingLongDouble ( ClassTemplateInstantiation c ) {
22+ c .getATemplateArgument ( ) instanceof LongDoubleType or
23+ isUsingLongDouble ( c .getATemplateArgument ( ) )
24+ }
25+
26+ from Variable v
27+ where
28+ not isExcluded ( v , BannedTypesPackage:: typeLongDoubleUsedQuery ( ) ) and
29+ (
30+ v .getUnderlyingType ( ) instanceof LongDoubleType and
31+ not v .isFromTemplateInstantiation ( _)
32+ or
33+ exists ( ClassTemplateInstantiation c |
34+ c = v .getType ( ) and
35+ isUsingLongDouble ( c )
36+ )
37+ )
38+ select v , "Use of long double type."
You can’t perform that action at this time.
0 commit comments