Add proper patch for gcc 4.9 build
This commit is contained in:
parent
e3c62428bf
commit
7b630d311c
|
@ -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;
|
5
0ad.spec
5
0ad.spec
|
@ -19,7 +19,7 @@
|
|||
|
||||
Name: 0ad
|
||||
Version: 0.0.16
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
# BSD License:
|
||||
# build/premake/*
|
||||
# libraries/valgrind/* (not built/used)
|
||||
|
@ -225,6 +225,9 @@ export STRIP=/bin/true
|
|||
%{_mandir}/man6/*.6*
|
||||
|
||||
%changelog
|
||||
* Wed Jun 18 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.16-6
|
||||
- Add proper patch for gcc 4.9 build
|
||||
|
||||
* Fri Jun 6 2014 Peter Robinson <pbrobinson@fedoraproject.org> 0.0.16-5
|
||||
- Remove old Fedora release conditionals
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue