Skip to content

Commit b444c00

Browse files
committed
Fixed #11000 (misra: crash)
1 parent 1e40a2e commit b444c00

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

addons/misra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@ def reportErrorIfVariableIsNotConst(variable, stringLiteral):
18371837
usedParameter = parametersUsed[i]
18381838
parameterDefinition = functionDeclaration.argument.get(i+1)
18391839

1840-
if usedParameter.isString and parameterDefinition.nameToken:
1840+
if usedParameter.isString and parameterDefinition and parameterDefinition.nameToken:
18411841
reportErrorIfVariableIsNotConst(parameterDefinition.nameToken, usedParameter)
18421842

18431843
def misra_8_1(self, cfg):

addons/test/misra/misra-test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ static const char *misra_7_4_return_const (void) { return 1 + "return_const"; }
315315
static void misra_7_4_const_call(int a, const char* b) { } // 2.7
316316
static void misra_7_4_const_ptr_call(int a, const char const* b) { } // 2.7
317317
static void misra_7_4_call(int a, char* b) { } // 2.7
318+
static void misra_7_4_call_2(int a, ...) { } // 2.7
318319

319320
static void misra_7_4(void)
320321
{
@@ -330,6 +331,7 @@ static void misra_7_4(void)
330331
misra_7_4_const_call(1, ("text_const_call"));
331332
misra_7_4_const_ptr_call(1, ("text_const_call"));
332333
misra_7_4_call(1, "text_call"); // 7.4 11.8
334+
misra_7_4_call_2(1, "a", "b");
333335
}
334336

335337
const misra_8_1_a; // 8.1 8.4

0 commit comments

Comments
 (0)