File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -3157,15 +3157,15 @@ def misra_16_3(self, rawTokens):
31573157 STATE_OK = 2 # a case/default is allowed (we have seen 'break;'/'comment'/'{'/attribute)
31583158 STATE_SWITCH = 3 # walking through switch statement scope
31593159
3160- define = None
3160+ directive = None
31613161 state = STATE_NONE
31623162 end_switch_token = None # end '}' for the switch scope
31633163 for token in rawTokens :
3164- if simpleMatch (token , '# define' ):
3165- define = token
3166- if define :
3167- if token .linenr != define .linenr :
3168- define = None
3164+ if simpleMatch (token , '# define' ) or simpleMatch ( token , '# pragma' ) :
3165+ directive = token
3166+ if directive :
3167+ if token .linenr != directive .linenr :
3168+ directive = None
31693169 else :
31703170 continue
31713171
@@ -3231,7 +3231,7 @@ def misra_16_5(self, data):
32313231 for token in data .tokenlist :
32323232 if token .str != 'default' :
32333233 continue
3234- if token .previous and token .previous .str == '{' :
3234+ if token .previous and ( token .previous .str == '{' ) :
32353235 continue
32363236 tok2 = token
32373237 while tok2 :
Original file line number Diff line number Diff line change 22// ~/cppcheck/cppcheck --dump misra/misra-test.h --std=c89
33// ~/cppcheck/cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 && python3 ../misra.py -verify misra/misra-test.c.dump
44
5+ #pragma ghs section rodata=default // no warning
6+
57#include "path\file.h" // 20.2
68#include "file//.h" // 20.2
79#include "file/*.h" // 20.2
You can’t perform that action at this time.
0 commit comments