Skip to content

Commit 20b5bf6

Browse files
fix build failures
1 parent 8ef8017 commit 20b5bf6

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

cpp/common/src/codingstandards/cpp/Extensions.qll

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import cpp
22

3+
/**
4+
* Common base class for modeling compiler extensions.
5+
*/
6+
abstract class CompilerExtension extends Locatable { }
7+
38
/**
49
* A usage of a compiler extension in C++ code, such as non-standard attributes or built-in function
510
* calls.
611
*/
7-
abstract class CPPCompilerExtension extends Locatable {
12+
abstract class CPPCompilerExtension extends CompilerExtension {
813
abstract string getMessage();
914
}
1015

@@ -27,8 +32,8 @@ class CPPAttributeExtension extends CPPCompilerExtension, Attribute {
2732
/**
2833
* A `StdAttribute` within a compiler specific namespace such as `[[gnu::weak]]`.
2934
*/
30-
class CppNamespacedStdAttributeExtension extends CPPCompilerExtension, StdAttribute {
31-
CppNamespacedStdAttributeExtension() { exists(this.getNamespace()) and not getNamespace() = "" }
35+
class CPPNamespacedStdAttributeExtension extends CPPCompilerExtension, StdAttribute {
36+
CPPNamespacedStdAttributeExtension() { exists(this.getNamespace()) and not getNamespace() = "" }
3237

3338
override string getMessage() {
3439
result =
@@ -41,11 +46,11 @@ class CppNamespacedStdAttributeExtension extends CPPCompilerExtension, StdAttrib
4146
* A `StdAttribute` with a name not recognized as part of the C++17 standard.
4247
*
4348
* Only the listed names are valid C++17. Namespaced attributes are handled by
44-
* `CppNamespacedStdAttributeExtension` and not considered here.
49+
* `CPPNamespacedStdAttributeExtension` and not considered here.
4550
*/
46-
class CppUnrecognizedAttributeExtension extends CPPCompilerExtension, StdAttribute {
47-
CppUnrecognizedAttributeExtension() {
48-
not this instanceof CppNamespacedStdAttributeExtension and
51+
class CPPUnrecognizedAttributeExtension extends CPPCompilerExtension, StdAttribute {
52+
CPPUnrecognizedAttributeExtension() {
53+
not this instanceof CPPNamespacedStdAttributeExtension and
4954
not getName() in [
5055
"maybe_unused", "nodiscard", "noreturn", "deprecated", "carries_dependency", "fallthrough"
5156
]

cpp/misra/test/rules/RULE-4-1-1/test.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ typedef int t2 __attribute__((vector_size(16))); // NON_COMPLIANT
7474
#warning "This is a warning" // NON_COMPLIANT
7575
// clang-format off
7676
# warning "preceeding spaces is common" // NON_COMPLIANT
77-
// clang-format on
77+
// clang-format on
78+
79+
const int g5 = 5;
80+
void f12(int p0, int p1[10], int p2[], int p3[g5]) { // COMPLIANT -- not VLAs.
81+
int l0[p0]; // NON_COMPLIANT -- VLA
82+
}

0 commit comments

Comments
 (0)