Fix GCC class-memaccess warnings (#10239)

This commit is contained in:
Paul Ouellette 2020-08-01 11:25:33 -04:00 committed by GitHub
parent aba8c37531
commit 542df11bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

@ -419,7 +419,14 @@ static void getNodeVertexDirs(const v3s16 &dir, v3s16 *vertex_dirs)
u8 idx = (dir.X + 2 * dir.Y + 3 * dir.Z) & 7; u8 idx = (dir.X + 2 * dir.Y + 3 * dir.Z) & 7;
idx = (idx - 1) * 4; idx = (idx - 1) * 4;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memcpy(vertex_dirs, &vertex_dirs_table[idx], 4 * sizeof(v3s16)); memcpy(vertex_dirs, &vertex_dirs_table[idx], 4 * sizeof(v3s16));
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
} }
static void getNodeTextureCoords(v3f base, const v3f &scale, const v3s16 &dir, float *u, float *v) static void getNodeTextureCoords(v3f base, const v3f &scale, const v3s16 &dir, float *u, float *v)

@ -424,7 +424,7 @@ float NoisePerlin3D(NoiseParams *np, float x, float y, float z, s32 seed)
Noise::Noise(NoiseParams *np_, s32 seed, u32 sx, u32 sy, u32 sz) Noise::Noise(NoiseParams *np_, s32 seed, u32 sx, u32 sy, u32 sz)
{ {
memcpy(&np, np_, sizeof(np)); np = *np_;
this->seed = seed; this->seed = seed;
this->sx = sx; this->sx = sx;
this->sy = sy; this->sy = sy;