mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r26223) -Codechange: Silence some compile warnings about unititialized variables in the SSE blitters (MJP)
This commit is contained in:
parent
115c712f4e
commit
7b20da8a0a
|
@ -19,10 +19,6 @@
|
|||
/** Instantiation of the SSE4 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
|
||||
*
|
||||
|
@ -30,6 +26,7 @@ static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
|
|||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last>
|
||||
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
|
@ -356,9 +353,7 @@ bmcr_alpha_blend_single:
|
|||
anim_line += this->anim_buf_width;
|
||||
}
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
|
|
|
@ -26,6 +26,7 @@ static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
|
|||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last>
|
||||
inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
|
@ -188,6 +189,7 @@ inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
|||
dst_line += bp->pitch;
|
||||
}
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
|
@ -340,6 +342,7 @@ inline Colour Blitter_32bppSSE2::AdjustBrightness(Colour colour, uint8 brightnes
|
|||
return Blitter_32bppSSE2::ReallyAdjustBrightness(colour, brightness);
|
||||
}
|
||||
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
/* static */ Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness)
|
||||
{
|
||||
ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
|
||||
|
@ -371,5 +374,6 @@ inline Colour Blitter_32bppSSE2::AdjustBrightness(Colour colour, uint8 brightnes
|
|||
ret = _mm_packus_epi16(ret, ret); /* PACKUSWB, saturate and pack. */
|
||||
return alpha32 | EXTR32(ret, 0);
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
/** Instantiation of the SSE4 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
|
||||
*
|
||||
|
@ -30,6 +26,7 @@ static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
|
|||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last>
|
||||
inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
|
@ -241,9 +238,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
|||
dst_line += bp->pitch;
|
||||
}
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
|
@ -292,6 +287,7 @@ inline Colour Blitter_32bppSSE4::AdjustBrightness(Colour colour, uint8 brightnes
|
|||
return Blitter_32bppSSE4::ReallyAdjustBrightness(colour, brightness);
|
||||
}
|
||||
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
/* static */ Colour Blitter_32bppSSE4::ReallyAdjustBrightness(Colour colour, uint8 brightness)
|
||||
{
|
||||
ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
|
||||
|
@ -323,5 +319,6 @@ inline Colour Blitter_32bppSSE4::AdjustBrightness(Colour colour, uint8 brightnes
|
|||
ret = _mm_packus_epi16(ret, ret); /* PACKUSWB, saturate and pack. */
|
||||
return alpha32 | EXTR32(ret, 0);
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
|
|
|
@ -22,11 +22,7 @@
|
|||
#undef INSR32
|
||||
#define INSR32(val, into, rank) (*(um128i*) &into).m128i = _mm_insert_epi32((*(um128i*) &into).m128i, val, rank)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
#ifdef _SQ64
|
||||
#undef INSR64
|
||||
#define INSR64(val, into, rank) (*(um128i*) &into).m128i = _mm_insert_epi64((*(um128i*) &into).m128i, val, rank)
|
||||
|
@ -40,9 +36,7 @@
|
|||
(*(um128i*) &into).m128i = _mm_insert_epi32((*(um128i*) &into).m128i, v.u32.high, (rank)*2 + 1); \
|
||||
}
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/** The SSE4 32 bpp blitter (without palette animation). */
|
||||
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
|
||||
|
|
17
src/stdafx.h
17
src/stdafx.h
|
@ -490,4 +490,21 @@ static inline void free(const void *ptr)
|
|||
*/
|
||||
#define MAX_UVALUE(type) ((type)~(type)0)
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_DEBUG)
|
||||
#define IGNORE_UNINITIALIZED_WARNING_START __pragma(warning(push)) __pragma(warning(disable:4700))
|
||||
#define IGNORE_UNINITIALIZED_WARNING_STOP __pragma(warning(pop))
|
||||
#elif defined(__GNUC__) && !defined(_DEBUG)
|
||||
#define HELPER0(x) #x
|
||||
#define HELPER1(x) HELPER0(GCC diagnostic ignored x)
|
||||
#define HELPER2(y) HELPER1(#y)
|
||||
#define IGNORE_UNINITIALIZED_WARNING_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma(HELPER2(-Wuninitialized)) \
|
||||
_Pragma(HELPER2(-Wmaybe-uninitialized))
|
||||
#define IGNORE_UNINITIALIZED_WARNING_STOP _Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
#define IGNORE_UNINITIALIZED_WARNING_START
|
||||
#define IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
#endif
|
||||
|
||||
#endif /* STDAFX_H */
|
||||
|
|
Loading…
Reference in New Issue