-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release-automation/bump-version-to-2.27.0-dev
- Loading branch information
Showing
25 changed files
with
279 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
c/misra/test/rules/RULE-6-1/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
| test.c:6:7:6:8 | x1 | Bit-field x1 is declared on type int. | | ||
| test.c:10:15:10:16 | x5 | Bit-field x5 is declared on type signed long. | | ||
| test.c:12:15:12:16 | x6 | Bit-field x6 is declared on type signed char. | | ||
| test.c:14:14:14:15 | x7 | Bit-field x7 is declared on type Color. | | ||
| test.c:6:7:6:8 | x1 | Bit-field 'x1' is declared on type 'int'. | | ||
| test.c:10:15:10:16 | x5 | Bit-field 'x5' is declared on type 'signed long'. | | ||
| test.c:12:15:12:16 | x6 | Bit-field 'x6' is declared on type 'signed char'. | | ||
| test.c:14:14:14:15 | x7 | Bit-field 'x7' is declared on type 'Color'. | |
Empty file.
1 change: 1 addition & 0 deletions
1
c/misra/test/rules/RULE-6-1/clang/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.qlref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rules/RULE-6-1/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.ql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
semmle-extractor-options:--mimic clang --std=c11 --edg --diag_error=implicit_func_decl -nostdinc -I../../../../common/test/includes/standard-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
typedef unsigned int UINT16; | ||
|
||
enum Color { R, G, B }; | ||
|
||
struct SampleStruct { | ||
int x1 : 2; // COMPLIANT | ||
unsigned int x2 : 2; // COMPLIANT - explicitly unsigned | ||
signed int x3 : 2; // COMPLIANT - explicitly signed | ||
UINT16 x4 : 2; // COMPLIANT - type alias resolves to a compliant type | ||
signed long x5 : 2; // COMPLIANT | ||
signed char x6 : 2; // COMPLIANT | ||
enum Color x7 : 3; // COMPLIANT | ||
//_Atomic(int) x8 : 2; // NON_COMPLIANT[COMPILER_CHECKED] - atomic types are | ||
// not permitted for bit-fields. | ||
} sample_struct; |
Empty file.
1 change: 1 addition & 0 deletions
1
c/misra/test/rules/RULE-6-1/gcc/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.qlref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rules/RULE-6-1/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.ql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
semmle-extractor-options:--mimic gcc --std=c11 --edg --diag_error=implicit_func_decl -nostdinc -I../../../../common/test/includes/standard-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
typedef unsigned int UINT16; | ||
|
||
enum Color { R, G, B }; | ||
|
||
struct SampleStruct { | ||
int x1 : 2; // COMPLIANT | ||
unsigned int x2 : 2; // COMPLIANT - explicitly unsigned | ||
signed int x3 : 2; // COMPLIANT - explicitly signed | ||
UINT16 x4 : 2; // COMPLIANT - type alias resolves to a compliant type | ||
signed long x5 : 2; // COMPLIANT | ||
signed char x6 : 2; // COMPLIANT | ||
enum Color x7 : 3; // COMPLIANT | ||
//_Atomic(int) x8 : 2; // NON_COMPLIANT[COMPILER_CHECKED] - atomic types are | ||
// not permitted for bit-fields. | ||
} sample_struct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
semmle-extractor-options:--no-clang --std=c11 --edg --diag_error=implicit_func_decl -nostdinc -I../../../../common/test/includes/standard-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `A3-3-1` - `ExternalLinkageNotDeclaredInHeaderFile.ql`: | ||
- Adjust the alert message to comply with the style guide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `CTR55-CPP` - `DoNotUseAnAdditiveOperatorOnAnIterator.ql`: | ||
- Address reported FP in #374. Improve logic on valid end checks and size checks on iterators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `RULE-6-1` - `BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.ql`: | ||
- Address FP reported in #318. Add support for implementation specific bitfield types for Clang and Gcc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
| test.cpp:3:5:3:6 | definition of g1 | Externally linked object g1 not declared in header file. | | ||
| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object g2 not declared in header file. | | ||
| test.cpp:10:5:10:6 | definition of l1 | Externally linked object l1 not declared in header file. | | ||
| test.cpp:11:6:11:7 | definition of f1 | Externally linked function f1 not declared in header file. | | ||
| test.cpp:22:5:22:5 | definition of f | Externally linked function f not declared in header file. | | ||
| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function f1 not declared in header file. | | ||
| test.cpp:3:5:3:6 | definition of g1 | Externally linked object 'g1' not declared in header file. | | ||
| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object 'g2' not declared in header file. | | ||
| test.cpp:10:5:10:6 | definition of l1 | Externally linked object 'l1' not declared in header file. | | ||
| test.cpp:11:6:11:7 | definition of f1 | Externally linked function 'f1' not declared in header file. | | ||
| test.cpp:22:5:22:5 | definition of f | Externally linked function 'f' not declared in header file. | | ||
| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function 'f1' not declared in header file. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
cpp/cert/test/rules/CTR55-CPP/DoNotUseAnAdditiveOperatorOnAnIterator.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
| test.cpp:8:7:8:7 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:9:9:9:9 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:10:9:10:9 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:27:31:27:31 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:22:18:22:18 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:28:31:28:31 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:41:5:41:8 | end2 | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:53:42:53:42 | i | Increment of iterator may overflow since its bounds are not checked. | | ||
| test.cpp:64:15:64:15 | i | Increment of iterator may overflow since its bounds are not checked. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** A module to reason about the compiler used to compile translation units. */ | ||
|
||
import cpp | ||
import codingstandards.cpp.Scope | ||
|
||
newtype Compiler = | ||
Gcc() or | ||
Clang() or | ||
UnsupportedCompiler() | ||
|
||
/** Get the match pattern to detect the compiler being mimicked by the extractor to determine the compiler used to compile a file. */ | ||
string getMimicMatch(Compiler compiler) { | ||
result = ["%gcc", "%g++"] and compiler instanceof Gcc | ||
or | ||
result = ["%clang", "%clang++"] and compiler instanceof Clang | ||
} | ||
|
||
/** Get the compiler used to compile the translation unit the file `f` is part of. */ | ||
Compiler getCompiler(File f) { | ||
exists(Compilation compilation, TranslationUnit translationUnit | | ||
compilation.getAFileCompiled() = translationUnit and | ||
(f = translationUnit or f = translationUnit.getAUserFile()) | ||
| | ||
if exists(int mimicIndex | compilation.getArgument(mimicIndex) = "--mimic") | ||
then | ||
exists(int mimicIndex | | ||
compilation.getArgument(mimicIndex) = "--mimic" and | ||
( | ||
compilation.getArgument(mimicIndex + 1).matches(getMimicMatch(result)) | ||
or | ||
forall(string match | match = getMimicMatch(_) | | ||
not compilation.getArgument(mimicIndex + 1).matches(match) | ||
) and | ||
result = UnsupportedCompiler() | ||
) | ||
) | ||
else result = UnsupportedCompiler() | ||
) | ||
} |
Oops, something went wrong.