[gtk/gtk-3-24] gtkcssshadowvalue.c: Fix build on older Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24] gtkcssshadowvalue.c: Fix build on older Visual Studio
- Date: Thu, 16 Jul 2020 10:56:40 +0000 (UTC)
commit 6f54881851a2ac1e6fefb790d63d022ec5288ae9
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Jul 16 18:28:06 2020 +0800
gtkcssshadowvalue.c: Fix build on older Visual Studio
This code made use of isnan(), which is not provided by pre-2013 Visual
Studio, so fix the build by including fallback-c89.c in place of math.h,
and update fallback-c89.c to include the implementation of isnan() for
Visual Studio, which is copied from the fallback-c89.c in gdk/.
gtk/fallback-c89.c | 12 ++++++++++++
gtk/gtkcssshadowvalue.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/gtk/fallback-c89.c b/gtk/fallback-c89.c
index 3fb24ad8b0..737983c049 100644
--- a/gtk/fallback-c89.c
+++ b/gtk/fallback-c89.c
@@ -114,3 +114,15 @@ trunc (double x)
return (x > 0 ? floor (x) : ceil (x));
}
#endif
+
+#ifndef HAVE_DECL_ISNAN
+/* it seems of the supported compilers only
+ * MSVC does not have isnan(), but it does
+ * have _isnan() which does the same as isnan()
+ */
+static inline gboolean
+isnan (double x)
+{
+ return _isnan (x);
+}
+#endif
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 074ef2b909..864bdef4b4 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -29,7 +29,7 @@
#include "gtkrenderprivate.h"
#include "gtkpango.h"
-#include <math.h>
+#include "fallback-c89.c"
#include <float.h>
#define CORNER_MASK_CACHE_MAX_SIZE 2000U
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]