From 4d26cb83266d178846c52c154b23dbe0be84dfae Mon Sep 17 00:00:00 2001 From: pcpa Date: Jun 18 2014 18:04:22 +0000 Subject: Add proper patch for gcc 4.9 build --- diff --git a/0ad-check.patch b/0ad-check.patch deleted file mode 100644 index e267441..0000000 --- a/0ad-check.patch +++ /dev/null @@ -1,21 +0,0 @@ -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 41a8bc6..1c39888 100644 --- a/0ad.spec +++ b/0ad.spec @@ -25,7 +25,7 @@ Name: 0ad Version: 0.0.16 -Release: 2%{?dist} +Release: 3%{?dist} # BSD License: # build/premake/* # libraries/valgrind/* (not built/used) @@ -114,8 +114,8 @@ 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 +# http://trac.wildfiregames.com/changeset/15334 +Patch3: changeset_15334.diff %description 0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform @@ -239,6 +239,9 @@ export STRIP=/bin/true %{_mandir}/man6/*.6* %changelog +* Wed Jun 18 2014 pcpa - 0.0.16-3 +- Add proper patch for gcc 4.9 build + * Fri May 23 2014 Petr Machata - 0.0.16-2 - Rebuild for boost 1.55.0 diff --git a/changeset_15334.diff b/changeset_15334.diff new file mode 100644 index 0000000..5b17120 --- /dev/null +++ b/changeset_15334.diff @@ -0,0 +1,42 @@ +Index: /ps/trunk/source/lib/allocators/headerless.cpp +=================================================================== +--- /ps/trunk/source/lib/allocators/headerless.cpp (revision 15333) ++++ /ps/trunk/source/lib/allocators/headerless.cpp (revision 15334) +@@ -55,10 +55,12 @@ + } + +- FreedBlock(uintptr_t id, size_t size) +- : m_magic(s_magic), m_size(size), m_id(id) +- { +- } +- +- ~FreedBlock() ++ void Setup(uintptr_t id, size_t size) ++ { ++ m_magic = s_magic; ++ m_size = size; ++ m_id = id; ++ } ++ ++ void Reset() + { + // clear all fields to prevent accidental reuse +@@ -411,6 +413,7 @@ + FreedBlock* WriteTags(u8* p, size_t size) + { +- FreedBlock* freedBlock = new(p) FreedBlock(s_headerId, size); +- (void)new(Footer(freedBlock)) FreedBlock(s_footerId, size); ++ FreedBlock* freedBlock = (FreedBlock*)p; ++ freedBlock->Setup(s_headerId, size); ++ Footer(freedBlock)->Setup(s_footerId, size); + + m_freeBlocks++; +@@ -431,6 +434,6 @@ + + FreedBlock* footer = Footer(freedBlock); +- freedBlock->~FreedBlock(); +- footer->~FreedBlock(); ++ freedBlock->Reset(); ++ footer->Reset(); + } +