From 48ab3ad019f3a40548ee9f3afb80452c9dc547bc Mon Sep 17 00:00:00 2001 From: currantw Date: Tue, 19 Nov 2024 17:20:21 -0800 Subject: [PATCH 1/2] Initial implementation to fix errors. Signed-off-by: currantw --- run_cppcheck.sh | 12 +++++++++++- src/opensearchenlist/msdtc_enlist.cpp | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/run_cppcheck.sh b/run_cppcheck.sh index 5a35fc0..6c52522 100755 --- a/run_cppcheck.sh +++ b/run_cppcheck.sh @@ -5,7 +5,17 @@ RESULTS_FILE=cppcheck-results.log # --force: force checks all define combinations (default max is 12) # -iaws-sdk-cpp: avoid checking AWS C++ SDK source files in our repo # -UWIN32: do not check WIN32-defined codepaths; this would throw errors on Mac -cppcheck --force -iaws-sdk-cpp -UWIN32 ./src 2> ${RESULTS_FILE} +# --check-level: use exhaustive checking for pipeline jobs; can disable during active development for quicker results +# --inline-suppr: enable inline error suppression +# -i: ignore CMake and installed files + +cppcheck \ + --force -iaws-sdk-cpp -UWIN32 \ + --check-level=exhaustive \ + --inline-suppr \ + -i "src/vcpkg_installed" \ + -i "src/cmake-build-debug" \ + ./src 2> ${RESULTS_FILE} if [ -s ${RESULTS_FILE} ]; then echo "!! Cppcheck errors found! Check ${RESULTS_FILE} for details." diff --git a/src/opensearchenlist/msdtc_enlist.cpp b/src/opensearchenlist/msdtc_enlist.cpp index f427d83..3a85716 100644 --- a/src/opensearchenlist/msdtc_enlist.cpp +++ b/src/opensearchenlist/msdtc_enlist.cpp @@ -1111,7 +1111,10 @@ RETCODE static EnlistInDtc_1pipe(void *conn, ITransaction *pTra, case DTC_CHECK_RM_CONNECTION: if (!confirmingLink) { confirmingLink = true; + + // cppcheck-suppress unknownMacro strcat(dtcname, ";" KEYWORD_DTC_CHECK "=0"); + continue; } default: From 339e61c79fa1cff26519016a9bddf8558c3efc6c Mon Sep 17 00:00:00 2001 From: currantw Date: Thu, 21 Nov 2024 10:26:54 -0800 Subject: [PATCH 2/2] Clarify comment in `run_cppcheck.sh` Signed-off-by: currantw --- run_cppcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_cppcheck.sh b/run_cppcheck.sh index 6c52522..77c3b8c 100755 --- a/run_cppcheck.sh +++ b/run_cppcheck.sh @@ -5,7 +5,7 @@ RESULTS_FILE=cppcheck-results.log # --force: force checks all define combinations (default max is 12) # -iaws-sdk-cpp: avoid checking AWS C++ SDK source files in our repo # -UWIN32: do not check WIN32-defined codepaths; this would throw errors on Mac -# --check-level: use exhaustive checking for pipeline jobs; can disable during active development for quicker results +# --check-level: use exhaustive checking for pipeline jobs; should be set to `normal` during active development # --inline-suppr: enable inline error suppression # -i: ignore CMake and installed files