Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1957?usp=email

to review the following change.


Change subject: cppcheck: Fix handling of likely() on Windows
......................................................................

cppcheck: Fix handling of likely() on Windows

Since we do not force __GNUC__ to undefined on Windows
(since we want to support MinGW) cppcheck might stumble
upon __builtin_expect(). When running with gnu.cfg (which
we do not want to do for Windows code) then that has an
existing override. But for our Windows checks we need to
add our own override.

This caused false-positives in buffer code.

Change-Id: I3b835558451414d8a4e8058114643555be69d391
Signed-off-by: Frank Lichtenheld <[email protected]>
---
A dev-tools/openvpn-cppcheck-windows.cfg
M dev-tools/run-cppcheck.sh
2 files changed, 11 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/57/1957/1

diff --git a/dev-tools/openvpn-cppcheck-windows.cfg 
b/dev-tools/openvpn-cppcheck-windows.cfg
new file mode 100644
index 0000000..9ac7282
--- /dev/null
+++ b/dev-tools/openvpn-cppcheck-windows.cfg
@@ -0,0 +1,10 @@
+<?xml version ="1.0"?>
+<!-- Only used for the Windows run. Can't be in openvpn-cppcheck-library.cfg
+     because it conflicts with gnu.cfg. -->
+<def>
+  <!-- MinGW uses GCC, so we need to handle GCC builtins. gnu.cfg has these,
+       but we do not load it for Windows. Without this cppcheck does not
+       understand our likely()/unlikely() macros. -->
+  <define name="__builtin_expect(X,Y)" value="(X)" />
+  <define name="__builtin_expect_with_probability(exp,c,probability)" 
value="(exp)" />
+</def>
diff --git a/dev-tools/run-cppcheck.sh b/dev-tools/run-cppcheck.sh
index 6b2c2be..3c71c83 100755
--- a/dev-tools/run-cppcheck.sh
+++ b/dev-tools/run-cppcheck.sh
@@ -49,7 +49,7 @@
     tests/unit_tests/plugins/ || ret=$?
 cppcheck $COMMON_ARGS \
     --platform=win64 \
-    --library=windows.cfg \
+    --library=windows.cfg --library=${SCRIPT_DIR}/openvpn-cppcheck-windows.cfg 
\
     -D_WIN32 \
     -UTARGET_LINUX -UTARGET_FREEBSD -UTARGET_OPENBSD -UTARGET_NETBSD \
     -UTARGET_DARWIN -UTARGET_ANDROID -UTARGET_SOLARIS -UTARGET_DRAGONFLY \

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1957?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3b835558451414d8a4e8058114643555be69d391
Gerrit-Change-Number: 1957
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to