Changeset: c2d7ddd2809c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c2d7ddd2809c Added Files: sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case.Bug-6552.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case.Bug-6552.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-not-in.Bug-6553.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-not-in.Bug-6553.stable.out Modified Files: clients/mapiclient/dump.c configure.ag gdk/gdk.h gdk/gdk_bbp.c gdk/gdk_heap.c gdk/gdk_logger.c gdk/gdk_private.h gdk/gdk_system.c gdk/gdk_utils.c geom/monetdb5/geom.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_profiler.c monetdb5/modules/atoms/url.c monetdb5/modules/mal/tablet.c sql/backends/monet5/UDF/pyapi/emit.c sql/backends/monet5/UDF/pyapi/pyapi.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_result.c sql/backends/monet5/vaults/shp/shp.c sql/backends/monet5/vaults/vault.c sql/server/rel_select.c sql/server/sql_scan.c tools/mserver/mserver5.c Branch: default Log Message:
Merge with Mar2018 branch. diffs (truncated from 756 to 300 lines): diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -38,7 +38,7 @@ quoted_print(stream *f, const char *s, b break; default: if ((0 < *s && *s < 32) || *s == '\177') - mnstr_printf(f, "\\%03o", *s & 0377); + mnstr_printf(f, "\\%03o", (uint8_t) *s); else mnstr_write(f, s, 1, 1); break; diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -590,10 +590,13 @@ AS_VAR_IF([enable_strict], [yes], [ MCHECK_ADD_FLAG([-Werror-implicit-function-declaration]) MCHECK_ADD_FLAG([-Wpointer-arith]) -dnl MCHECK_ADD_FLAG([-Wdeclaration-after-statement]) MCHECK_ADD_FLAG([-Wundef]) MCHECK_ADD_FLAG([-Wformat=2]) + MCHECK_ADD_FLAG([-Wformat-overflow=1]) + MCHECK_ADD_FLAG([-Wno-format-truncation]) MCHECK_ADD_FLAG([-Wno-format-nonliteral]) +dnl MCHECK_ADD_FLAG([-Wformat-signedness]) -- numpy messes this up + MCHECK_ADD_FLAG([-Wno-cast-function-type]) MCHECK_ADD_FLAG([-Winit-self]) MCHECK_ADD_FLAG([-Winvalid-pch]) MCHECK_ADD_FLAG([-Wmissing-declarations]) diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -797,15 +797,15 @@ typedef struct { /* assert that atom width is power of 2, i.e., width == 1<<shift */ #define assert_shift_width(shift,width) assert(((shift) == 0 && (width) == 0) || ((unsigned)1<<(shift)) == (unsigned)(width)) -#define GDKLIBRARY_SORTEDPOS 061030 /* version where we can't trust no(rev)sorted */ -#define GDKLIBRARY_OLDWKB 061031 /* old geom WKB format */ -#define GDKLIBRARY_INSERTED 061032 /* inserted and deleted in BBP.dir */ -#define GDKLIBRARY_HEADED 061033 /* head properties are stored */ -#define GDKLIBRARY_NOKEY 061034 /* nokey values can't be trusted */ -#define GDKLIBRARY_BADEMPTY 061035 /* possibility of duplicate empty str */ -#define GDKLIBRARY_TALIGN 061036 /* talign field in BBP.dir */ -#define GDKLIBRARY_NIL_NAN 061037 /* flt/dbl NIL not represented by NaN */ -#define GDKLIBRARY 061040 +#define GDKLIBRARY_SORTEDPOS 061030U /* version where we can't trust no(rev)sorted */ +#define GDKLIBRARY_OLDWKB 061031U /* old geom WKB format */ +#define GDKLIBRARY_INSERTED 061032U /* inserted and deleted in BBP.dir */ +#define GDKLIBRARY_HEADED 061033U /* head properties are stored */ +#define GDKLIBRARY_NOKEY 061034U /* nokey values can't be trusted */ +#define GDKLIBRARY_BADEMPTY 061035U /* possibility of duplicate empty str */ +#define GDKLIBRARY_TALIGN 061036U /* talign field in BBP.dir */ +#define GDKLIBRARY_NIL_NAN 061037U /* flt/dbl NIL not represented by NaN */ +#define GDKLIBRARY 061040U typedef struct BAT { /* static bat properties */ @@ -2037,7 +2037,8 @@ gdk_export str GDKstrndup(const char *s, fprintf(stderr, \ "#GDKmmap(%s,0x%x,%zu) -> %p" \ " %s[%s:%d]\n", \ - _path ? _path : "NULL", _mode, _len, \ + _path ? _path : "NULL", \ + (unsigned) _mode, _len, \ _res, \ __func__, __FILE__, __LINE__); \ _res; \ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1114,7 +1114,7 @@ headheapinit(oid *hseq, const char *buf, } static int -heapinit(BAT *b, const char *buf, int *hashash, const char *HT, int bbpversion, bat bid, const char *filename) +heapinit(BAT *b, const char *buf, int *hashash, const char *HT, unsigned bbpversion, bat bid, const char *filename) { int t; char type[11]; @@ -1241,7 +1241,7 @@ vheapinit(BAT *b, const char *buf, int h } static void -BBPreadEntries(FILE *fp, int bbpversion) +BBPreadEntries(FILE *fp, unsigned bbpversion) { bat bid = 0; char buf[4096]; @@ -1369,7 +1369,7 @@ BBPreadEntries(FILE *fp, int bbpversion) BBP_desc(bid) = bn; BBP_status(bid) = BBPEXISTING; /* do we need other status bits? */ if ((s = strchr(headname, '~')) != NULL && s == headname) { - snprintf(logical, sizeof(logical), "tmp_%o", (int) bid); + snprintf(logical, sizeof(logical), "tmp_%o", (unsigned) bid); } else { if (s) *s = 0; @@ -1399,17 +1399,18 @@ BBPreadEntries(FILE *fp, int bbpversion) #define SIZEOF_MAX_INT SIZEOF_LNG #endif -static int +static unsigned BBPheader(FILE *fp) { char buf[BUFSIZ]; - int sz, bbpversion, ptrsize, oidsize, intsize; + int sz, ptrsize, oidsize, intsize; + unsigned bbpversion; char *s; if (fgets(buf, sizeof(buf), fp) == NULL) { GDKfatal("BBPinit: BBP.dir is empty"); } - if (sscanf(buf, "BBP.dir, GDKversion %d\n", &bbpversion) != 1) { + if (sscanf(buf, "BBP.dir, GDKversion %u\n", &bbpversion) != 1) { GDKerror("BBPinit: old BBP without version number"); GDKerror("dump the database using a compatible version,"); GDKerror("then restore into new database using this version.\n"); @@ -1535,7 +1536,7 @@ BBPinit(void) { FILE *fp = NULL; struct stat st; - int bbpversion; + unsigned bbpversion; str bbpdirstr = GDKfilepath(0, BATDIR, "BBP", "dir"); str backupbbpdirstr = GDKfilepath(0, BAKDIR, "BBP", "dir"); int i; @@ -1803,7 +1804,7 @@ new_bbpentry(FILE *fp, bat i, const char static gdk_return BBPdir_header(FILE *f, int n) { - if (fprintf(f, "BBP.dir, GDKversion %d\n%d %d %d\nBBPsize=%d\n", + if (fprintf(f, "BBP.dir, GDKversion %u\n%d %d %d\nBBPsize=%d\n", GDKLIBRARY, SIZEOF_SIZE_T, SIZEOF_OID, #ifdef HAVE_HGE havehge ? SIZEOF_HGE : @@ -2303,7 +2304,7 @@ BBPinsert(BAT *bn) #endif if (*BBP_bak(i) == 0) - snprintf(BBP_bak(i), sizeof(BBP_bak(i)), "tmp_%o", (int) i); + snprintf(BBP_bak(i), sizeof(BBP_bak(i)), "tmp_%o", (unsigned) i); BBP_logical(i) = BBP_bak(i); /* Keep the physical location around forever */ @@ -2312,10 +2313,10 @@ BBPinsert(BAT *bn) if (*dirname) /* i.e., i >= 0100 */ snprintf(BBP_physical(i), sizeof(BBP_physical(i)), - "%s%c%o", dirname, DIR_SEP, i); + "%s%c%o", dirname, DIR_SEP, (unsigned) i); else snprintf(BBP_physical(i), sizeof(BBP_physical(i)), - "%o", i); + "%o", (unsigned) i); BATDEBUG fprintf(stderr, "#%d = new %s(%s)\n", (int) i, BBPname(i), ATOMname(bn->ttype)); } @@ -3431,7 +3432,7 @@ BBPsync(int cnt, bat *subcommit) } else if (subcommit && (b = BBP_desc(i)) && BBP_status(i) & BBPDELETED) { char o[10]; char *f; - snprintf(o, sizeof(o), "%o", b->batCacheid); + snprintf(o, sizeof(o), "%o", (unsigned) b->batCacheid); f = GDKfilepath(b->theap.farmid, BAKDIR, o, "tail"); if (access(f, F_OK) == 0) file_move(b->theap.farmid, BAKDIR, SUBDIR, o, "tail"); diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -132,7 +132,7 @@ HEAPalloc(Heap *h, size_t nitems, size_t char of[sizeof(h->filename)]; char *ext; close(fd); - strncpy(of, h->filename, sizeof(h->filename)); + strncpy(of, h->filename, sizeof(of)); #ifdef STATIC_CODE_ANALYSIS /* help coverity */ of[sizeof(h->filename) - 1] = 0; diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -1306,7 +1306,7 @@ logger_switch_bat(BAT *old, BAT *new, co GDKerror("Logger_new: cannot convert old %s to transient", name); return GDK_FAIL; } - snprintf(bak, sizeof(bak), "tmp_%o", old->batCacheid); + snprintf(bak, sizeof(bak), "tmp_%o", (unsigned) old->batCacheid); if (BBPrename(old->batCacheid, bak) != 0) { return GDK_FAIL; } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -323,7 +323,7 @@ extern MT_Lock MT_system_lock; gdk_return _res = GDKmunmap(_ptr, _len); \ ALLOCDEBUG \ fprintf(stderr, \ - "#GDKmunmap(%p,%zu) -> %d" \ + "#GDKmunmap(%p,%zu) -> %u" \ " %s[%s:%d]\n", \ _ptr, _len, _res, \ __func__, __FILE__, __LINE__); \ @@ -342,7 +342,7 @@ extern MT_Lock MT_system_lock; fprintf(stderr, \ "#GDKmremap(%s,0x%x,%p,%zu,%zu > %zu) -> %p" \ " %s[%s:%d]\n", \ - _path ? _path : "NULL", _mode, \ + _path ? _path : "NULL", (unsigned) _mode, \ _oa, _os, _ons, *_ns, \ _res, \ __func__, __FILE__, __LINE__); \ diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -467,7 +467,7 @@ rm_posthread_locked(struct posthread *p) *pp = p->next; } -static void +static void * thread_starter(void *arg) { struct posthread *p = (struct posthread *) arg; @@ -480,6 +480,19 @@ thread_starter(void *arg) if ((p = find_posthread_locked(tid)) != NULL) p->exited = 1; pthread_mutex_unlock(&posthread_lock); + return NULL; +} + +static void * +thread_starter_simple(void *arg) +{ + struct posthread *p = (struct posthread *) arg; + void (*pfunc)(void *) = p->func; + void *parg = p->arg; + + free(p); + (*pfunc)(parg); + return NULL; } static void @@ -537,6 +550,7 @@ MT_create_thread(MT_Id *t, void (*f) (vo pthread_t newt, *newtp; int ret; struct posthread *p = NULL; + void *(*pf) (void *); join_threads(); #ifdef HAVE_PTHREAD_SIGMASK @@ -553,39 +567,39 @@ MT_create_thread(MT_Id *t, void (*f) (vo pthread_attr_destroy(&attr); return -1; } - if (d == MT_THR_DETACHED) { - p = malloc(sizeof(struct posthread)); - if (p == NULL) { + p = malloc(sizeof(struct posthread)); + if (p == NULL) { #ifdef HAVE_PTHREAD_SIGMASK - MT_thread_sigmask(&orig_mask, NULL); + MT_thread_sigmask(&orig_mask, NULL); #endif - pthread_attr_destroy(&attr); - return -1; - } - p->func = f; - p->arg = arg; - p->exited = 0; - f = thread_starter; - arg = p; + pthread_attr_destroy(&attr); + return -1; + } + p->func = f; + p->arg = arg; + p->exited = 0; + if (d == MT_THR_DETACHED) { + pf = thread_starter; newtp = &p->tid; } else { + pf = thread_starter_simple; newtp = &newt; assert(d == MT_THR_JOINABLE); } - ret = pthread_create(newtp, &attr, (void *(*)(void *)) f, arg); + ret = pthread_create(newtp, &attr, pf, p); if (ret == 0) { #ifdef PTW32 *t = (MT_Id) (((size_t) newtp->p) + 1); /* use pthread-id + 1 */ #else *t = (MT_Id) (((size_t) *newtp) + 1); /* use pthread-id + 1 */ #endif - if (p) { + if (d == MT_THR_DETACHED) { pthread_mutex_lock(&posthread_lock); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list