diff --git a/cfg/openmp.cfg b/cfg/openmp.cfg new file mode 100644 index 000000000..d853af228 --- /dev/null +++ b/cfg/openmp.cfg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + omp_target_alloc + omp_target_free + + + omp_alloc + omp_free + + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + This routine has been deprecated. See OpenMP specification. + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + + + false + + + This routine has been deprecated. See OpenMP specification. + + + + + + + false + + + + + + 1: + + + + + false + + + + + + + + 0: + + + + + false + + + + + + + + 0: + + + diff --git a/test/cfg/openmp.c b/test/cfg/openmp.c new file mode 100644 index 000000000..b7a9f8e61 --- /dev/null +++ b/test/cfg/openmp.c @@ -0,0 +1,31 @@ + +// Test library configuration for openmp.cfg +// +// Usage: +// $ cppcheck --check-library --library=openmp --enable=information --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem test/cfg/openmp.c +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +#include +#include + +void validCode() +{ + int arr[20] = { 0 }; + #pragma omp parallel for + for (int i = 0; i < 20; ++i) { + arr[i] = i * i; + } + + char * pChars = (char *) omp_target_alloc(4, 1); + printf("pChars: %p", pChars); + omp_target_free(pChars, 1); +} + +void memleak_omp_target_alloc() +{ + char * pChars = (char *) omp_target_alloc(2, 0); + printf("pChars: %p", pChars); + // cppcheck-suppress memleak +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 1b333daaa..df074b232 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -178,6 +178,10 @@ else fi ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=sqlite3 ${DIR}sqlite3.c +# openmp.c +${CC} ${CC_OPT} -fopenmp ${DIR}openmp.c +${CPPCHECK} ${CPPCHECK_OPT} --library=openmp ${DIR}openmp.c + # Check the syntax of the defines in the configuration files set +e xmlstarlet --version diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index ac40d5bca..3b2e61c7a 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -262,6 +262,7 @@ def scan_package(work_path, cppcheck_path, jobs): 'motif': ['', '"prtypes.h"'], 'opengl': ['', '', ''], + # 'openmp': [''], <= enable after release of version 1.89 'python': ['', '"Python.h"'], 'qt': ['', '', '', '', '', '