aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-02 06:46:45 -0700
committerJohannes Schickel2013-08-02 06:46:45 -0700
commit5a7bba35ed5c4402d064d3cb95fef622a12b3001 (patch)
treeec79f276b89e2ae09cf6d73174cc57bd69e798d0
parentcb7e9774b0200a7aa58df4508a992287375b1e12 (diff)
parent17ccd18ed3a41702ac7de7e55fca09578f734ccb (diff)
downloadscummvm-rg350-5a7bba35ed5c4402d064d3cb95fef622a12b3001.tar.gz
scummvm-rg350-5a7bba35ed5c4402d064d3cb95fef622a12b3001.tar.bz2
scummvm-rg350-5a7bba35ed5c4402d064d3cb95fef622a12b3001.zip
Merge pull request #363 from digitall/EnsurePI
Fix compilation with C++11 enabled on Win64 x86_64 toolchain... and probably others.
-rw-r--r--common/math.h8
-rw-r--r--common/scummsys.h13
2 files changed, 13 insertions, 8 deletions
diff --git a/common/math.h b/common/math.h
index b85ec0d22a..ba137101e4 100644
--- a/common/math.h
+++ b/common/math.h
@@ -52,14 +52,6 @@
#endif
#endif
-#ifndef M_SQRT1_2
- #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-#endif
-
-#ifndef M_PI
- #define M_PI 3.14159265358979323846
-#endif
-
#ifndef FLT_MIN
#define FLT_MIN 1E-37
#endif
diff --git a/common/scummsys.h b/common/scummsys.h
index 291de87dc9..099b12b291 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -144,6 +144,19 @@
#endif
#endif
+// The following math constants are usually defined by the system math.h header, but
+// they are not part of the ANSI C++ standards and so can NOT be relied upon to be
+// present i.e. when -std=c++11 is passed to GCC, enabling strict ANSI compliance.
+// As we rely on these being present, we define them if they are not set.
+
+#ifndef M_SQRT1_2
+ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+#endif
+
+#ifndef M_PI
+ #define M_PI 3.14159265358979323846
+#endif
+
// Include our C++11 compatability header for pre-C++11 compilers.
#if __cplusplus < 201103L
#include "common/c++11-compat.h"