[0ad/f20] Add workaround for %%check failure with gcc 4.9 on i686

pcpa pcpa at fedoraproject.org
Fri Apr 18 22:21:00 UTC 2014


commit 91ebe26affa0757362604e1a55625c6031d3d99a
Author: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
Date:   Fri Apr 18 19:20:11 2014 -0300

    Add workaround for %%check failure with gcc 4.9 on i686

 0ad-check.patch |   21 +++++++++++++++++++++
 0ad.spec        |    9 ++++++++-
 2 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/0ad-check.patch b/0ad-check.patch
new file mode 100644
index 0000000..e267441
--- /dev/null
+++ b/0ad-check.patch
@@ -0,0 +1,21 @@
+diff -up 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h.orig 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h
+--- 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h.orig	2014-04-18 18:59:21.714584836 -0300
++++ 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h	2014-04-18 19:00:01.101586345 -0300
+@@ -114,14 +114,14 @@ public:
+ 
+ 		srand(1);
+ 
++		const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
++		const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
++		// (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
+ 		for(int i = 0; i < 1000; i++)
+ 		{
+ 			// allocate
+ 			if(rand() >= RAND_MAX/2)
+ 			{
+-				const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
+-				const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
+-				// (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
+ 				void* p = a.Allocate(size);
+ 				if(!p)
+ 					continue;
diff --git a/0ad.spec b/0ad.spec
index 8f92df9..8ec5248 100644
--- a/0ad.spec
+++ b/0ad.spec
@@ -25,7 +25,7 @@
 
 Name:		0ad
 Version:	0.0.15
-Release:	3%{?dist}
+Release:	4%{?dist}
 # BSD License:
 #	build/premake/*
 #	libraries/valgrind/*		(not built/used)
@@ -113,6 +113,9 @@ Patch1:		%{name}-debug.patch
 # Build with miniupnpc-1.9
 Patch2:		%{name}-miniupnpc.patch
 
+# After some trial&error this corrects a %%check failure with gcc 4.9 on i686
+Patch3:		%{name}-check.patch
+
 %description
 0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform
 real-time strategy (RTS) game of ancient warfare. In short, it is a
@@ -134,6 +137,7 @@ hobbyist game developers, since 2001.
 %patch1 -p1
 %endif
 %patch2 -p1
+%patch3 -p1
 
 %if %{with_system_nvtt}
 rm -fr libraries/nvtt
@@ -234,6 +238,9 @@ export STRIP=/bin/true
 %{_mandir}/man6/*.6*
 
 %changelog
+* Fri Apr 18 2014 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 0.0.15-4
+- Add workaround for %%check failure with gcc 4.9 on i686
+
 * Fri Apr 18 2014 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 0.0.15-3
 - Rebuild with minupnpc 1.9
 


More information about the scm-commits mailing list