Changeset: 73da5d9a4d10 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73da5d9a4d10 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_heap.c gdk/gdk_posix.h gdk/gdk_private.h monetdb5/mal/mal_private.h monetdb5/mal/mal_readline.c monetdb5/modules/mal/pcre.c sql/storage/bat/bat_table.c sql/storage/restrict/restrict_table.c sql/storage/sql_storage.h Branch: default Log Message:
Merge with Jan2014 branch. diffs (truncated from 586 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -269,14 +269,14 @@ MT_Lock *volatile GDKlocklist; ATOMIC_FLAG volatile GDKlocklistlock; ATOMIC_TYPE volatile GDKlocksleepcnt; void GDKlockstatistics(int); -void *GDKmalloc(size_t size); +void *GDKmalloc(size_t size) __attribute__((__alloc_size__(1))); size_t GDKmem_cursize(void); -void *GDKmmap(const char *path, int mode, size_t len); +void *GDKmmap(const char *path, int mode, size_t len) __attribute__((__alloc_size__(3))); int GDKms(void); int GDKnr_threads; void GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); -void *GDKrealloc(void *pold, size_t size); +void *GDKrealloc(void *pold, size_t size) __attribute__((__alloc_size__(2))); void GDKsetenv(str name, str value); ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t len); str GDKstrdup(const char *s); @@ -287,7 +287,7 @@ lng GDKusec(void); BAT *GDKval; const char *GDKversion(void); size_t GDKvm_cursize(void); -void *GDKzalloc(size_t size); +void *GDKzalloc(size_t size) __attribute__((__alloc_size__(1))); void HASHdestroy(BAT *b); BUN HASHlist(Hash *h, BUN i); BUN HASHprobe(Hash *h, const void *v); @@ -319,7 +319,7 @@ void MT_locktrace_end(void); char *MT_locktrace_nme[65536]; void MT_locktrace_start(void); struct Mallinfo MT_mallinfo(void); -void *MT_mmap(const char *path, int mode, size_t len); +void *MT_mmap(const char *path, int mode, size_t len) __attribute__((__alloc_size__(3))); int MT_munmap(void *p, size_t len); int MT_path_absolute(const char *path); void MT_sleep_ms(unsigned int ms); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2236,7 +2236,8 @@ gdk_export lng IMPSimprintsize(BAT *b); #define GDK_HISTO_MAX_BIT ((int) (sizeof(size_t)<<3)) /* we prefer to use vm_alloc routines on size > GDKmmap */ -gdk_export void *GDKmmap(const char *path, int mode, size_t len); +gdk_export void *GDKmmap(const char *path, int mode, size_t len) + __attribute__((__alloc_size__(3))); gdk_export size_t GDK_mem_maxsize; /* max allowed size of committed memory */ gdk_export size_t GDK_vm_maxsize; /* max allowed size of reserved vm */ @@ -2245,13 +2246,16 @@ gdk_export int GDK_vm_trim; /* allow tr gdk_export size_t GDKmem_cursize(void); /* RAM/swapmem that MonetDB has claimed from OS */ gdk_export size_t GDKvm_cursize(void); /* current MonetDB VM address space usage */ -gdk_export void *GDKmalloc(size_t size); -gdk_export void *GDKzalloc(size_t size); -gdk_export void *GDKrealloc(void *pold, size_t size); +gdk_export void *GDKmalloc(size_t size) + __attribute__((__alloc_size__(1))); +gdk_export void *GDKzalloc(size_t size) + __attribute__((__alloc_size__(1))); +gdk_export void *GDKrealloc(void *pold, size_t size) + __attribute__((__alloc_size__(2))); gdk_export void GDKfree(void *blk); gdk_export str GDKstrdup(const char *s); -#ifndef NDEBUG +#if !defined(NDEBUG) && !defined(__clang_analyzer__) /* In debugging mode, replace GDKmalloc and other functions with a * version that optionally prints calling information. * @@ -3072,17 +3076,17 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b for (hb = HASHget(h, HASHprobe((h), v)); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (ATOMcmp(h->type, v, BUNhead(bi, hb)) == 0) + if (ATOMcmp(h->type, v, BUNhead(bi, hb)) != 0); else #define HASHloop_str_hv(bi, h, hb, v) \ for (hb = HASHget((h),((BUN *) (v))[-1]&(h)->mask); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (GDK_STREQ(v, BUNhvar(bi, hb))) + if (!GDK_STREQ(v, BUNhvar(bi, hb))); else #define HASHloop_str(bi, h, hb, v) \ for (hb = HASHget((h),strHash(v)&(h)->mask); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (GDK_STREQ(v, BUNhvar(bi, hb))) + if (!GDK_STREQ(v, BUNhvar(bi, hb))); else /* * For string search, we can optimize if the string heap has @@ -3094,7 +3098,7 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b #define HASHloop_fstr(bi, h, hb, idx, v) \ for (hb = HASHget(h, strHash(v)&h->mask), idx = strLocate((bi.b)->H->vheap,v); \ hb != HASHnil(h); hb = HASHgetlink(h,hb)) \ - if (VarHeapValRaw((bi).b->H->heap.base, hb, (bi).b->H->width) == idx) + if (VarHeapValRaw((bi).b->H->heap.base, hb, (bi).b->H->width) != idx); else /* * The following example shows how the hashloop is used: * @@ -3126,18 +3130,18 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b for (hb = HASHget(h, HASHprobe(h, v)); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (ATOMcmp(h->type, v, BUNhloc(bi, hb)) == 0) + if (ATOMcmp(h->type, v, BUNhloc(bi, hb)) != 0); else #define HASHloopvar(bi, h, hb, v) \ for (hb = HASHget(h,HASHprobe(h, v)); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (ATOMcmp(h->type, v, BUNhvar(bi, hb)) == 0) + if (ATOMcmp(h->type, v, BUNhvar(bi, hb)) != 0); else #define HASHloop_TYPE(bi, h, hb, v, TYPE) \ for (hb = HASHget(h, hash_##TYPE(h, v)); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (simple_EQ(v, BUNhloc(bi, hb), TYPE)) + if (!simple_EQ(v, BUNhloc(bi, hb), TYPE)); else #define HASHloop_bit(bi, h, hb, v) HASHloop_TYPE(bi, h, hb, v, bte) #define HASHloop_bte(bi, h, hb, v) HASHloop_TYPE(bi, h, hb, v, bte) @@ -3155,7 +3159,7 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b for (hb = HASHget(h, hash_any(h, v)); \ hb != HASHnil(h); \ hb = HASHgetlink(h,hb)) \ - if (atom_EQ(v, BUNhead(bi, hb), (bi).b->htype)) + if (!atom_EQ(v, BUNhead(bi, hb), (bi).b->htype)); else /* * @- loop over a BAT with ordered tail diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -236,6 +236,7 @@ HEAPextend(Heap *h, size_t size, int may int existing = 0; assert(h->storage == STORE_MEM); + assert(ext != NULL); h->filename = NULL; /* if the heap file already exists, we want to * switch to STORE_PRIV (copy-on-write memory diff --git a/gdk/gdk_posix.h b/gdk/gdk_posix.h --- a/gdk/gdk_posix.h +++ b/gdk/gdk_posix.h @@ -189,7 +189,8 @@ gdk_export void MT_sleep_ms(unsigned int gdk_export size_t MT_getrss(void); -gdk_export void *MT_mmap(const char *path, int mode, size_t len); +gdk_export void *MT_mmap(const char *path, int mode, size_t len) + __attribute__((__alloc_size__(3))); gdk_export int MT_munmap(void *p, size_t len); gdk_export int MT_path_absolute(const char *path); diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -35,81 +35,153 @@ struct BATstore { BATrec S; /* the BAT properties */ }; -int ALIGNcommit(BAT *b); -int ALIGNundo(BAT *b); -int ATOMheap(int id, Heap *hp, size_t cap); -int ATOMisdescendant(int id, int parentid); -int ATOMunknown_add(const char *nme); -int ATOMunknown_del(int a); -int ATOMunknown_find(const char *nme); -str ATOMunknown_name(int a); -int BATcheckmodes(BAT *b, int persistent); -BAT *BATclone(BAT *b, BUN capacity); -BATstore *BATcreatedesc(int ht, int tt, int heapnames); -void BATdestroy(BATstore *bs); -int BATfree(BAT *b); -gdk_return BATgroup_internal(BAT **groups, BAT **extents, BAT **histo, BAT *b, BAT *g, BAT *e, BAT *h, int subsorted); -BUN BATguess(BAT *b); -void BATinit_idents(BAT *bn); -BAT *BATload_intern(bat bid, int lock); -BAT *BATmaterializet(BAT *b); -void BATpropagate(BAT *dst, BAT *src, int idx); -str BATrename(BAT *b, const char *nme); -void BATsetdims(BAT *b); -size_t BATvmsize(BAT *b, int dirty); -void BBPcacheit(BATstore *bs, int lock); +int ALIGNcommit(BAT *b) + __attribute__((__visibility__("hidden"))); +int ALIGNundo(BAT *b) + __attribute__((__visibility__("hidden"))); +int ATOMheap(int id, Heap *hp, size_t cap) + __attribute__((__visibility__("hidden"))); +int ATOMisdescendant(int id, int parentid) + __attribute__((__visibility__("hidden"))); +int ATOMunknown_add(const char *nme) + __attribute__((__visibility__("hidden"))); +int ATOMunknown_del(int a) + __attribute__((__visibility__("hidden"))); +int ATOMunknown_find(const char *nme) + __attribute__((__visibility__("hidden"))); +str ATOMunknown_name(int a) + __attribute__((__visibility__("hidden"))); +int BATcheckmodes(BAT *b, int persistent) + __attribute__((__visibility__("hidden"))); +BAT *BATclone(BAT *b, BUN capacity) + __attribute__((__visibility__("hidden"))); +BATstore *BATcreatedesc(int ht, int tt, int heapnames) + __attribute__((__visibility__("hidden"))); +void BATdestroy(BATstore *bs) + __attribute__((__visibility__("hidden"))); +int BATfree(BAT *b) + __attribute__((__visibility__("hidden"))); +gdk_return BATgroup_internal(BAT **groups, BAT **extents, BAT **histo, BAT *b, BAT *g, BAT *e, BAT *h, int subsorted) + __attribute__((__visibility__("hidden"))); +BUN BATguess(BAT *b) + __attribute__((__visibility__("hidden"))); +void BATinit_idents(BAT *bn) + __attribute__((__visibility__("hidden"))); +BAT *BATload_intern(bat bid, int lock) + __attribute__((__visibility__("hidden"))); +BAT *BATmaterializet(BAT *b) + __attribute__((__visibility__("hidden"))); +void BATpropagate(BAT *dst, BAT *src, int idx) + __attribute__((__visibility__("hidden"))); +str BATrename(BAT *b, const char *nme) + __attribute__((__visibility__("hidden"))); +void BATsetdims(BAT *b) + __attribute__((__visibility__("hidden"))); +size_t BATvmsize(BAT *b, int dirty) + __attribute__((__visibility__("hidden"))); +void BBPcacheit(BATstore *bs, int lock) + __attribute__((__visibility__("hidden"))); void BBPdump(void); /* never called: for debugging only */ -void BBPexit(void); -BATstore *BBPgetdesc(bat i); -void BBPinit(void); -bat BBPinsert(BATstore *bs); -void BBPtrim(size_t delta); -void BBPunshare(bat b); -void GDKclrerr(void); -int GDKextend(const char *fn, size_t size); -int GDKextendf(int fd, size_t size); -int GDKfdlocate(const char *nme, const char *mode, const char *ext); -FILE *GDKfilelocate(const char *nme, const char *mode, const char *ext); -char *GDKload(const char *nme, const char *ext, size_t size, size_t *maxsize, storage_t mode); +void BBPexit(void) + __attribute__((__visibility__("hidden"))); +BATstore *BBPgetdesc(bat i) + __attribute__((__visibility__("hidden"))); +void BBPinit(void) + __attribute__((__visibility__("hidden"))); +bat BBPinsert(BATstore *bs) + __attribute__((__visibility__("hidden"))); +void BBPtrim(size_t delta) + __attribute__((__visibility__("hidden"))); +void BBPunshare(bat b) + __attribute__((__visibility__("hidden"))); +void GDKclrerr(void) + __attribute__((__visibility__("hidden"))); +int GDKextend(const char *fn, size_t size) + __attribute__((__visibility__("hidden"))); +int GDKextendf(int fd, size_t size) + __attribute__((__visibility__("hidden"))); +int GDKfdlocate(const char *nme, const char *mode, const char *ext) + __attribute__((__visibility__("hidden"))); +FILE *GDKfilelocate(const char *nme, const char *mode, const char *ext) + __attribute__((__visibility__("hidden"))); +char *GDKload(const char *nme, const char *ext, size_t size, size_t *maxsize, storage_t mode) + __attribute__((__visibility__("hidden"))); void GDKlog(_In_z_ _Printf_format_string_ const char *format, ...) - __attribute__((__format__(__printf__, 1, 2))); -void *GDKmallocmax(size_t size, size_t *maxsize, int emergency); -int GDKmove(const char *dir1, const char *nme1, const char *ext1, const char *dir2, const char *nme2, const char *ext2); -int GDKmunmap(void *addr, size_t len); -void *GDKreallocmax(void *pold, size_t size, size_t *maxsize, int emergency); -int GDKremovedir(const char *nme); -int GDKsave(const char *nme, const char *ext, void *buf, size_t size, storage_t mode); -int GDKssort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); -int GDKssort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); -int GDKunlink(const char *dir, const char *nme, const char *extension); -int HASHgonebad(BAT *b, const void *v); -BUN HASHmask(BUN cnt); -Hash *HASHnew(Heap *hp, int tpe, BUN size, BUN mask); -void HASHremove(BAT *b); -int HEAPalloc(Heap *h, size_t nitems, size_t itemsize); -int HEAPcopy(Heap *dst, Heap *src); -int HEAPdelete(Heap *h, const char *o, const char *ext); -int HEAPload(Heap *h, const char *nme, const char *ext, int trunc); -int HEAPsave(Heap *h, const char *nme, const char *ext); -int HEAPshrink(Heap *h, size_t size); -int HEAPwarm(Heap *h); -oid MAXoid(BAT *i); -void MT_init_posix(void); -void *MT_mremap(const char *path, int mode, void *old_address, size_t old_size, size_t *new_size); -int MT_msync(void *p, size_t len, int mode); -int OIDdirty(void); -int OIDinit(void); -oid OIDread(str buf); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list