Fix #11793 (False positive: Misra addon crash for struct initialization when struct has a function pointer array) (#5190)
This commit is contained in:
parent
87c2b8df04
commit
91dedf05b5
|
@ -380,6 +380,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety
|
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety
|
||||||
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety
|
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety
|
||||||
|
./cppcheck --error-exitcode=1 --addon=misra addons/test/misra/crash*.c
|
||||||
./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c
|
./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c
|
||||||
pushd addons/test
|
pushd addons/test
|
||||||
# We'll force C89 standard to enable an additional verification for
|
# We'll force C89 standard to enable an additional verification for
|
||||||
|
@ -403,11 +404,6 @@ jobs:
|
||||||
../../cppcheck --dump namingng_test.c
|
../../cppcheck --dump namingng_test.c
|
||||||
python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
|
python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
|
||||||
|
|
||||||
- name: Ensure misra addon does not crash
|
|
||||||
if: contains(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' )
|
|
||||||
|
|
||||||
- name: Build democlient
|
- name: Build democlient
|
||||||
if: matrix.os == 'ubuntu-22.04'
|
if: matrix.os == 'ubuntu-22.04'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -441,7 +441,7 @@ def getElementDef(nameToken, rawTokens = None):
|
||||||
return ed
|
return ed
|
||||||
|
|
||||||
def createArrayChildrenDefs(ed, token, var, rawTokens = None):
|
def createArrayChildrenDefs(ed, token, var, rawTokens = None):
|
||||||
if token.str == '[':
|
if token and token.str == '[':
|
||||||
if rawTokens is not None:
|
if rawTokens is not None:
|
||||||
foundToken = next((rawToken for rawToken in rawTokens
|
foundToken = next((rawToken for rawToken in rawTokens
|
||||||
if rawToken.file == token.file
|
if rawToken.file == token.file
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
// #11793
|
||||||
|
|
||||||
|
typedef struct pfmlib_pmu {
|
||||||
|
int flags ;
|
||||||
|
int (*get_event_encoding[10])(void* this, pfmlib_event_desc_t* e);
|
||||||
|
} pfmlib_pmu_t ;
|
||||||
|
|
||||||
|
pfmlib_pmu_t sparc_ultra3_support = { .flags = 0 };
|
Loading…
Reference in New Issue