Skip to content

Commit cc72321

Browse files
authored
Merge branch 'main' into rp/pre32-c-650
2 parents 490a968 + 95f7a1a commit cc72321

File tree

797 files changed

+10189
-1566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

797 files changed

+10189
-1566
lines changed

c/cert/src/rules/INT30-C/UnsignedIntegerOperationsWrapAround.ql

+7-20
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,11 @@
1515

1616
import cpp
1717
import codingstandards.c.cert
18-
import codingstandards.cpp.Overflow
19-
import semmle.code.cpp.controlflow.Guards
20-
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
18+
import codingstandards.cpp.rules.unsignedoperationwithconstantoperandswraps.UnsignedOperationWithConstantOperandsWraps
2119

22-
from InterestingOverflowingOperation op
23-
where
24-
not isExcluded(op, IntegerOverflowPackage::unsignedIntegerOperationsWrapAroundQuery()) and
25-
op.getType().getUnderlyingType().(IntegralType).isUnsigned() and
26-
// Not within a guard condition
27-
not exists(GuardCondition gc | gc.getAChild*() = op) and
28-
// Not guarded by a check, where the check is not an invalid overflow check
29-
not op.hasValidPreCheck() and
30-
// Is not checked after the operation
31-
not op.hasValidPostCheck() and
32-
// Permitted by exception 3
33-
not op instanceof LShiftExpr and
34-
// Permitted by exception 2 - zero case is handled in separate query
35-
not op instanceof DivExpr and
36-
not op instanceof RemExpr
37-
select op,
38-
"Operation " + op.getOperator() + " of type " + op.getType().getUnderlyingType() + " may wrap."
20+
class UnsignedIntegerOperationsWrapAroundQuery extends UnsignedOperationWithConstantOperandsWrapsSharedQuery
21+
{
22+
UnsignedIntegerOperationsWrapAroundQuery() {
23+
this = IntegerOverflowPackage::unsignedIntegerOperationsWrapAroundQuery()
24+
}
25+
}

c/cert/test/rules/INT30-C/UnsignedIntegerOperationsWrapAround.expected

-4
This file was deleted.

c/cert/test/rules/INT30-C/UnsignedIntegerOperationsWrapAround.qlref

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c/common/test/rules/unsignedoperationwithconstantoperandswraps/UnsignedOperationWithConstantOperandsWraps.ql
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.ql
1+
c/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.ql

c/common/src/codingstandards/c/Literals.qll

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.c:4:1:4:41 | #define BAD_MACRO_WITH_ARG(x) (x) + wow ## x | Macro BAD_MACRO_WITH_ARG contains use of parameter x used in multiple contexts. |
2-
| test.c:5:1:5:48 | #define BAD_MACRO_WITH_ARG_TWO(x,y) (x) + wow ## x | Macro BAD_MACRO_WITH_ARG_TWO contains use of parameter x used in multiple contexts. |
1+
| test.c:5:1:5:41 | #define BAD_MACRO_WITH_ARG(x) (x) + wow ## x | Macro BAD_MACRO_WITH_ARG contains use of parameter x used in multiple contexts. |
2+
| test.c:6:1:6:48 | #define BAD_MACRO_WITH_ARG_TWO(x,y) (x) + wow ## x | Macro BAD_MACRO_WITH_ARG_TWO contains use of parameter x used in multiple contexts. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.amixedusemacroargumentsubjecttoexpansion.AMixedUseMacroArgumentSubjectToExpansion
3+
4+
class TestFileQuery extends AMixedUseMacroArgumentSubjectToExpansionSharedQuery, TestQuery { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
#define GOOD_MACRO_WITH_ARG(X) ((X)*X##_scale) // COMPLIANT
4+
#define MACRO 1
5+
#define BAD_MACRO_WITH_ARG(x) (x) + wow##x // NON_COMPLIANT
6+
#define BAD_MACRO_WITH_ARG_TWO(x, y) (x) + wow##x // NON_COMPLIANT
7+
#define MACROONE(x) #x // COMPLIANT
8+
#define MACROTWO(x) x *x // COMPLIANT
9+
#define MACROTHREE(x) "##\"\"'" + (x) // COMPLIANT
10+
#define FOO(x) #x MACROONE(x) // COMPLIANT - no further arg expansion
11+
12+
void f() {
13+
14+
int x;
15+
int x_scale;
16+
int y;
17+
int wowMACRO = 0;
18+
19+
y = GOOD_MACRO_WITH_ARG(x);
20+
wowMACRO = BAD_MACRO_WITH_ARG(MACRO);
21+
wowMACRO = BAD_MACRO_WITH_ARG_TWO(MACRO, 1);
22+
char s[] = MACROONE(MACRO);
23+
y = MACROTWO(MACRO);
24+
MACROTHREE(MACRO);
25+
FOO(x);
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| test.c:8:14:8:17 | call to atof | Call to banned function atof. |
2+
| test.c:9:12:9:15 | call to atoi | Call to banned function atoi. |
3+
| test.c:10:13:10:16 | call to atol | Call to banned function atol. |
4+
| test.c:11:18:11:22 | call to atoll | Call to banned function atoll. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.atofatoiatolandatollused.AtofAtoiAtolAndAtollUsed
3+
4+
class TestFileQuery extends AtofAtoiAtolAndAtollUsedSharedQuery, TestQuery { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
#include <float.h>
4+
#include <stdlib.h>
5+
void f2();
6+
void f1() {
7+
char l1[5] = "abcd";
8+
float l2 = atof(l1); // NON_COMLIANT
9+
int l3 = atoi(l1); // NON_COMPLIANT
10+
long l4 = atol(l1); // NON_COMPLIANT
11+
long long l5 = atoll(l1); // NON_COMPLIANT
12+
f2(); // COMPLIANT
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| test.c:8:7:8:8 | x1 | Bit-field 'x1' is declared on type 'int'. |
2+
| test.c:12:15:12:16 | x5 | Bit-field 'x5' is declared on type 'signed long'. |
3+
| test.c:14:15:14:16 | x6 | Bit-field 'x6' is declared on type 'signed char'. |
4+
| test.c:16:14:16:15 | x7 | Bit-field 'x7' is declared on type 'Color'. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.bitfieldshallhaveanappropriatetype.BitFieldShallHaveAnAppropriateType
3+
4+
class TestFileQuery extends BitFieldShallHaveAnAppropriateTypeSharedQuery, TestQuery { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
typedef unsigned int UINT16;
4+
5+
enum Color { R, G, B };
6+
7+
struct SampleStruct {
8+
int x1 : 2; // NON_COMPLIANT - not explicitly signed or unsigned
9+
unsigned int x2 : 2; // COMPLIANT - explicitly unsigned
10+
signed int x3 : 2; // COMPLIANT - explicitly signed
11+
UINT16 x4 : 2; // COMPLIANT - type alias resolves to a compliant type
12+
signed long x5 : 2; // NON_COMPLIANT - cannot declare bit field for long, even
13+
// if it's signed
14+
signed char x6 : 2; // NON_COMPLIANT - cannot declare bit field for char, even
15+
// if it's signed
16+
enum Color x7 : 3; // NON_COMPLIANT - cannot declare bit field for enum
17+
} sample_struct;
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
problems
2-
| test.c:8:8:8:12 | c_str | test.c:15:16:15:21 | call to getenv | test.c:8:8:8:12 | c_str | The object returned by the function getenv should not be modified. |
3-
| test.c:64:5:64:9 | conv4 | test.c:61:11:61:20 | call to localeconv | test.c:64:5:64:9 | conv4 | The object returned by the function localeconv should not be modified. |
4-
| test.c:73:5:73:8 | conv | test.c:69:25:69:34 | call to localeconv | test.c:73:5:73:8 | conv | The object returned by the function localeconv should not be modified. |
2+
| test.c:11:8:11:12 | c_str | test.c:18:16:18:21 | call to getenv | test.c:11:8:11:12 | c_str | The object returned by the function getenv should not be modified. |
3+
| test.c:67:5:67:9 | conv4 | test.c:64:11:64:20 | call to localeconv | test.c:67:5:67:9 | conv4 | The object returned by the function localeconv should not be modified. |
4+
| test.c:76:5:76:8 | conv | test.c:72:25:72:34 | call to localeconv | test.c:76:5:76:8 | conv | The object returned by the function localeconv should not be modified. |
55
edges
6-
| test.c:5:18:5:22 | c_str | test.c:8:8:8:12 | c_str |
7-
| test.c:15:16:15:21 | call to getenv | test.c:21:9:21:12 | env1 |
8-
| test.c:21:9:21:12 | env1 | test.c:5:18:5:22 | c_str |
9-
| test.c:61:11:61:20 | call to localeconv | test.c:64:5:64:9 | conv4 |
10-
| test.c:69:25:69:34 | call to localeconv | test.c:73:5:73:8 | conv |
6+
| test.c:8:18:8:22 | c_str | test.c:11:8:11:12 | c_str |
7+
| test.c:18:16:18:21 | call to getenv | test.c:24:9:24:12 | env1 |
8+
| test.c:24:9:24:12 | env1 | test.c:8:18:8:22 | c_str |
9+
| test.c:64:11:64:20 | call to localeconv | test.c:67:5:67:9 | conv4 |
10+
| test.c:72:25:72:34 | call to localeconv | test.c:76:5:76:8 | conv |
1111
nodes
12-
| test.c:5:18:5:22 | c_str | semmle.label | c_str |
13-
| test.c:8:8:8:12 | c_str | semmle.label | c_str |
14-
| test.c:15:16:15:21 | call to getenv | semmle.label | call to getenv |
15-
| test.c:21:9:21:12 | env1 | semmle.label | env1 |
16-
| test.c:61:11:61:20 | call to localeconv | semmle.label | call to localeconv |
17-
| test.c:64:5:64:9 | conv4 | semmle.label | conv4 |
18-
| test.c:69:25:69:34 | call to localeconv | semmle.label | call to localeconv |
19-
| test.c:73:5:73:8 | conv | semmle.label | conv |
12+
| test.c:8:18:8:22 | c_str | semmle.label | c_str |
13+
| test.c:11:8:11:12 | c_str | semmle.label | c_str |
14+
| test.c:18:16:18:21 | call to getenv | semmle.label | call to getenv |
15+
| test.c:24:9:24:12 | env1 | semmle.label | env1 |
16+
| test.c:64:11:64:20 | call to localeconv | semmle.label | call to localeconv |
17+
| test.c:67:5:67:9 | conv4 | semmle.label | conv4 |
18+
| test.c:72:25:72:34 | call to localeconv | semmle.label | call to localeconv |
19+
| test.c:76:5:76:8 | conv | semmle.label | conv |
2020
subpaths

c/common/test/rules/constlikereturnvalue/test.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
#include <locale.h>
4+
#include <stddef.h>
25
#include <stdlib.h>
36
#include <string.h>
47

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.c:8:1:8:25 | #define MACRO4(x) (x + 1) | Macro used instead of a function. |
2+
| test.c:13:1:13:48 | #define MACRO9() printf_custom("output = %d", 7) | Macro used instead of a function. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.functionlikemacrosdefined.FunctionLikeMacrosDefined
3+
4+
class TestFileQuery extends FunctionLikeMacrosDefinedSharedQuery, TestQuery { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
#include <assert.h>
4+
5+
#define MACRO(OP, L, R) ((L)OP(R)) // COMPLIANT
6+
#define MACRO2(L, R) (L + R) // COMPLIANT
7+
#define MACRO3(L, R) (L " " R " " L) // COMPLIANT
8+
#define MACRO4(x) (x + 1) // NON_COMPLIANT
9+
#define MACRO5(L, LR) (LR + 1) // COMPLIANT
10+
#define MACRO6(x) printf_custom("output = %d", test##x) // COMPLIANT
11+
#define MACRO7(x) #x // COMPLIANT
12+
#define MACRO8(x) "NOP" // COMPLIANT
13+
#define MACRO9() printf_custom("output = %d", 7) // NON_COMPLIANT
14+
#define MACRO10(x) // COMPLIANT
15+
#define MY_ASSERT(X) assert(X) // NON_COMPLIANT[FALSE_NEGATIVE]
16+
17+
char a1[MACRO2(1, 1) + 6];
18+
extern int printf_custom(char *, int);
19+
int test1;
20+
21+
void f() {
22+
int i = MACRO(+, 1, 1);
23+
int i2 = MACRO2(7, 10);
24+
25+
static int i3 = MACRO2(1, 1);
26+
27+
char *i4 = MACRO3("prefix", "suffix");
28+
29+
int i5 = MACRO4(1);
30+
31+
int i6 = MACRO4(MACRO2(1, 1));
32+
33+
int i7 = MACRO5(1, 1);
34+
35+
MACRO6(1);
36+
37+
char *i10 = MACRO7("prefix");
38+
39+
asm(MACRO8(1));
40+
41+
MY_ASSERT(1);
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| test.c:4:3:4:10 | goto ... | The goto statement and its $@ are not declared or enclosed in the same block. | test.c:6:3:6:5 | label ...: | label |
2+
| test.c:42:3:42:10 | goto ... | The goto statement and its $@ are not declared or enclosed in the same block. | test.c:46:3:46:5 | label ...: | label |
3+
| test.c:57:5:57:12 | goto ... | The goto statement and its $@ are not declared or enclosed in the same block. | test.c:60:3:60:5 | label ...: | label |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.gotoreferencealabelinsurroundingblock.GotoReferenceALabelInSurroundingBlock
3+
4+
class TestFileQuery extends GotoReferenceALabelInSurroundingBlockSharedQuery, TestQuery { }

c/misra/test/rules/RULE-15-3/test.c renamed to c/common/test/rules/gotoreferencealabelinsurroundingblock/test.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
void f1() {
24
goto L1;
35
for (int i = 0; i < 100; i++) {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
| test.c:5:3:5:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:5:3:5:10 | goto ... | L1 | test.c:2:1:2:3 | label ...: | label ...: |
2-
| test.c:14:3:14:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:14:3:14:10 | goto ... | L2 | test.c:12:1:12:3 | label ...: | label ...: |
3-
| test.c:16:3:16:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:16:3:16:10 | goto ... | L1 | test.c:11:1:11:3 | label ...: | label ...: |
1+
| test.c:9:3:9:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:9:3:9:10 | goto ... | l1 | test.c:5:1:5:3 | label ...: | label ...: |
2+
| test.c:21:3:21:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:21:3:21:10 | goto ... | l2 | test.c:17:1:17:3 | label ...: | label ...: |
3+
| test.c:23:3:23:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:23:3:23:10 | goto ... | l1 | test.c:16:1:16:3 | label ...: | label ...: |
4+
| test.c:28:3:28:10 | goto ... | The $@ statement jumps to a $@ that is not declared later in the same function. | test.c:28:3:28:10 | goto ... | l1 | test.c:27:1:27:3 | label ...: | label ...: |
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1-
void f1() {
2-
L1:;
3-
goto L2; // COMPLIANT
4-
;
5-
goto L1; // NON_COMPLIANT
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
void f1(int p1) {
64

7-
L2:;
5+
l1:
6+
if (p1) {
7+
goto l2; // COMPLIANT
8+
}
9+
goto l1; // NON_COMPLIANT
10+
11+
l2:;
812
}
913

10-
void f2() {
11-
L1:;
12-
L2:
13-
goto L3; // COMPLIANT
14-
goto L2; // NON_COMPLIANT
15-
L3:
16-
goto L1; // NON_COMPLIANT
14+
void f2(int p1) {
15+
16+
l1:;
17+
l2:
18+
if (p1) {
19+
goto l3; // COMPLIANT
20+
}
21+
goto l2; // NON_COMPLIANT
22+
l3:
23+
goto l1; // NON_COMPLIANT
1724
}
25+
26+
void f3() {
27+
l1:
28+
goto l1; // NON_COMPLIANT
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.c:6:3:6:14 | goto ... | Use of goto. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.gotostatementshouldnotbeused.GotoStatementShouldNotBeUsed
3+
4+
class TestFileQuery extends GotoStatementShouldNotBeUsedSharedQuery, TestQuery { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
void test_goto() {
4+
int x = 1;
5+
6+
goto label1; // NON_COMPLIANT
7+
8+
label1:
9+
10+
x = 2;
11+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
| test.c:19:14:19:19 | tmpvar | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:11:12:11:17 | call to getenv | call to getenv | test.c:15:13:15:18 | call to getenv | call to getenv |
2-
| test.c:132:14:132:17 | temp | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:128:12:128:17 | call to getenv | call to getenv | test.c:129:11:129:16 | call to getenv | call to getenv |
3-
| test.c:132:20:132:22 | tmp | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:129:11:129:16 | call to getenv | call to getenv | test.c:128:12:128:17 | call to getenv | call to getenv |
4-
| test.c:163:14:163:26 | tmpvar_global | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:155:19:155:24 | call to getenv | call to getenv | test.c:159:20:159:25 | call to getenv | call to getenv |
5-
| test.c:186:18:186:18 | r | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:183:7:183:15 | call to setlocale | call to setlocale | test.c:185:8:185:17 | call to localeconv | call to localeconv |
6-
| test.c:206:10:206:15 | tmpvar | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:200:12:200:17 | call to getenv | call to getenv | test.c:204:3:204:8 | call to f11fun | call to f11fun |
1+
| test.c:21:14:21:19 | tmpvar | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:13:12:13:17 | call to getenv | call to getenv | test.c:17:13:17:18 | call to getenv | call to getenv |
2+
| test.c:134:14:134:17 | temp | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:130:12:130:17 | call to getenv | call to getenv | test.c:131:11:131:16 | call to getenv | call to getenv |
3+
| test.c:134:20:134:22 | tmp | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:131:11:131:16 | call to getenv | call to getenv | test.c:130:12:130:17 | call to getenv | call to getenv |
4+
| test.c:165:14:165:26 | tmpvar_global | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:157:19:157:24 | call to getenv | call to getenv | test.c:161:20:161:25 | call to getenv | call to getenv |
5+
| test.c:188:18:188:18 | r | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:185:7:185:15 | call to setlocale | call to setlocale | test.c:187:8:187:17 | call to localeconv | call to localeconv |
6+
| test.c:208:10:208:15 | tmpvar | This pointer was returned by a $@ and may have been overwritten by the susequent $@. | test.c:202:12:202:17 | call to getenv | call to getenv | test.c:206:3:206:8 | call to f11fun | call to f11fun |

c/common/test/rules/invalidatedenvstringpointers/test.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
#include <locale.h>
24
#include <stdio.h>
35
#include <stdlib.h>
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.c:13:19:13:24 | call to getenv | The value of variable $@ might become invalid after a subsequent call to function `getenv`. | test.c:10:7:10:19 | tmpvar_global | tmpvar_global |
2-
| test.c:16:20:16:25 | call to getenv | The value of variable $@ might become invalid after a subsequent call to function `getenv`. | test.c:7:9:7:20 | tmpvar_field | tmpvar_field |
1+
| test.c:15:19:15:24 | call to getenv | The value of variable $@ might become invalid after a subsequent call to function `getenv`. | test.c:12:7:12:19 | tmpvar_global | tmpvar_global |
2+
| test.c:18:20:18:25 | call to getenv | The value of variable $@ might become invalid after a subsequent call to function `getenv`. | test.c:9:9:9:20 | tmpvar_field | tmpvar_field |

c/common/test/rules/invalidatedenvstringpointerswarn/test.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
#include <locale.h>
24
#include <stdio.h>
35
#include <stdlib.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| test.c:5:10:5:11 | 0 | Lowercase 'l' used as a literal suffix. |
2+
| test.c:6:10:6:12 | 0 | Lowercase 'l' used as a literal suffix. |
3+
| test.c:9:10:9:12 | 0 | Lowercase 'l' used as a literal suffix. |
4+
| test.c:10:10:10:12 | 0 | Lowercase 'l' used as a literal suffix. |
5+
| test.c:15:11:15:12 | 0 | Lowercase 'l' used as a literal suffix. |
6+
| test.c:16:11:16:13 | 0 | Lowercase 'l' used as a literal suffix. |
7+
| test.c:19:11:19:13 | 0 | Lowercase 'l' used as a literal suffix. |
8+
| test.c:20:11:20:13 | 0 | Lowercase 'l' used as a literal suffix. |
9+
| test.c:25:10:25:14 | 1 | Lowercase 'l' used as a literal suffix. |
10+
| test.c:26:10:26:15 | 1 | Lowercase 'l' used as a literal suffix. |
11+
| test.c:29:10:29:15 | 1 | Lowercase 'l' used as a literal suffix. |
12+
| test.c:30:10:30:15 | 1 | Lowercase 'l' used as a literal suffix. |
13+
| test.c:35:11:35:14 | 1 | Lowercase 'l' used as a literal suffix. |
14+
| test.c:36:11:36:15 | 1 | Lowercase 'l' used as a literal suffix. |
15+
| test.c:39:11:39:15 | 1 | Lowercase 'l' used as a literal suffix. |
16+
| test.c:40:11:40:15 | 1 | Lowercase 'l' used as a literal suffix. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.lowercaselstartsinliteralsuffix.LowercaseLStartsInLiteralSuffix
3+
4+
class TestFileQuery extends LowercaseLStartsInLiteralSuffixSharedQuery, TestQuery { }

0 commit comments

Comments
 (0)