1
0
Fork 0

Add -Wsign-compare for Clang builds and fix some signed/unsigned compiler warnings

mutilcraft-mt53
kwolekr 2015-05-16 19:59:53 -04:00
parent fb36c471d7
commit 11a96e4901
4 changed files with 31 additions and 30 deletions

View File

@ -590,6 +590,7 @@ else()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# clang does not understand __extern_always_inline but libc headers use it
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
set(OTHER_FLAGS "${OTHER_FLAGS} -Wsign-compare")
endif()
if(MINGW)

View File

@ -1716,7 +1716,7 @@ void GenericCAO::processMessage(const std::string &data)
m_armor_groups[name] = rating;
}
} else if (cmd == GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES) {
u8 version = readU8(is); // forward compatibility
//u8 version = readU8(is); // forward compatibility
m_nametag_color = readARGB8(is);
if (m_textnode != NULL) {
m_textnode->setTextColor(m_nametag_color);

View File

@ -590,8 +590,8 @@ void Noise::gradientMap2D(
int seed)
{
float v00, v01, v10, v11, u, v, orig_u;
int index, i, j, x0, y0, noisex, noisey;
int nlx, nly;
u32 index, i, j, x0, y0, noisex, noisey;
u32 nlx, nly;
bool eased = np.flags & (NOISE_FLAG_DEFAULTS | NOISE_FLAG_EASED);
Interp2dFxn interpolate = eased ?
@ -604,8 +604,8 @@ void Noise::gradientMap2D(
orig_u = u;
//calculate noise point lattice
nlx = (int)(u + sx * step_x) + 2;
nly = (int)(v + sy * step_y) + 2;
nlx = (u32)(u + sx * step_x) + 2;
nly = (u32)(v + sy * step_y) + 2;
index = 0;
for (j = 0; j != nly; j++)
for (i = 0; i != nlx; i++)
@ -655,8 +655,8 @@ void Noise::gradientMap3D(
float v000, v010, v100, v110;
float v001, v011, v101, v111;
float u, v, w, orig_u, orig_v;
int index, i, j, k, x0, y0, z0, noisex, noisey, noisez;
int nlx, nly, nlz;
u32 index, i, j, k, x0, y0, z0, noisex, noisey, noisez;
u32 nlx, nly, nlz;
Interp3dFxn interpolate = (np.flags & NOISE_FLAG_EASED) ?
triLinearInterpolation : triLinearInterpolationNoEase;
@ -671,9 +671,9 @@ void Noise::gradientMap3D(
orig_v = v;
//calculate noise point lattice
nlx = (int)(u + sx * step_x) + 2;
nly = (int)(v + sy * step_y) + 2;
nlz = (int)(w + sz * step_z) + 2;
nlx = (u32)(u + sx * step_x) + 2;
nly = (u32)(v + sy * step_y) + 2;
nlz = (u32)(w + sz * step_z) + 2;
index = 0;
for (k = 0; k != nlz; k++)
for (j = 0; j != nly; j++)

View File

@ -99,7 +99,7 @@ void TestSchematic::testMtsSerializeDeserialize(INodeDefManager *ndef)
UASSERT(schem2.size == size);
for (size_t i = 0; i != volume; i++)
UASSERT(schem2.schemdata[i] == schem.schemdata[i]);
for (size_t y = 0; y != size.Y; y++)
for (s16 y = 0; y != size.Y; y++)
UASSERTEQ(u8, schem2.slice_probs[y], schem.slice_probs[y]);
}