summaryrefslogtreecommitdiff
path: root/thirdparty
diff options
context:
space:
mode:
authorHendrik Brucker <hendrik.brucker@mail.de>2022-04-30 16:43:16 +0200
committerHendrik Brucker <hendrik.brucker@mail.de>2022-04-30 16:43:16 +0200
commite41e2a110373a251cd0664f077ada6f344e5c8fd (patch)
tree67dba1f966a65afd709428aae79d33b95f61585f /thirdparty
parent722e2d3526a8a030050973ecf02ed0235a453f84 (diff)
Fix GCC warning with -Waggressive-loop-optimizations due to overflow
Diffstat (limited to 'thirdparty')
-rw-r--r--thirdparty/noise/FastNoiseLite.h9
-rw-r--r--thirdparty/noise/patches/FastNoiseLite.patch23
2 files changed, 32 insertions, 0 deletions
diff --git a/thirdparty/noise/FastNoiseLite.h b/thirdparty/noise/FastNoiseLite.h
index 8015bf636a..a213f0888e 100644
--- a/thirdparty/noise/FastNoiseLite.h
+++ b/thirdparty/noise/FastNoiseLite.h
@@ -1611,6 +1611,12 @@ private:
}
}
+// GCC raises warnings when integer overflows occur, which are needed for hashing here.
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
+#endif
+
template <typename FNfloat>
float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const
{
@@ -1765,6 +1771,9 @@ private:
}
}
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
// Perlin Noise
diff --git a/thirdparty/noise/patches/FastNoiseLite.patch b/thirdparty/noise/patches/FastNoiseLite.patch
index 41ec943077..3c835c7b06 100644
--- a/thirdparty/noise/patches/FastNoiseLite.patch
+++ b/thirdparty/noise/patches/FastNoiseLite.patch
@@ -430,3 +430,26 @@
{
x *= frequency;
y *= frequency;
+@@ -1611,6 +1611,12 @@ private:
+ }
+ }
+
++// GCC raises warnings when integer overflows occur, which are needed for hashing here.
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
++#endif
++
+ template <typename FNfloat>
+ float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const
+ {
+@@ -1765,6 +1771,9 @@ private:
+ }
+ }
+
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic pop
++#endif
+
+ // Perlin Noise
+ \ No newline at end of file