Skip to content

Commit fa8c05c

Browse files
committed
much typing
1 parent 8aee471 commit fa8c05c

File tree

5 files changed

+179
-82
lines changed

5 files changed

+179
-82
lines changed

c/common/src/codingstandards/c/Extensions.qll

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,24 @@ class CTerseTernaryExtension extends CCompilerExtension, ConditionalExpr {
8080

8181
// Reference: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html#g_t_005f_005fint128
8282
// Reference: https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float
83-
class CRealTypeExtensionExtension extends CCompilerExtension, RealNumberType {
83+
class CRealTypeExtensionExtension extends CCompilerExtension, DeclarationEntry {
8484
CRealTypeExtensionExtension() {
85-
this instanceof Decimal128Type or
86-
this instanceof Decimal32Type or
87-
this instanceof Decimal64Type or
88-
this instanceof Float128Type
85+
getType() instanceof Decimal128Type or
86+
getType() instanceof Decimal32Type or
87+
getType() instanceof Decimal64Type or
88+
getType() instanceof Float128Type
8989
}
9090
}
9191

9292
// Reference: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html#g_t_005f_005fint128
93-
class CIntegerTypeExtension extends CCompilerExtension, Int128Type { }
93+
class CIntegerTypeExtension extends CCompilerExtension, DeclarationEntry {
94+
CIntegerTypeExtension() { getType() instanceof Int128Type }
95+
}
96+
97+
// Reference: https://gcc.gnu.org/onlinedocs/gcc/Long-Long.html#Long-Long
98+
class CLongLongType extends CCompilerExtension, DeclarationEntry {
99+
CLongLongType() { getType() instanceof LongLongType }
100+
}
94101

95102
class CZeroLengthArraysExtension extends CCompilerExtension, DeclarationEntry {
96103
CZeroLengthArraysExtension() { getType().(ArrayType).getArraySize() = 0 }
@@ -103,5 +110,8 @@ class CEmptyStructExtension extends CCompilerExtension, Struct {
103110

104111
// Reference: https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html#Variable-Length
105112
class CVariableLengthArraysExtension extends CCompilerExtension, DeclarationEntry {
106-
CVariableLengthArraysExtension() { not getType().(ArrayType).hasArraySize() }
113+
CVariableLengthArraysExtension() {
114+
getType() instanceof ArrayType and
115+
not getType().(ArrayType).hasArraySize()
116+
}
107117
}
Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
No expected results have yet been specified
1+
| test.c:34:1:34:23 | #define A __BASE_FILE__ | Is a compiler extension and is not portable to other compilers. |
2+
| test.c:35:1:35:23 | #define B __FILE_NAME__ | Is a compiler extension and is not portable to other compilers. |
3+
| test.c:36:1:36:21 | #define C __COUNTER__ | Is a compiler extension and is not portable to other compilers. |
4+
| test.c:37:1:37:27 | #define D __INCLUDE_LEVEL__ | Is a compiler extension and is not portable to other compilers. |
5+
| test.c:39:1:39:19 | #define F __clang__ | Is a compiler extension and is not portable to other compilers. |
6+
| test.c:40:1:40:25 | #define G __clang_major__ | Is a compiler extension and is not portable to other compilers. |
7+
| test.c:41:1:41:25 | #define H __clang_minor__ | Is a compiler extension and is not portable to other compilers. |
8+
| test.c:42:1:42:30 | #define I __clang_patchlevel__ | Is a compiler extension and is not portable to other compilers. |
9+
| test.c:43:1:43:27 | #define J __clang_version__ | Is a compiler extension and is not portable to other compilers. |
10+
| test.c:44:1:44:36 | #define K __clang_literal_encoding__ | Is a compiler extension and is not portable to other compilers. |
11+
| test.c:45:1:45:41 | #define L __clang_wide_literal_encoding__ | Is a compiler extension and is not portable to other compilers. |
12+
| test.c:53:33:53:43 | vector_size | Is a compiler extension and is not portable to other compilers. |
13+
| test.c:54:33:54:47 | vector_size | Is a compiler extension and is not portable to other compilers. |
14+
| test.c:55:37:55:51 | ext_vector_type | Is a compiler extension and is not portable to other compilers. |
15+
| test.c:56:37:56:51 | ext_vector_type | Is a compiler extension and is not portable to other compilers. |
16+
| test.c:61:3:69:4 | (statement expression) | Is a compiler extension and is not portable to other compilers. |
17+
| test.c:96:3:96:18 | call to __builtin_setjmp | Is a compiler extension and is not portable to other compilers. |
18+
| test.c:97:3:97:19 | call to __builtin_longjmp | Is a compiler extension and is not portable to other compilers. |
19+
| test.c:113:11:113:16 | ... ? ... : ... | Is a compiler extension and is not portable to other compilers. |
20+
| test.c:124:12:124:12 | definition of a | Is a compiler extension and is not portable to other compilers. |
21+
| test.c:128:17:128:17 | definition of a | Is a compiler extension and is not portable to other compilers. |
22+
| test.c:165:8:165:15 | definition of contents | Is a compiler extension and is not portable to other compilers. |
23+
| test.c:182:8:182:11 | gf19 | Is a compiler extension and is not portable to other compilers. |
24+
| test.c:214:33:214:35 | declaration of out | Is a compiler extension and is not portable to other compilers. |
25+
| test.c:215:25:215:26 | declaration of in | Is a compiler extension and is not portable to other compilers. |
26+
| test.c:268:16:268:21 | access | Is a compiler extension and is not portable to other compilers. |
27+
| test.c:271:27:271:31 | alias | Is a compiler extension and is not portable to other compilers. |
28+
| test.c:274:23:274:29 | aligned | Is a compiler extension and is not portable to other compilers. |
29+
| test.c:285:25:285:34 | deprecated | Is a compiler extension and is not portable to other compilers. |
30+
| test.c:297:20:297:30 | fallthrough | Is a compiler extension and is not portable to other compilers. |
31+
| test.c:321:3:321:22 | alignof(<expr>) | Is a compiler extension and is not portable to other compilers. |
32+
| test.c:340:3:340:31 | call to __builtin_extract_return_addr | Is a compiler extension and is not portable to other compilers. |
33+
| test.c:341:3:341:28 | call to __builtin_frob_return_addr | Is a compiler extension and is not portable to other compilers. |
34+
| test.c:342:3:342:25 | call to __builtin_frame_address | Is a compiler extension and is not portable to other compilers. |
35+
| test.c:363:3:363:22 | call to __sync_fetch_and_add_4 | Is a compiler extension and is not portable to other compilers. |
36+
| test.c:364:3:364:22 | call to __sync_fetch_and_sub_4 | Is a compiler extension and is not portable to other compilers. |
37+
| test.c:365:3:365:21 | call to __sync_fetch_and_or_4 | Is a compiler extension and is not portable to other compilers. |
38+
| test.c:366:3:366:22 | call to __sync_fetch_and_and_4 | Is a compiler extension and is not portable to other compilers. |
39+
| test.c:367:3:367:22 | call to __sync_fetch_and_xor_4 | Is a compiler extension and is not portable to other compilers. |
40+
| test.c:368:3:368:23 | call to __sync_fetch_and_nand_4 | Is a compiler extension and is not portable to other compilers. |
41+
| test.c:369:3:369:22 | call to __sync_add_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
42+
| test.c:370:3:370:22 | call to __sync_sub_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
43+
| test.c:371:3:371:21 | call to __sync_or_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
44+
| test.c:372:3:372:22 | call to __sync_and_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
45+
| test.c:373:3:373:22 | call to __sync_xor_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
46+
| test.c:374:3:374:23 | call to __sync_nand_and_fetch_4 | Is a compiler extension and is not portable to other compilers. |
47+
| test.c:376:3:376:30 | call to __sync_bool_compare_and_swap_4 | Is a compiler extension and is not portable to other compilers. |
48+
| test.c:377:3:377:29 | call to __sync_val_compare_and_swap_4 | Is a compiler extension and is not portable to other compilers. |
49+
| test.c:378:3:378:26 | call to __sync_lock_test_and_set_4 | Is a compiler extension and is not portable to other compilers. |
50+
| test.c:379:3:379:21 | call to __sync_lock_release_4 | Is a compiler extension and is not portable to other compilers. |
51+
| test.c:407:3:407:18 | call to __builtin_alloca | Is a compiler extension and is not portable to other compilers. |

c/misra/test/rules/RULE-1-2/options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options:--clang -fhonor-infinity -std=c11 --edg --diag_error=implicit_func_decl -nostdinc -I../../../../common/test/includes/standard-library

0 commit comments

Comments
 (0)