Fixed #8441 (MISRA Addon: FP 12.3 issued for initializer lists)

This commit is contained in:
Daniel Marjamäki 2018-03-18 22:05:31 +01:00
parent 7699f6432b
commit 480d84d69c
2 changed files with 11 additions and 4 deletions

View File

@ -621,9 +621,9 @@ def misra_12_2(data):
def misra_12_3(data):
for token in data.tokenlist:
if token.str != ',' or token.scope.type == 'Enum':
if token.str != ',' or token.scope.type == 'Enum' or token.scope.type == 'Class' or token.scope.type == 'Global':
continue
if token.astParent and token.astParent.str in {'(', ',', '{'}:
if token.astParent and token.astParent.str in ['(', ',', '{']:
continue
reportError(token, 12, 3)
@ -1072,6 +1072,7 @@ def loadRuleTexts(filename):
num2 = 0
appendixA = False
ruleText = False
global ruleTexts
for line in open(filename, 'rt'):
line = line.replace('\r', '').replace('\n', '')
if len(line) == 0:
@ -1098,11 +1099,9 @@ def loadRuleTexts(filename):
if ruleText:
num2 = num2 + 1
num = num1 * 100 + num2
global ruleTexts
ruleTexts[num] = line
ruleText = True
elif ruleText and re.match(r'^[a-z].*', line):
global ruleTexts
num = num1 * 100 + num2
ruleTexts[num] = ruleTexts[num] + ' ' + line
continue

View File

@ -0,0 +1,8 @@
// #8441
class C {
int a;
int b;
C() : a(1), b(1) { c; }
};