Changeset: 7be1b00fbedb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7be1b00fbedb
Modified Files:
monetdb5/extras/pyapi/benchmark.c
monetdb5/extras/pyapi/pyapi.c
Branch: pyapi
Log Message:
Fixes for other compilers.
diffs (94 lines):
diff --git a/monetdb5/extras/pyapi/benchmark.c
b/monetdb5/extras/pyapi/benchmark.c
--- a/monetdb5/extras/pyapi/benchmark.c
+++ b/monetdb5/extras/pyapi/benchmark.c
@@ -1,19 +1,18 @@
#include "benchmark.h"
-#include <malloc.h>
-#include <string.h>
-#include <time.h>
+#include "monetdb_config.h"
static unsigned long long memtrace_current_memory_bytes = 0;
static unsigned long long memtrace_memory_peak = 0;
-static double benchmark_start_time = 0;
-static double benchmark_end_time = 0;
+
+#if defined(HAVE_MALLOC_H) && defined(HAVE_STRING_H)
+#include <string.h>
+#include <malloc.h>
#ifdef __MALLOC_DEPRECATED //if this isn't defined MALLOC_HOOKS aren't
supported, probably
// We are using malloc/free hooks which are deprecated, so we have to ignore
the warnings
// (This is obviously bad practice, but the alternative is having to recompile
Python and then tracing both PyMemAlloc/Realloc and GDKmalloc/realloc calls,
this is much easier, and we aren't using them in a thread context and no thread
safety is why they are deprecated in the first place)
-#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* Prototypes for our hooks. */
static void *my_malloc_hook (size_t, const void *);
@@ -121,24 +120,20 @@ static void my_free_hook (void *ptr, con
__malloc_hook = my_malloc_hook;
__free_hook = my_free_hook;
}
-#pragma GCC diagnostic pop
#else
-
void init_hook (void) {}
void revert_hook (void) {}
-
+#endif
+#else
+void init_hook (void) {}
+void revert_hook (void) {}
#endif
-unsigned long long GET_MEMORY_PEAK(void)
-{
- return memtrace_memory_peak;
-}
+#ifdef HAVE_TIME_H
+#include <time.h>
-unsigned long long GET_MEMORY_USAGE(void)
-{
- return memtrace_current_memory_bytes;
-}
-
+static double benchmark_start_time = 0;
+static double benchmark_end_time = 0;
double GET_ELAPSED_TIME(void)
{
return (double)(benchmark_end_time - benchmark_start_time) /
CLOCKS_PER_SEC;
@@ -153,3 +148,18 @@ void end_timer(void)
{
benchmark_end_time = clock();
}
+#else
+double GET_ELAPSED_TIME(void) { return 0; }
+void start_timer(void) { }
+void end_timer(void) { }
+#endif
+
+unsigned long long GET_MEMORY_PEAK(void)
+{
+ return memtrace_memory_peak;
+}
+
+unsigned long long GET_MEMORY_USAGE(void)
+{
+ return memtrace_current_memory_bytes;
+}
diff --git a/monetdb5/extras/pyapi/pyapi.c b/monetdb5/extras/pyapi/pyapi.c
--- a/monetdb5/extras/pyapi/pyapi.c
+++ b/monetdb5/extras/pyapi/pyapi.c
@@ -21,6 +21,10 @@
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+#ifdef __INTEL_COMPILER
+//intel compiler complains about trailing comma's in numpy source code, so
hopefully this works
+#pragma warning(disable:271)
+#endif
#include <numpy/arrayobject.h>
#include "unicode.h"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list