Changeset: cfc351ebc6d0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cfc351ebc6d0
Modified Files:
monetdb5/mal/mal_debugger.mx
monetdb5/mal/mal_interpreter.mx
Branch: default
Log Message:
Merge with Aug2011 branch.
diffs (truncated from 1262 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
@@ -434,14 +434,14 @@
space += mnstr_printf(toConsole, "(%s)", c_type_digits);
} else if (strcmp(c_type, "timestamp") == 0 ||
strcmp(c_type, "timestamptz") == 0) {
- space = mnstr_printf(toConsole, "TIMESTAMP", c_type);
+ space = mnstr_printf(toConsole, "TIMESTAMP");
if (strcmp(c_type_digits, "7") != 0)
space += mnstr_printf(toConsole, "(%d)",
atoi(c_type_digits) - 1);
if (strcmp(c_type, "timestamptz") == 0)
space += mnstr_printf(toConsole, " WITH TIME ZONE");
} else if (strcmp(c_type, "time") == 0 ||
strcmp(c_type, "timetz") == 0) {
- space = mnstr_printf(toConsole, "TIME", c_type);
+ space = mnstr_printf(toConsole, "TIME");
if (strcmp(c_type_digits, "1") != 0)
space += mnstr_printf(toConsole, "(%d)",
atoi(c_type_digits) - 1);
if (strcmp(c_type, "timetz") == 0)
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1449,7 +1449,7 @@
snprintf(msg, sizeof(msg), "Xclose %d\n",
hdl->pending_close[i]);
mapi_log_record(mid, msg);
mid->active = hdl;
- if (mnstr_printf(mid->to, msg) < 0 ||
+ if (mnstr_printf(mid->to, "%s", msg) < 0 ||
mnstr_flush(mid->to)) {
close_connection(mid);
mapi_setError(mid,
mnstr_error(mid->to), "mapi_close_handle", MTIMEOUT);
@@ -1467,7 +1467,7 @@
snprintf(msg, sizeof(msg), "Xclose %d\n",
result->tableid);
mapi_log_record(mid, msg);
mid->active = hdl;
- if (mnstr_printf(mid->to, msg) < 0 ||
+ if (mnstr_printf(mid->to, "%s", msg) < 0 ||
mnstr_flush(mid->to)) {
close_connection(mid);
mapi_setError(mid,
mnstr_error(mid->to), "mapi_close_handle", MTIMEOUT);
@@ -1670,7 +1670,7 @@
snprintf(msg, sizeof(msg), "Xclose %d\n",
hdl->pending_close[i]);
mapi_log_record(mid, msg);
mid->active = hdl;
- if (mnstr_printf(mid->to, msg) < 0 ||
+ if (mnstr_printf(mid->to, "%s", msg) < 0 ||
mnstr_flush(mid->to)) {
close_connection(mid);
mapi_setError(mid, mnstr_error(mid->to),
"finish_handle", MTIMEOUT);
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -58,6 +58,27 @@
# endif
#endif
+/* defines to help the compiler check printf-style format arguments
+ * see the declaration of mnstr_printf below. Also see gdk.h for a
+ * copy of this stuff. */
+#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+/* This feature is available in gcc versions 2.5 and later. */
+# ifndef __attribute__
+# define __attribute__(Spec) /* empty */
+# endif
+#else
+/* The __-protected variants of `format' and `printf' attributes are
+ * accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if !defined(__format__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__
< 7))
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+#if !defined(_MSC_VER) && !defined(_In_z_)
+# define _In_z_
+# define _Printf_format_string_
+#endif
+
#define EOT 4
#define ST_ASCII 0
@@ -92,7 +113,8 @@
stream_export int mnstr_writeIntArray(stream *s, const int *val, size_t cnt);
stream_export int mnstr_readLngArray(stream *s, lng *val, size_t cnt);
stream_export int mnstr_writeLngArray(stream *s, const lng *val, size_t cnt);
-stream_export int mnstr_printf(stream *s, const char *format, ...);
+stream_export int mnstr_printf(stream *s, _In_z_ _Printf_format_string_ const
char *format, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
stream_export ssize_t mnstr_read(stream *s, void *buf, size_t elmsize, size_t
cnt);
stream_export ssize_t mnstr_readline(stream *s, void *buf, size_t maxcnt);
stream_export ssize_t mnstr_write(stream *s, const void *buf, size_t elmsize,
size_t cnt);
diff --git a/gdk/gdk.mx b/gdk/gdk.mx
--- a/gdk/gdk.mx
+++ b/gdk/gdk.mx
@@ -401,6 +401,27 @@
#endif
#endif
+/* defines to help the compiler check printf-style format arguments
+ * see the declaration of mnstr_printf below. Also see stream.h for a
+ * copy of this stuff. */
+#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+/* This feature is available in gcc versions 2.5 and later. */
+# ifndef __attribute__
+# define __attribute__(Spec) /* empty */
+# endif
+#else
+/* The __-protected variants of `format' and `printf' attributes are
+ * accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if !defined(__format__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__
< 7))
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+#if !defined(_MSC_VER) && !defined(_In_z_)
+# define _In_z_
+# define _Printf_format_string_
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -2441,9 +2462,12 @@
/* Data Distilleries uses ICU for internationalization of some MonetDB error
messages */
-gdk_export int GDKerror(const char *format, ...);
-gdk_export int GDKsyserror(const char *format, ...);
-gdk_export int GDKfatal(const char *format, ...);
+gdk_export int GDKerror(_In_z_ _Printf_format_string_ const char *format, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+gdk_export int GDKsyserror(_In_z_ _Printf_format_string_ const char *format,
...)
+ __attribute__((__format__(__printf__, 1, 2)));
+gdk_export int GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
@
@h
@@ -2600,7 +2624,8 @@
gdk_export void THRsetdata(int, ptr);
gdk_export void *THRgetdata(int);
gdk_export int THRhighwater(void);
-gdk_export int THRprintf(stream *s, const char *format, ...);
+gdk_export int THRprintf(stream *s, _In_z_ _Printf_format_string_ const char
*format, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
gdk_export void *THRdata[16];
diff --git a/gdk/gdk_atoms.mx b/gdk/gdk_atoms.mx
--- a/gdk/gdk_atoms.mx
+++ b/gdk/gdk_atoms.mx
@@ -1895,7 +1895,7 @@
assert(newsize);
if (h->free + pad + len + extralen >= (((size_t) VAR_MAX) <<
GDK_VARSHIFT)) {
- GDKerror("strPut: string heaps gets larger than
%dGB.\n", (((size_t) VAR_MAX) << GDK_VARSHIFT) >> 30);
+ GDKerror("strPut: string heaps gets larger than " SZFMT
"GB.\n", (((size_t) VAR_MAX) << GDK_VARSHIFT) >> 30);
return 0;
}
if (h->free + pad + len + extralen < h->maxsize) {
diff --git a/gdk/gdk_bat.mx b/gdk/gdk_bat.mx
--- a/gdk/gdk_bat.mx
+++ b/gdk/gdk_bat.mx
@@ -2565,8 +2565,8 @@
if (@1 >= 0 && (@2) && @3 > 0 && (@2)->base &&
((@2)->storage != STORE_MEM) && MT_madvise((@2)->base,
@3, BUF_TO_MMAP[@1]))
{
- GDKsyserror("madvise(%x, " SZFMT ", %d) on @2 @1 failed\n",
- (@2)->base, @3, @1);
+ GDKsyserror("madvise(" PTRFMT ", " SZFMT ", %d) on @2 @1
failed\n",
+ PTRFMTCAST (@2)->base, @3, @1);
return -1;
}
@c
diff --git a/gdk/gdk_batop.mx b/gdk/gdk_batop.mx
--- a/gdk/gdk_batop.mx
+++ b/gdk/gdk_batop.mx
@@ -1303,7 +1303,7 @@
bn->T->nonil = tail;
else if (equi && !lnil)
bn->T->nonil = tail;
- ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): %s: hkey=" BUNFMT ",
tkey=" BUNFMT ", hsorted=" BUNFMT ", tsorted=" BUNFMT ".\n", BATgetId(b),
BATgetId(bn), bn->hkey, bn->tkey, bn->hsorted, bn->tsorted);
+ ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): %s: hkey=%d, tkey=%d,
hsorted=%d, tsorted=%d.\n", BATgetId(b), BATgetId(bn), bn->hkey, bn->tkey,
bn->hsorted, bn->tsorted);
ESTIDEBUG THRprintf(GDKout, "#BAT_select_(b=%s): resultsize: estimated
" BUNFMT ", got " BUNFMT ".\n", BATgetId(b), estimate, BATcount(bn));
return bn;
@@ -2280,7 +2280,7 @@
BBPreclaim(histo);
if (n > 1 && n != yy + 1) {
- PROPDEBUG THRprintf(GDKout, "#rangesplit: delivering %lu
instead of %lu fragments\n", yy + 1, n);
+ PROPDEBUG THRprintf(GDKout, "#rangesplit: delivering " BUNFMT "
instead of " BUNFMT " fragments\n", yy + 1, n);
n = yy + 1;
}
@-
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -1180,7 +1180,7 @@
return FALSE;
}
if ((head != roundup_num(head, hheader->alignment))) {
- GDKerror("HEAP_check: Heap structure corrupt: head = %d\n",
head);
+ GDKerror("HEAP_check: Heap structure corrupt: head = " SZFMT
"\n", head);
return FALSE;
}
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -529,7 +529,7 @@
BAT *b = BATdescriptor(bid);
if (!b) {
- GDKerror("logger: could not use bat (" OIDFMT ") for %s\n",
bid, la->name);
+ GDKerror("logger: could not use bat (%d) for %s\n", (int) bid,
la->name);
return;
}
logger_add_bat(lg, b, la->name);
diff --git a/monetdb5/extras/compiler/mal_compiler.mx
b/monetdb5/extras/compiler/mal_compiler.mx
--- a/monetdb5/extras/compiler/mal_compiler.mx
+++ b/monetdb5/extras/compiler/mal_compiler.mx
@@ -496,7 +496,7 @@
if( getArgType(mb,p,i)== TYPE_str){
mnstr_printf(f,"\tif(backup[%d] &&
sbackup[%d]!= ",i,i);
mccVar(f,mb,getArg(p,i));
- mnstr_printf(f,"\t) GDKfree(sbackup[%d]);\n");
+ mnstr_printf(f,"\t) GDKfree(sbackup[%d]);\n",i);
}
}
}
diff --git a/monetdb5/extras/crackers/crackers_updates.mx
b/monetdb5/extras/crackers/crackers_updates.mx
--- a/monetdb5/extras/crackers/crackers_updates.mx
+++ b/monetdb5/extras/crackers/crackers_updates.mx
@@ -975,7 +975,7 @@
BAT *b;
b=BATdescriptor(CrackerIndex[i].did);
if (b == NULL){
- mnstr_printf(GDKout,"\n crack print deletions", "Failed
to access deletions.");
+ mnstr_printf(GDKout,"\n crack print deletions: Failed
to access deletions.");
return;
}
BATprint(b);
@@ -992,7 +992,7 @@
BAT *b;
b=BATdescriptor(CrackerIndex[i].iid);
if (b == NULL){
- mnstr_printf(GDKout,"\n crack print insertions",
"Failed to access insertions.");
+ mnstr_printf(GDKout,"\n crack print insertions: Failed
to access insertions.");
return;
}
BATprint(b);
@@ -1010,7 +1010,7 @@
if (CrackerIndex[i].did > 0){
u = BATdescriptor(CrackerIndex[i].did);
if (u == NULL){
- mnstr_printf(GDKout,"\n crack print deletions", "Failed
to access deletions.");
+ mnstr_printf(GDKout,"\n crack print deletions: Failed
to access deletions.");
return;
}
printf("\n pending deletions size: "BUNFMT"\n",BATcount(u));
@@ -1030,7 +1030,7 @@
if (CrackerIndex[i].iid > 0){
u = BATdescriptor(CrackerIndex[i].iid);
if (u == NULL){
- mnstr_printf(GDKout,"\n crack print insertions",
"Failed to access insertions.");
+ mnstr_printf(GDKout,"\n crack print insertions: Failed
to access insertions.");
return;
}
printf("\n pending insertions size: "BUNFMT" \n",BATcount(u));
diff --git a/monetdb5/mal/mal_debugger.mx b/monetdb5/mal/mal_debugger.mx
--- a/monetdb5/mal/mal_debugger.mx
+++ b/monetdb5/mal/mal_debugger.mx
@@ -1048,8 +1048,8 @@
cntxt->flags |=ioFlag ;
#ifdef HAVE_SYS_RESOURCE_H
getrusage(RUSAGE_SELF, &resource);
- mnstr_printf(out, "#maxrss %d ixrss=%d
idrss=%d isrss=%d"
- "
minflt=%d majflt=%d nswap=%d inblock=%d oublock=%d\n",
+ mnstr_printf(out, "#maxrss %ld
ixrss=%ld idrss=%ld isrss=%ld"
+ "
minflt=%ld majflt=%ld nswap=%ld inblock=%ld oublock=%ld\n",
resource.ru_maxrss, resource.ru_ixrss,
resource.ru_idrss, resource.ru_isrss,
resource.ru_minflt, resource.ru_majflt,
@@ -1652,12 +1652,12 @@
state.p = getInstrPtr(mb,pc);
state.pc= pc;
cntxt->mdb= &state;
- mnstr_printf(mal_clients[0].fdout,"#Process %d put to
sleep\n",cntxt-mal_clients);
+ mnstr_printf(mal_clients[0].fdout,"#Process %d put to
sleep\n",(int)(cntxt-mal_clients));
cntxt->itrace = 'W';
mdbTrap(cntxt,mb,stk,pc);
while(cntxt->itrace== 'W')
MT_sleep_ms(cntxt->delay);
- mnstr_printf(mal_clients[0].fdout,"#Process %d woke
up\n",cntxt-mal_clients);
+ mnstr_printf(mal_clients[0].fdout,"#Process %d woke
up\n",(int)(cntxt-mal_clients));
return;
}
if (stk->cmd == 0)
@@ -1998,7 +1998,7 @@
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list