commit:     b5b6a3ee5681d326db6247e7e49df2066151ee75
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May  2 20:46:00 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun May  2 20:46:11 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5b6a3ee

games-fps/blackshades: tweak for gcc-11

Reported-by: Toralf Förster
Closes: https://bugs.gentoo.org/787740
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 .../blackshades/blackshades-20070723-r1.ebuild     |  1 +
 .../files/blackshades-20070723-gcc-11.patch        | 55 ++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/games-fps/blackshades/blackshades-20070723-r1.ebuild 
b/games-fps/blackshades/blackshades-20070723-r1.ebuild
index 1ae58711d3a..afd60bab4f0 100644
--- a/games-fps/blackshades/blackshades-20070723-r1.ebuild
+++ b/games-fps/blackshades/blackshades-20070723-r1.ebuild
@@ -27,6 +27,7 @@ RDEPEND="${DEPEND}"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-datadir.patch
+       "${FILESDIR}"/${P}-gcc-11.patch
 )
 
 src_prepare() {

diff --git a/games-fps/blackshades/files/blackshades-20070723-gcc-11.patch 
b/games-fps/blackshades/files/blackshades-20070723-gcc-11.patch
new file mode 100644
index 00000000000..5d76ad638cb
--- /dev/null
+++ b/games-fps/blackshades/files/blackshades-20070723-gcc-11.patch
@@ -0,0 +1,55 @@
+https://bugs.gentoo.org/787740
+--- a/Source/Globals.cpp
++++ b/Source/Globals.cpp
+@@ -62,7 +62,7 @@ XYZ n,pa1,pa2,pa3;
+ float u0, u1, u2;
+ float v0, v1, v2;
+ float a, b;
+-float max;
++float _max;
+ int i, j;
+ bool bInter;
+ float pointv[3];
+--- a/Source/Quaternions.cpp
++++ b/Source/Quaternions.cpp
+@@ -316,7 +316,7 @@ float normaldotproduct(XYZ point1, XYZ point2){
+ extern float u0, u1, u2;
+ extern float v0, v1, v2;
+ extern float a, b;
+-extern float max;
++extern float _max;
+ extern int i, j;
+ extern bool bInter;
+ extern float pointv[3];
+@@ -352,11 +352,11 @@ bool PointInTriangle(Vector *p, Vector normal, float 
p11, float p12, float p13,
+       
+ #define ABS(X) (((X)<0.f)?-(X):(X) )
+ #define MAX(A, B) (((A)<(B))?(B):(A)) 
+-      max = MAX(MAX(ABS(normalv[0]), ABS(normalv[1])), ABS(normalv[2]));
++      _max = MAX(MAX(ABS(normalv[0]), ABS(normalv[1])), ABS(normalv[2]));
+ #undef MAX
+-      if (max == ABS(normalv[0])) {i = 1; j = 2;} // y, z
+-      if (max == ABS(normalv[1])) {i = 0; j = 2;} // x, z
+-      if (max == ABS(normalv[2])) {i = 0; j = 1;} // x, y
++      if (_max == ABS(normalv[0])) {i = 1; j = 2;} // y, z
++      if (_max == ABS(normalv[1])) {i = 0; j = 2;} // x, z
++      if (_max == ABS(normalv[2])) {i = 0; j = 1;} // x, y
+ #undef ABS
+       
+       u0 = pointv[i] - p1v[i];
+@@ -447,11 +447,11 @@ bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ 
*p2, XYZ *p3)
+       
+ #define ABS(X) (((X)<0.f)?-(X):(X) )
+ #define MAX(A, B) (((A)<(B))?(B):(A)) 
+-      max = MAX(MAX(ABS(normalv[0]), ABS(normalv[1])), ABS(normalv[2]));
++      _max = MAX(MAX(ABS(normalv[0]), ABS(normalv[1])), ABS(normalv[2]));
+ #undef MAX
+-      if (max == ABS(normalv[0])) {i = 1; j = 2;} // y, z
+-      if (max == ABS(normalv[1])) {i = 0; j = 2;} // x, z
+-      if (max == ABS(normalv[2])) {i = 0; j = 1;} // x, y
++      if (_max == ABS(normalv[0])) {i = 1; j = 2;} // y, z
++      if (_max == ABS(normalv[1])) {i = 0; j = 2;} // x, z
++      if (_max == ABS(normalv[2])) {i = 0; j = 1;} // x, y
+ #undef ABS
+       
+       u0 = pointv[i] - p1v[i];

Reply via email to