forked from mirrors/0ad
Fix build warnings. Patch by Markus. Refs #1851.
This was SVN commit r13469.
This commit is contained in:
@@ -218,6 +218,7 @@ function project_set_build_flags()
|
||||
-- enable security features (stack checking etc) that shouldn't have
|
||||
-- a significant effect on performance and can catch bugs
|
||||
"-fstack-protector-all",
|
||||
"-U_FORTIFY_SOURCE", -- (avoid redefinition warning if already defined)
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
|
||||
-- always enable strict aliasing (useful in debug builds because of the warnings)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -30,10 +30,10 @@
|
||||
// view port
|
||||
struct SViewPort
|
||||
{
|
||||
size_t m_X;
|
||||
size_t m_Y;
|
||||
size_t m_Width;
|
||||
size_t m_Height;
|
||||
int m_X;
|
||||
int m_Y;
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
};
|
||||
|
||||
class CCamera
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Wildfire Games
|
||||
/* Copyright (c) 2013 Wildfire Games
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -174,6 +174,13 @@ switch(x % 2)
|
||||
//-----------------------------------------------------------------------------
|
||||
// cassert
|
||||
|
||||
// Silence warnings about unused local typedefs
|
||||
#if GCC_VERSION >= 408
|
||||
# define UNUSED_ATTRIBUTE __attribute__((unused))
|
||||
#else
|
||||
# define UNUSED_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compile-time assertion. Causes a compile error if the expression
|
||||
* evaluates to zero/false.
|
||||
@@ -183,7 +190,7 @@ switch(x % 2)
|
||||
*
|
||||
* @param expr Expression that is expected to evaluate to non-zero at compile-time.
|
||||
**/
|
||||
#define cassert(expr) typedef static_assert_<(expr)>::type UID__
|
||||
#define cassert(expr) typedef static_assert_<(expr)>::type UID__ UNUSED_ATTRIBUTE
|
||||
template<bool> struct static_assert_;
|
||||
template<> struct static_assert_<true>
|
||||
{
|
||||
@@ -196,7 +203,7 @@ template<> struct static_assert_<true>
|
||||
* This version must be used if expr uses a dependent type (e.g. depends on
|
||||
* a template parameter).
|
||||
**/
|
||||
#define cassert_dependent(expr) typedef typename static_assert_<(expr)>::type UID__
|
||||
#define cassert_dependent(expr) typedef typename static_assert_<(expr)>::type UID__ UNUSED_ATTRIBUTE
|
||||
|
||||
/**
|
||||
* @copydoc cassert(expr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -170,7 +170,7 @@ void CReplayPlayer::Replay()
|
||||
}
|
||||
else if (type == "cmd")
|
||||
{
|
||||
u32 player;
|
||||
player_id_t player;
|
||||
*m_Stream >> player;
|
||||
|
||||
std::string line;
|
||||
|
||||
@@ -963,14 +963,12 @@ public:
|
||||
|
||||
// Get the territory data
|
||||
// Since getting the territory grid can trigger a recalculation, we check NeedUpdate first
|
||||
bool territoryMapDirty = false;
|
||||
Grid<u8> dummyGrid2;
|
||||
const Grid<u8>* territoryMap = &dummyGrid2;
|
||||
CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSimContext(), SYSTEM_ENTITY);
|
||||
if (cmpTerritoryManager && cmpTerritoryManager->NeedUpdate(&m_TerritoriesDirtyID))
|
||||
{
|
||||
territoryMap = &cmpTerritoryManager->GetTerritoryGrid();
|
||||
territoryMapDirty = true;
|
||||
}
|
||||
|
||||
LoadPathfinderClasses(state);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -59,7 +59,7 @@ void CBufferItem::ReleaseOpenALBuffer()
|
||||
AL_CHECK
|
||||
delete[] al_buf;
|
||||
}
|
||||
alSourcei(m_ALSource, AL_BUFFER, NULL);
|
||||
alSourcei(m_ALSource, AL_BUFFER, 0);
|
||||
((CSoundManager*)g_SoundManager)->ReleaseALSource(m_ALSource);
|
||||
AL_CHECK
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -44,7 +44,7 @@ void CSoundBase::ReleaseOpenAL()
|
||||
if (m_ALSource != 0)
|
||||
{
|
||||
AL_CHECK
|
||||
alSourcei(m_ALSource, AL_BUFFER, NULL);
|
||||
alSourcei(m_ALSource, AL_BUFFER, 0L);
|
||||
AL_CHECK
|
||||
((CSoundManager*)g_SoundManager)->ReleaseALSource(m_ALSource);
|
||||
AL_CHECK
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -55,7 +55,7 @@ void CStreamItem::ReleaseOpenALStream()
|
||||
AL_CHECK
|
||||
delete[] al_buf;
|
||||
}
|
||||
alSourcei(m_ALSource, AL_BUFFER, NULL);
|
||||
alSourcei(m_ALSource, AL_BUFFER, 0);
|
||||
AL_CHECK
|
||||
((CSoundManager*)g_SoundManager)->ReleaseALSource(m_ALSource);
|
||||
AL_CHECK
|
||||
|
||||
+2
-2
@@ -10,6 +10,7 @@
|
||||
// * ws2_32 is linked explicitly here, instead of requiring more complexity
|
||||
// in the build system.
|
||||
// * To avoid debug spew, we disable DEBUG.
|
||||
// * Use memcopy to get rid of strict-aliasing warning
|
||||
|
||||
#define __STDC_LIMIT_MACROS
|
||||
|
||||
@@ -1996,8 +1997,7 @@ static void MD5Final(unsigned char digest[16], MD5_CTX *ctx) {
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
((uint32_t *) ctx->in)[14] = ctx->bits[0];
|
||||
((uint32_t *) ctx->in)[15] = ctx->bits[1];
|
||||
memcpy(ctx->in + 14 * sizeof(uint32_t), ctx->bits, sizeof(ctx->bits));
|
||||
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
|
||||
Reference in New Issue
Block a user