Changeset: d12146e172a5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d12146e172a5
Modified Files:
NT/monetdb_config.h.in
gdk/gdk_atoms.c
gdk/gdk_atoms.h
gdk/gdk_utils.c
Branch: default
Log Message:
Work around issues with Intel compiler.
- On Windows, make sure mathimf.h is included before there is any chance
math.h is included.
- On both Windows and Linux, initialize flt_nil and dbl_nil to NAN at
run time, since the Intel compiler uses a value that cannot be used
as static initializer.
diffs (73 lines):
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -33,6 +33,12 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
+/* include Intel's mathimf.h early, before any other include files
+ * might try to include math.h */
+#ifdef __INTEL_COMPILER
+#include <mathimf.h>
+#endif
+
#include <malloc.h>
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -251,8 +251,15 @@ ATOMisdescendant(int tpe, int parent)
const bte bte_nil = GDK_bte_min-1;
const sht sht_nil = GDK_sht_min-1;
const int int_nil = GDK_int_min-1;
+#ifdef __INTEL_COMPILER
+/* stupid Intel compiler uses a value that cannot be used in an
+ * initializer for NAN, so we have to initialize at run time */
+flt flt_nil;
+dbl dbl_nil;
+#else
const flt flt_nil = NAN;
const dbl dbl_nil = NAN;
+#endif
const lng lng_nil = GDK_lng_min-1;
#ifdef HAVE_HGE
const hge hge_nil = GDK_hge_min-1;
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -106,8 +106,15 @@ gdk_export size_t escapedStr(char *dst,
gdk_export const bte bte_nil;
gdk_export const sht sht_nil;
gdk_export const int int_nil;
-gdk_export const flt flt_nil;
-gdk_export const dbl dbl_nil;
+#ifdef __INTEL_COMPILER
+/* stupid Intel compiler uses a value that cannot be used in an
+ * initializer for NAN, so we have to initialize at run time */
+#define NANCONST
+#else
+#define NANCONST const
+#endif
+gdk_export NANCONST flt flt_nil;
+gdk_export NANCONST dbl dbl_nil;
gdk_export const lng lng_nil;
#ifdef HAVE_HGE
gdk_export const hge hge_nil;
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -449,6 +449,13 @@ GDKinit(opt *set, int setlen)
assert(sizeof(size_t) == SIZEOF_SIZE_T);
assert(SIZEOF_OID == SIZEOF_INT || SIZEOF_OID == SIZEOF_LNG);
+#ifdef __INTEL_COMPILER
+ /* stupid Intel compiler uses a value that cannot be used in an
+ * initializer for NAN, so we have to initialize at run time */
+ flt_nil = NAN;
+ dbl_nil = NAN;
+#endif
+
#ifdef NEED_MT_LOCK_INIT
MT_lock_init(&MT_system_lock,"MT_system_lock");
ATOMIC_INIT(GDKstoppedLock);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list