aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-06-07 07:55:08 +0800
committertruckman <truckman@FreeBSD.org>2016-06-07 07:55:08 +0800
commit3ecccceb82718cb2178ee56f8d9c23c97ee26c36 (patch)
treebf2474eac7ed9e4372bce8cf4a5d194febf3795b /net
parentb8c674c5e884f6a28542b9ab3f37b4f03c39ab26 (diff)
downloadfreebsd-ports-gnome-3ecccceb82718cb2178ee56f8d9c23c97ee26c36.tar.gz
freebsd-ports-gnome-3ecccceb82718cb2178ee56f8d9c23c97ee26c36.tar.zst
freebsd-ports-gnome-3ecccceb82718cb2178ee56f8d9c23c97ee26c36.zip
Fix type for abs() calls in net/opal
During the exp-run in bug 208158, it was found that net/opal gives errors with libc++ 3.8.0 [1]: ../common/mpi.cxx:135:18: error: call to 'abs' is ambiguous distance = ( abs(MPIs[i].width - desiredWidth ) * ^~~ This is because abs() is being called with unsigned arguments. Fix this by casting the arguments to the appropriate signed type. This mimics what happens with older libraries where the only version of abs() was the one in <stdlib.h>, which is prototyped: int abs(int) Correct functioning of this expression relies on how integer overflow actually behaves, which is actually undefined in the C++ standard. PR: 209077 Submitted by: dim
Diffstat (limited to 'net')
-rw-r--r--net/opal/files/patch-plugins_video_common_mpi.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/opal/files/patch-plugins_video_common_mpi.cxx b/net/opal/files/patch-plugins_video_common_mpi.cxx
new file mode 100644
index 000000000000..1ff8ec4ac24a
--- /dev/null
+++ b/net/opal/files/patch-plugins_video_common_mpi.cxx
@@ -0,0 +1,13 @@
+--- plugins/video/common/mpi.cxx.orig 2013-02-20 02:18:05 UTC
++++ plugins/video/common/mpi.cxx
+@@ -132,8 +132,8 @@ bool MPIList::getNegotiatedMPI( unsigned
+ // to the desired one or matches it
+ for (i=0; i < MPIs.size(); i++) {
+ // we square the value in order to get absolute distances
+- distance = ( abs(MPIs[i].width - desiredWidth ) *
+- abs(MPIs[i].height - desiredHeight) );
++ distance = ( abs((int)(MPIs[i].width - desiredWidth )) *
++ abs((int)(MPIs[i].height - desiredHeight)) );
+
+ if (distance < minDistance) {
+ minDistance = distance;