Changeset: 17c3cf62b1bd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/17c3cf62b1bd
Modified Files:
common/utils/matomic.h
gdk/gdk_cand.h
monetdb5/mal/mal_prelude.c
monetdb5/mal/mal_prelude.h
monetdb_config.h.in
Branch: default
Log Message:
Various changes to accommodate C++ extensions.
diffs (158 lines):
diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -62,6 +62,22 @@
* Windows since otherwise we can't compile this at all in C99 mode */
#if defined(HAVE_STDATOMIC_H) && (!defined(__STDC_NO_ATOMICS__) ||
(defined(__INTEL_COMPILER) && defined(_WINDOWS))) &&
!defined(NO_ATOMIC_INSTRUCTIONS)
+#ifdef __cplusplus
+
+#include <atomic>
+
+#if SIZEOF_LONG_LONG == 8
+typedef atomic_ullong ATOMIC_TYPE;
+typedef unsigned long long ATOMIC_BASE_TYPE;
+#elif SIZEOF_LONG == 8
+typedef atomic_ulong ATOMIC_TYPE;
+typedef unsigned long ATOMIC_BASE_TYPE;
+#else
+#error "we need a 64 bit atomic type"
+#endif
+
+#else
+
#include <stdatomic.h>
#if SIZEOF_LONG_LONG == 8
@@ -105,6 +121,8 @@ typedef volatile atomic_flag ATOMIC_FLAG
#define ATOMIC_CLEAR(var) atomic_flag_clear(var)
#define ATOMIC_TAS(var) atomic_flag_test_and_set(var)
+#endif /* __cplusplus */
+
#elif defined(_MSC_VER) && !defined(NO_ATOMIC_INSTRUCTIONS)
typedef uint64_t ATOMIC_BASE_TYPE;
diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -33,6 +33,13 @@ typedef struct {
#define ccand_first(b) ((b)->tvheap->base + sizeof(ccand_t))
#define ccand_free(b) ((b)->tvheap->free - sizeof(ccand_t))
+enum cand_type {
+ cand_dense, /* simple dense BAT, i.e. no look ups */
+ cand_materialized, /* simple materialized OID list */
+ cand_except, /* list of exceptions in vheap */
+ cand_mask, /* bitmask (TYPE_msk) bat as candidate list */
+};
+
struct canditer {
BAT *s; /* candidate BAT the iterator is based on */
union {
@@ -55,12 +62,7 @@ struct canditer {
BUN nvals; /* number of values in .oids/.mask */
BUN ncand; /* number of candidates */
BUN next; /* next BUN to return value for */
- enum {
- cand_dense, /* simple dense BAT, i.e. no look ups */
- cand_materialized, /* simple materialized OID list */
- cand_except, /* list of exceptions in vheap */
- cand_mask, /* bitmask (TYPE_msk) bat as candidate list */
- } tpe;
+ enum cand_type tpe;
};
/* returns the position of the lowest order bit in x, i.e. the
diff --git a/monetdb5/mal/mal_prelude.c b/monetdb5/mal/mal_prelude.c
--- a/monetdb5/mal/mal_prelude.c
+++ b/monetdb5/mal/mal_prelude.c
@@ -26,7 +26,7 @@
#define MAX_MAL_MODULES 128
static int mel_modules = 0;
static struct mel_module {
- char *name;
+ const char *name;
mel_atom *atoms;
mel_func *funcs;
mel_init inits;
@@ -47,7 +47,7 @@ mal_startup(void)
*/
void
-mal_module2(str name, mel_atom *atoms, mel_func *funcs, mel_init initfunc,
const char *code)
+mal_module2(const char *name, mel_atom *atoms, mel_func *funcs, mel_init
initfunc, const char *code)
{
assert (mel_modules < MAX_MAL_MODULES);
mel_module[mel_modules].name = name;
@@ -59,7 +59,7 @@ mal_module2(str name, mel_atom *atoms, m
}
void
-mal_module(str name, mel_atom *atoms, mel_func *funcs)
+mal_module(const char *name, mel_atom *atoms, mel_func *funcs)
{
assert (mel_modules < MAX_MAL_MODULES);
mel_module[mel_modules].name = name;
@@ -71,7 +71,7 @@ mal_module(str name, mel_atom *atoms, me
}
static char *
-initModule(Client c, char *name)
+initModule(Client c, const char *name)
{
char *msg = MAL_SUCCEED;
@@ -240,7 +240,7 @@ addFunctions(mel_func *fcn){
sig->fcn = (MALfcn)fcn->imp;
if( fcn->unsafe)
mb->unsafeProp = 1;
-
+
/* add the return variables */
if(fcn->retc == 0){
int idx = newTmpVariable(mb, TYPE_void);
diff --git a/monetdb5/mal/mal_prelude.h b/monetdb5/mal/mal_prelude.h
--- a/monetdb5/mal/mal_prelude.h
+++ b/monetdb5/mal/mal_prelude.h
@@ -16,8 +16,8 @@
mal_export int mal_startup(void);
-mal_export void mal_module(str name, mel_atom *atoms, mel_func *funcs);
-mal_export void mal_module2(str name, mel_atom *atoms, mel_func *funcs,
mel_init initfunc, const char *code);
+mal_export void mal_module(const char *name, mel_atom *atoms, mel_func *funcs);
+mal_export void mal_module2(const char *name, mel_atom *atoms, mel_func
*funcs, mel_init initfunc, const char *code);
mal_export str malIncludeModules(Client c, char *modules[], int listing, int
embedded);
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -265,15 +265,25 @@
#define MONETDB5_PASSWDHASH_TOKEN @PASSWORD_BACKEND@
#ifndef _Noreturn
+#ifdef __cplusplus
+#define _Noreturn
+#else
#cmakedefine _Noreturn @_Noreturn@
#endif
-#ifndef __cplusplus
+#endif
/* Does your compiler support `inline' keyword? (C99 feature) */
#ifndef inline
+#ifdef __cplusplus
+#define inline
+#else
#cmakedefine inline @inline@
#endif
+#endif
/* Does your compiler support `restrict' keyword? (C99 feature) */
#ifndef restrict
+#ifdef __cplusplus
+#define restrict
+#else
#cmakedefine restrict @restrict@
#endif
#endif
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list