Skip to content

Commit e33289f

Browse files
Improved messaging
1 parent 634f4b3 commit e33289f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class CPPExtensionTypeUsage extends CPPCompilerExtension, DeclarationEntry {
137137

138138
override string getMessage() {
139139
result =
140-
"Declaration '" + getName() + "' uses type '" + extendedType.getName() +
141-
"' which is a compiler extension and is not portable to other compilers."
140+
"Declaration of variable '" + getName() + "' as type '" + extendedType.getName() +
141+
"' requires a compiler extension and is not portable to other compilers."
142142
}
143143
}
144144

@@ -158,8 +158,9 @@ class CPPZeroLengthArraysExtension extends CPPCompilerExtension, DeclarationEntr
158158

159159
override string getMessage() {
160160
result =
161-
"Variable '" + getName() + "' is declared with a zero-length array (of '" +
162-
array.getBaseType() + "') is a compiler extension and are not portable to other compilers."
161+
"Declaration of variable '" + getName() + "' as a zero-length array (of '" +
162+
array.getBaseType() +
163+
"') requires a compiler extension and is not portable to other compilers."
163164
}
164165
}
165166

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
| test.cpp:24:3:24:22 | __is_same | Use of built-in operation '__is_same' is a compiler extension. |
1212
| test.cpp:30:3:33:4 | (statement expression) | Statement expressions are a compiler extension and are not portable to other compilers. |
1313
| test.cpp:34:3:34:12 | ... ? ... : ... | Ternaries with omitted middle operands are a compiler extension and are not portable to other compilers. |
14-
| test.cpp:36:12:36:13 | definition of l0 | Declaration 'l0' uses type '__int128' which is a compiler extension and is not portable to other compilers. |
14+
| test.cpp:36:12:36:13 | definition of l0 | Declaration of variable 'l0' as type '__int128' requires a compiler extension and is not portable to other compilers. |
1515
| test.cpp:45:20:45:30 | fallthrough | Use of attribute 'fallthrough' is a compiler extension and is not portable to other compilers. |
1616
| test.cpp:47:7:47:22 | fallthrough | Use of attribute 'fallthrough' in namespace 'gnu' is a compiler extension and is not portable to other compilers. |
1717
| test.cpp:55:3:55:29 | __builtin_va_start | Use of built-in operation '__builtin_va_start' is a compiler extension. |
18-
| test.cpp:60:7:60:8 | definition of m1 | Variable 'm1' is declared with a zero-length array (of 'int') is a compiler extension and are not portable to other compilers. |
18+
| test.cpp:60:7:60:8 | definition of m1 | Declaration of variable 'm1' as a zero-length array (of 'int') requires a compiler extension and is not portable to other compilers. |
1919
| test.cpp:64:31:64:41 | vector_size | Use of attribute 'vector_size' is a compiler extension and is not portable to other compilers. |
2020
| test.cpp:66:1:66:20 | #ifdef __has_builtin | Call to builtin preprocessor feature '__has_builtin' is a compiler extension and is not portable to other compilers. |
2121
| test.cpp:72:1:72:12 | #pragma once | Use of non-standard preprocessor directive '#pragma once' is a compiler extension. |

0 commit comments

Comments
 (0)