mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r16983) -Change: work around a bogus GCC 4.4+ warning that can't be disabled
This commit is contained in:
parent
0930c3c098
commit
3a6c0a9f22
|
@ -58,6 +58,10 @@ protected:
|
||||||
CHdr *m_pHdr_1; ///< ptr just after the CHdr holding m_size and m_max_size
|
CHdr *m_pHdr_1; ///< ptr just after the CHdr holding m_size and m_max_size
|
||||||
} ptr_u;
|
} ptr_u;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Just to silence an unsilencable GCC 4.4+ warning */
|
||||||
|
static const CHdr hdrEmpty[];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const bsize_t Ttail_reserve = 4; ///< four extra bytes will be always allocated and zeroed at the end
|
static const bsize_t Ttail_reserve = 4; ///< four extra bytes will be always allocated and zeroed at the end
|
||||||
|
|
||||||
|
@ -96,8 +100,7 @@ protected:
|
||||||
* both m_size and m_max_size containing zero */
|
* both m_size and m_max_size containing zero */
|
||||||
FORCEINLINE void InitEmpty()
|
FORCEINLINE void InitEmpty()
|
||||||
{
|
{
|
||||||
static CHdr hdrEmpty[] = {{0, 0}, {0, 0}};
|
ptr_u.m_pHdr_1 = const_cast<CHdr *>(&CBlobBaseSimple::hdrEmpty[1]);
|
||||||
ptr_u.m_pHdr_1 = &hdrEmpty[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** initialize blob by attaching it to the given header followed by data */
|
/** initialize blob by attaching it to the given header followed by data */
|
||||||
|
@ -297,6 +300,9 @@ public:
|
||||||
/** all deallocations should happen here */
|
/** all deallocations should happen here */
|
||||||
static FORCEINLINE void RawFree(CHdr *p)
|
static FORCEINLINE void RawFree(CHdr *p)
|
||||||
{
|
{
|
||||||
|
/* Just to silence an unsilencable GCC 4.4+ warning */
|
||||||
|
assert(p != CBlobBaseSimple::hdrEmpty);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
/** fixing the four bytes at the end of blob data - useful when blob is used to hold string */
|
/** fixing the four bytes at the end of blob data - useful when blob is used to hold string */
|
||||||
|
|
|
@ -167,3 +167,5 @@ void DumpTarget::EndStruct()
|
||||||
m_cur_struct.pop();
|
m_cur_struct.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Just to silence an unsilencable GCC 4.4+ warning */
|
||||||
|
/* static */ const CBlobBaseSimple::CHdr CBlobBaseSimple::hdrEmpty[] = {{0, 0}, {0, 0}};
|
||||||
|
|
Loading…
Reference in New Issue