Changeset: 4bff20a702f1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4bff20a702f1
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_sample.c
gdk/gdk_setop.c
monetdb5/modules/kernel/bat5.c
monetdb5/modules/mal/txtsim.c
Branch: default
Log Message:
Don't mix enum and int since icc doesn't like that.
diffs (truncated from 340 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -657,7 +657,7 @@ typedef uint64_t BUN8type;
*/
typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
-#define ERRORcheck(tst, msg) do if (tst) { GDKerror(msg); return 0; }
while (0)
+#define ERRORcheck(tst, msg, err) do if (tst) { if (msg) GDKerror(msg);
return (err); } while (0)
#define BATcheck(tst, msg) \
do { \
if ((tst) == NULL) { \
@@ -686,10 +686,10 @@ typedef enum { GDK_FAIL, GDK_SUCCEED } g
ATOMname(t2), ATOMname(t1)); \
} \
} while (0)
-#define BATcompatible(P1,P2) \
+#define BATcompatible(P1,P2,E) \
do { \
- ERRORcheck((P1) == NULL, "BATcompatible: BAT required\n"); \
- ERRORcheck((P2) == NULL, "BATcompatible: BAT required\n"); \
+ ERRORcheck((P1) == NULL, "BATcompatible: BAT required\n", E); \
+ ERRORcheck((P2) == NULL, "BATcompatible: BAT required\n", E); \
if (TYPEerror(BAThtype(P1),BAThtype(P2)) || \
TYPEerror(BATttype(P1),BATttype(P2))) \
{ \
@@ -2908,10 +2908,10 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
#define ALIGNset(x,y) do {ALIGNsetH(x,y);ALIGNsetT(x,y);} while (0)
#define ALIGNsetT(x,y) ALIGNsetH(BATmirror(x),BATmirror(y))
-#define ALIGNins(x,y,f) do {if (!(f))
VIEWchk(x,y,BAT_READ);(x)->halign=(x)->talign=0; } while (0)
-#define ALIGNdel(x,y,f) do {if (!(f))
VIEWchk(x,y,BAT_READ|BAT_APPEND);(x)->halign=(x)->talign=0; } while (0)
-#define ALIGNinp(x,y,f) do {if (!(f))
VIEWchk(x,y,BAT_READ|BAT_APPEND);(x)->talign=0; } while (0)
-#define ALIGNapp(x,y,f) do {if (!(f)) VIEWchk(x,y,BAT_READ);(x)->talign=0; }
while (0)
+#define ALIGNins(x,y,f,e) do {if (!(f))
VIEWchk(x,y,BAT_READ,e);(x)->halign=(x)->talign=0; } while (0)
+#define ALIGNdel(x,y,f,e) do {if (!(f))
VIEWchk(x,y,BAT_READ|BAT_APPEND,e);(x)->halign=(x)->talign=0; } while (0)
+#define ALIGNinp(x,y,f,e) do {if (!(f))
VIEWchk(x,y,BAT_READ|BAT_APPEND,e);(x)->talign=0; } while (0)
+#define ALIGNapp(x,y,f,e) do {if (!(f))
VIEWchk(x,y,BAT_READ,e);(x)->talign=0; } while (0)
#define BAThrestricted(b) (VIEWhparent(b) ?
BBP_cache(VIEWhparent(b))->batRestricted : (b)->batRestricted)
#define BATtrestricted(b) (VIEWtparent(b) ?
BBP_cache(VIEWtparent(b))->batRestricted : (b)->batRestricted)
@@ -2922,12 +2922,12 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
* BAT_READ = read-only
* VIEW bats are always mapped read-only.
*/
-#define VIEWchk(x,y,z)
\
+#define VIEWchk(x,y,z,e)
\
do { \
if ((((x)->batRestricted & (z)) != 0) | ((x)->batSharecnt > 0))
{ \
GDKerror("%s: access denied to %s, aborting.\n", \
(y), BATgetId(x)); \
- return 0; \
+ return (e); \
} \
} while (0)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -304,9 +304,9 @@ BATnew(int ht, int tt, BUN cap, int role
assert(cap <= BUN_MAX);
assert(ht != TYPE_bat);
assert(tt != TYPE_bat);
- ERRORcheck((ht < 0) || (ht > GDKatomcnt), "BATnew:ht error\n");
- ERRORcheck((tt < 0) || (tt > GDKatomcnt), "BATnew:tt error\n");
- ERRORcheck(role < 0 || role >= 32, "BATnew:role error\n");
+ ERRORcheck((ht < 0) || (ht > GDKatomcnt), "BATnew:ht error\n", NULL);
+ ERRORcheck((tt < 0) || (tt > GDKatomcnt), "BATnew:tt error\n", NULL);
+ ERRORcheck(role < 0 || role >= 32, "BATnew:role error\n", NULL);
/* round up to multiple of BATTINY */
if (cap < BUN_MAX - BATTINY)
@@ -330,19 +330,19 @@ BATattach(int tt, const char *heapfile,
BUN cap;
char *path;
- ERRORcheck(tt <= 0 , "BATattach: bad tail type (<=0)\n");
- ERRORcheck(ATOMvarsized(tt), "BATattach: bad tail type (varsized)\n");
- ERRORcheck(heapfile == 0, "BATattach: bad heapfile name\n");
- ERRORcheck(role < 0 || role >= 32, "BATattach: role error\n");
+ ERRORcheck(tt <= 0 , "BATattach: bad tail type (<=0)\n", NULL);
+ ERRORcheck(ATOMvarsized(tt), "BATattach: bad tail type (varsized)\n",
NULL);
+ ERRORcheck(heapfile == 0, "BATattach: bad heapfile name\n", NULL);
+ ERRORcheck(role < 0 || role >= 32, "BATattach: role error\n", NULL);
if (lstat(heapfile, &st) < 0) {
GDKerror("BATattach: cannot stat heapfile\n");
return 0;
}
- ERRORcheck(!S_ISREG(st.st_mode), "BATattach: heapfile must be a regular
file\n");
- ERRORcheck(st.st_nlink != 1, "BATattach: heapfile must have only one
link\n");
+ ERRORcheck(!S_ISREG(st.st_mode), "BATattach: heapfile must be a regular
file\n", NULL);
+ ERRORcheck(st.st_nlink != 1, "BATattach: heapfile must have only one
link\n", NULL);
atomsize = ATOMsize(tt);
- ERRORcheck(st.st_size % atomsize != 0, "BATattach: heapfile size not
integral number of atoms\n");
- ERRORcheck((size_t) (st.st_size / atomsize) > (size_t) BUN_MAX,
"BATattach: heapfile too large\n");
+ ERRORcheck(st.st_size % atomsize != 0, "BATattach: heapfile size not
integral number of atoms\n", NULL);
+ ERRORcheck((size_t) (st.st_size / atomsize) > (size_t) BUN_MAX,
"BATattach: heapfile too large\n", NULL);
cap = (BUN) (st.st_size / atomsize);
bs = BATcreatedesc(TYPE_void, tt, 1, role);
if (bs == NULL)
@@ -1219,7 +1219,7 @@ BUNins(BAT *b, const void *h, const void
return GDK_FAIL;
}
- ALIGNins(b, "BUNins", force);
+ ALIGNins(b, "BUNins", force, GDK_FAIL);
b->batDirty = 1;
if (b->H->hash && b->H->vheap)
hsize = b->H->vheap->size;
@@ -1311,7 +1311,7 @@ BUNappend(BAT *b, const void *t, bit for
}
i = p;
- ALIGNapp(b, "BUNappend", force);
+ ALIGNapp(b, "BUNappend", force, GDK_FAIL);
b->batDirty = 1;
countonly = (b->htype == TYPE_void && b->ttype == TYPE_void);
if (b->H->hash && b->H->vheap)
@@ -1390,7 +1390,7 @@ BUNdelete_(BAT *b, BUN p, bit force)
BUN l, last = BUNlast(b) - 1;
BUN idx1, idx2;
- ALIGNdel(b, "BUNdelete", force); /* zap alignment info */
+ ALIGNdel(b, "BUNdelete", force, BUN_NONE); /* zap alignment info */
/*
* @- Committed Delete.
@@ -1562,7 +1562,7 @@ BUNdel(BAT *b, const void *x, const void
BATcheck(x, "BUNdel: head value is nil");
if ((p = BUNlocate(b, x, y)) != BUN_NONE) {
- ALIGNdel(b, "BUNdel", force); /* zap alignment info */
+ ALIGNdel(b, "BUNdel", force, GDK_FAIL); /* zap alignment info */
BUNdelete(b, p, force);
return GDK_SUCCEED;
}
@@ -1586,7 +1586,7 @@ BUNdelHead(BAT *b, const void *x, bit fo
x = ATOMnilptr(b->htype);
}
if ((p = BUNfnd(bm, x)) != BUN_NONE) {
- ALIGNdel(b, "BUNdelHead", force); /* zap alignment info */
+ ALIGNdel(b, "BUNdelHead", force, GDK_FAIL); /* zap
alignment info */
do {
BUNdelete(b, p, force);
} while ((p = BUNfnd(bm, x)) != BUN_NONE);
@@ -1623,7 +1623,7 @@ BUNinplace(BAT *b, BUN p, const void *h,
int tt;
BUN prv, nxt;
- ALIGNinp(b, "BUNreplace", force); /* zap alignment info */
+ ALIGNinp(b, "BUNreplace", force, GDK_FAIL); /* zap
alignment info */
if (b->T->nil &&
atom_CMP(BUNtail(bi, p), ATOMnilptr(b->ttype), b->ttype) ==
0 &&
atom_CMP(t, ATOMnilptr(b->ttype), b->ttype) != 0) {
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -414,8 +414,8 @@ BATins(BAT *b, BAT *n, bit force)
GDKerror("BATins: input must be (V)OID headed\n");
return GDK_FAIL;
}
- ALIGNins(b, "BATins", force);
- BATcompatible(b, n);
+ ALIGNins(b, "BATins", force, GDK_FAIL);
+ BATcompatible(b, n, GDK_FAIL);
countonly = (b->htype == TYPE_void && b->ttype == TYPE_void);
@@ -646,8 +646,8 @@ BATappend(BAT *b, BAT *n, bit force)
GDKerror("BATappend: input must be (V)OID headed\n");
return GDK_FAIL;
}
- ALIGNapp(b, "BATappend", force);
- BATcompatible(b, n);
+ ALIGNapp(b, "BATappend", force, GDK_FAIL);
+ BATcompatible(b, n, GDK_FAIL);
if (BUNlast(b) + BATcount(n) > BUN_MAX) {
GDKerror("BATappend: combined BATs too large\n");
@@ -895,12 +895,12 @@ BATappend(BAT *b, BAT *n, bit force)
gdk_return
BATdel(BAT *b, BAT *n, bit force)
{
- ERRORcheck(b == NULL, "set:BAT required\n");
- ERRORcheck(n == NULL, "set:BAT required\n");
+ ERRORcheck(b == NULL, "set:BAT required\n", GDK_FAIL);
+ ERRORcheck(n == NULL, "set:BAT required\n", GDK_FAIL);
if (BATcount(n) == 0) {
return GDK_SUCCEED;
}
- ALIGNdel(b, "BATdel", force);
+ ALIGNdel(b, "BATdel", force, GDK_FAIL);
TYPEcheck(b->htype, n->htype);
TYPEcheck(b->ttype, n->ttype);
updateloop(b, n, bundel);
@@ -918,7 +918,7 @@ BATreplace(BAT *b, BAT *n, bit force)
if (b == NULL || n == NULL || BATcount(n) == 0) {
return GDK_SUCCEED;
}
- BATcompatible(b, n);
+ BATcompatible(b, n, GDK_FAIL);
updateloop(b, n, BUNreplace_force);
return GDK_SUCCEED;
@@ -1191,7 +1191,7 @@ BATorder_internal(BAT *b, int stable, in
b->tsorted = b->trevsorted = 0;
HASHdestroy(b);
IMPSdestroy(b);
- ALIGNdel(b, func, FALSE);
+ ALIGNdel(b, func, FALSE, NULL);
b->hdense = 0;
b->tdense = 0;
b->batDirtydesc = b->H->heap.dirty = b->T->heap.dirty = TRUE;
@@ -1533,7 +1533,7 @@ BATrevert(BAT *b)
if (BATmaterialize(b) == GDK_FAIL)
return GDK_FAIL;
}
- ALIGNdel(b, "BATrevert", FALSE);
+ ALIGNdel(b, "BATrevert", FALSE, GDK_FAIL);
s = Hsize(b);
if (s > 0) {
h = (char *) GDKmalloc(s);
@@ -1618,17 +1618,17 @@ BATmark_grp(BAT *g, BAT *e, const oid *s
BATcheck(g, "BATmark_grp");
BATcheck(e, "BATmark_grp");
ERRORcheck(g->ttype != TYPE_void && g->ttype != TYPE_oid,
- "BATmark_grp: tail of BAT g must be oid.\n");
+ "BATmark_grp: tail of BAT g must be oid.\n", NULL);
ERRORcheck(e->htype != TYPE_void && e->htype != TYPE_oid,
- "BATmark_grp: head of BAT e must be oid.\n");
+ "BATmark_grp: head of BAT e must be oid.\n", NULL);
ERRORcheck(g->ttype == TYPE_void && g->tseqbase == oid_nil,
- "BATmark_grp: tail of BAT g must not be nil.\n");
+ "BATmark_grp: tail of BAT g must not be nil.\n", NULL);
ERRORcheck(e->htype == TYPE_void && e->hseqbase == oid_nil,
- "BATmark_grp: head of BAT e must not be nil.\n");
+ "BATmark_grp: head of BAT e must not be nil.\n", NULL);
ERRORcheck(s && *s == oid_nil,
- "BATmark_grp: base oid s must not be nil.\n");
+ "BATmark_grp: base oid s must not be nil.\n", NULL);
ERRORcheck(!s && e->ttype != TYPE_oid,
- "BATmark_grp: tail of BAT e must be oid.\n");
+ "BATmark_grp: tail of BAT e must be oid.\n", NULL);
assert(BAThdense(g));
assert(BAThdense(e));
diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -128,7 +128,7 @@ BATsample(BAT *b, BUN n)
BATcheck(b, "BATsample");
assert(BAThdense(b));
- ERRORcheck(n > BUN_MAX, "BATsample: sample size larger than BUN_MAX\n");
+ ERRORcheck(n > BUN_MAX, "BATsample: sample size larger than BUN_MAX\n",
NULL);
ALGODEBUG
fprintf(stderr, "#BATsample: sample " BUNFMT " elements.\n", n);
diff --git a/gdk/gdk_setop.c b/gdk/gdk_setop.c
--- a/gdk/gdk_setop.c
+++ b/gdk/gdk_setop.c
@@ -462,9 +462,9 @@ diff_intersect(BAT *l, BAT *r, int diff)
BUN smaller;
BAT *bn;
- ERRORcheck(l == NULL, "diff_intersect: left is null");
- ERRORcheck(r == NULL, "diff_intersect: right is null");
- ERRORcheck(TYPEerror(BAThtype(l), BAThtype(r)), "diff_intersect:
incompatible head-types");
+ ERRORcheck(l == NULL, "diff_intersect: left is null", NULL);
+ ERRORcheck(r == NULL, "diff_intersect: right is null", NULL);
+ ERRORcheck(TYPEerror(BAThtype(l), BAThtype(r)), "diff_intersect:
incompatible head-types", NULL);
if (BATcount(r) == 0) {
return diff ? BATcopy(l, l->htype, l->ttype, FALSE, TRANSIENT)
: BATclone(l, 10, TRANSIENT);
@@ -547,7 +547,7 @@ BATkunion(BAT *l, BAT *r)
BATiter li, ri;
int ht, tt;
- BATcompatible(l, r);
+ BATcompatible(l, r, NULL);
if (BATcount(l) == 0) {
b = l;
l = r;
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -1299,7 +1299,7 @@ BKCsetAccess(bat *res, const bat *bid, c
*res = 0;
throw(MAL, "bat.setAccess", ILLEGAL_ARGUMENT " Got %c" "
expected 'r','a', or 'w'", *param[0]);
}
- if (setaccess(b, m) == GDK_FAIL)
+ if ((b = setaccess(b, m)) == NULL)
throw(MAL, "bat.setAccess", OPERATION_FAILED);
BBPkeepref(*res = b->batCacheid);
return MAL_SUCCEED;
diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -912,10 +912,10 @@ CMDqgramselfjoin(bat *res1, bat *res2, b
throw(MAL, "txtsim.qgramselfjoin", RUNTIME_OBJECT_MISSING);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list