Changeset: dd6dafe26e42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd6dafe26e42
Modified Files:
        ChangeLog.Mar2018
        NT/monetdb_config.h.in
        clients/Tests/exports.stable.out
        clients/mapiclient/eventparser.c
        clients/mapiclient/eventparser.h
        clients/mapiclient/stethoscope.c
        clients/mapiclient/tachograph.c
        clients/mapiclient/tomograph.c
        clients/mapilib/mapi.c
        clients/odbc/driver/ODBCConvert.c
        clients/odbc/driver/ODBCDbc.c
        clients/odbc/driver/ODBCDesc.c
        clients/odbc/driver/ODBCEnv.c
        clients/odbc/driver/ODBCStmt.c
        clients/odbc/driver/ODBCUtil.h
        clients/odbc/driver/SQLAllocConnect.c
        clients/odbc/driver/SQLAllocHandle.c
        clients/odbc/driver/SQLAllocStmt.c
        clients/odbc/driver/SQLBindCol.c
        clients/odbc/driver/SQLBindParameter.c
        clients/odbc/driver/SQLBrowseConnect.c
        clients/odbc/driver/SQLBulkOperations.c
        clients/odbc/driver/SQLCancel.c
        clients/odbc/driver/SQLCloseCursor.c
        clients/odbc/driver/SQLColAttribute.c
        clients/odbc/driver/SQLColAttributes.c
        clients/odbc/driver/SQLColumnPrivileges.c
        clients/odbc/driver/SQLColumns.c
        clients/odbc/driver/SQLConnect.c
        clients/odbc/driver/SQLCopyDesc.c
        clients/odbc/driver/SQLDataSources.c
        clients/odbc/driver/SQLDescribeCol.c
        clients/odbc/driver/SQLDescribeParam.c
        clients/odbc/driver/SQLDisconnect.c
        clients/odbc/driver/SQLDriverConnect.c
        clients/odbc/driver/SQLEndTran.c
        clients/odbc/driver/SQLError.c
        clients/odbc/driver/SQLExecDirect.c
        clients/odbc/driver/SQLExecute.c
        clients/odbc/driver/SQLExtendedFetch.c
        clients/odbc/driver/SQLFetch.c
        clients/odbc/driver/SQLFetchScroll.c
        clients/odbc/driver/SQLForeignKeys.c
        clients/odbc/driver/SQLFreeConnect.c
        clients/odbc/driver/SQLFreeEnv.c
        clients/odbc/driver/SQLFreeHandle.c
        clients/odbc/driver/SQLFreeStmt.c
        clients/odbc/driver/SQLGetConnectAttr.c
        clients/odbc/driver/SQLGetConnectOption.c
        clients/odbc/driver/SQLGetCursorName.c
        clients/odbc/driver/SQLGetData.c
        clients/odbc/driver/SQLGetDescField.c
        clients/odbc/driver/SQLGetDescRec.c
        clients/odbc/driver/SQLGetDiagField.c
        clients/odbc/driver/SQLGetDiagRec.c
        clients/odbc/driver/SQLGetEnvAttr.c
        clients/odbc/driver/SQLGetFunctions.c
        clients/odbc/driver/SQLGetInfo.c
        clients/odbc/driver/SQLGetStmtAttr.c
        clients/odbc/driver/SQLGetStmtOption.c
        clients/odbc/driver/SQLGetTypeInfo.c
        clients/odbc/driver/SQLMoreResults.c
        clients/odbc/driver/SQLNativeSql.c
        clients/odbc/driver/SQLNumParams.c
        clients/odbc/driver/SQLNumResultCols.c
        clients/odbc/driver/SQLParamData.c
        clients/odbc/driver/SQLParamOptions.c
        clients/odbc/driver/SQLPrepare.c
        clients/odbc/driver/SQLPrimaryKeys.c
        clients/odbc/driver/SQLProcedureColumns.c
        clients/odbc/driver/SQLProcedures.c
        clients/odbc/driver/SQLPutData.c
        clients/odbc/driver/SQLRowCount.c
        clients/odbc/driver/SQLSetConnectAttr.c
        clients/odbc/driver/SQLSetConnectOption.c
        clients/odbc/driver/SQLSetCursorName.c
        clients/odbc/driver/SQLSetDescField.c
        clients/odbc/driver/SQLSetDescRec.c
        clients/odbc/driver/SQLSetEnvAttr.c
        clients/odbc/driver/SQLSetParam.c
        clients/odbc/driver/SQLSetPos.c
        clients/odbc/driver/SQLSetScrollOptions.c
        clients/odbc/driver/SQLSetStmtAttr.c
        clients/odbc/driver/SQLSetStmtOption.c
        clients/odbc/driver/SQLSpecialColumns.c
        clients/odbc/driver/SQLStatistics.c
        clients/odbc/driver/SQLTablePrivileges.c
        clients/odbc/driver/SQLTables.c
        clients/odbc/driver/SQLTransact.c
        common/stream/stream.c
        common/stream/stream.h
        common/utils/msabaoth.c
        configure.ag
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
        gdk/gdk_delta.c
        gdk/gdk_delta.h
        gdk/gdk_heap.c
        gdk/gdk_interprocess.c
        gdk/gdk_logger.c
        gdk/gdk_posix.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_utils.c
        gdk/gdk_utils.h
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_resource.c
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/mcurl.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/tablet.c
        monetdb5/optimizer/opt_mitosis.c
        sql/backends/monet5/UDF/pyapi/emit.c
        sql/backends/monet5/UDF/pyapi/pyapi.c
        sql/backends/monet5/UDF/udf/udf.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_optimizer.c
        sql/backends/monet5/sql_result.c
        sql/include/sql_mem.h
        sql/server/rel_psm.c
        sql/server/rel_schema.c
        sql/server/rel_sequence.c
        sql/server/rel_trans.c
        sql/server/rel_updates.c
        sql/server/rel_xml.c
        sql/server/sql_mvc.c
        sql/server/sql_symbol.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/utils/database.c
        tools/mserver/monet_version.c.in
        tools/mserver/mserver5.c
        tools/mserver/shutdowntest.c
Branch: Mar2018
Log Message:

Move some types and constants from configure to gdk.h.
In particular, the types "lng" and "ulng" have been moved and can
therefore no longer be used by code that doesn't (ultimately) include
gdk.h.  Just use int64_t instead.
A bunch of format defines have been removed: SZFMT, SSZFMT, PTRFMT,
PDFMT.  Just use the C standard codes for those (%zu, %zd, %p, %td).
The define for printing a lng (LLFMT) was also moved.  Use PRId64 for
printing int64_t in code not using gdk.h.
Removed all references to __int64 and long long (use int64_t instead).


diffs (truncated from 5074 to 300 lines):

diff --git a/ChangeLog.Mar2018 b/ChangeLog.Mar2018
--- a/ChangeLog.Mar2018
+++ b/ChangeLog.Mar2018
@@ -1,3 +1,14 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Fri Feb  9 2018 Sjoerd Mullender <sjo...@acm.org>
+- Some types and constants were moved from configure (and hence
+  monetdb_config.h) to gdk.h.  In particular, the types "lng" and
+  "ulng" have been moved and can therefore no longer be used by code
+  that doesn't (ultimately) include gdk.h.  Just use int64_t instead.
+  A bunch of format defines have been removed: SZFMT, SSZFMT, PTRFMT,
+  PDFMT.  Just use the C standard codes for those (%zu, %zd, %p, %td).
+  The define for printing a lng (LLFMT) was also moved.  Use PRId64 for
+  printing int64_t in code not using gdk.h.  Removed all references to
+  __int64 and long long (use int64_t instead).
+
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -882,15 +882,11 @@ c99_snprintf(char *outBuf, size_t size, 
 
 /* Define to `int' if <sys/types.h> does not define. */
 #ifdef _WIN64
-#define ssize_t __int64
+#define ssize_t int64_t
 #else
 #define ssize_t int
 #endif
 
-typedef int64_t lng;
-typedef uint64_t ulng;
-#define SIZEOF_LNG 8
-
 #ifdef HAVE___INT128
 typedef __int128 hge;
 typedef unsigned __int128 uhge;
@@ -905,23 +901,6 @@ typedef __uint128_t uhge;
 # endif
 #endif
 
-/* Format to print 64 bit signed integers. */
-#define LLFMT "%" PRId64
-
-/* Format to print 64 bit unsigned integers. */
-#define ULLFMT "%" PRIu64
-
-/* define printf formats for printing size_t and ssize_t variables */
-/* In Visual Studio 2017 we can finally use %zu and %td, but %Iu/%Id
- * also works */
-#define SZFMT "%Iu"
-#define SSZFMT "%Id"
-
-#define PDFMT SSZFMT
-
-#define PTRFMT         "%p"
-#define PTRFMTCAST
-
 #ifdef HAVE_EMBEDDED_R
 #define _MSC_EXTENSIONS 1
 #undef HAVE_CTIME_R
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
@@ -2674,10 +2674,10 @@ int mnstr_readHge(stream *restrict s, hg
 int mnstr_readHgeArray(stream *restrict s, hge *restrict val, size_t cnt);
 int mnstr_readInt(stream *restrict s, int *restrict val);
 int mnstr_readIntArray(stream *restrict s, int *restrict val, size_t cnt);
-int mnstr_readLng(stream *restrict s, lng *restrict val);
-int mnstr_readLngArray(stream *restrict s, lng *restrict val, size_t cnt);
-int mnstr_readSht(stream *restrict s, short *restrict val);
-int mnstr_readShtArray(stream *restrict s, short *restrict val, size_t cnt);
+int mnstr_readLng(stream *restrict s, int64_t *restrict val);
+int mnstr_readLngArray(stream *restrict s, int64_t *restrict val, size_t cnt);
+int mnstr_readSht(stream *restrict s, int16_t *restrict val);
+int mnstr_readShtArray(stream *restrict s, int16_t *restrict val, size_t cnt);
 int mnstr_readStr(stream *restrict s, char *restrict val);
 ssize_t mnstr_read_block(stream *restrict s, void *restrict buf, size_t 
elmsize, size_t cnt);
 ssize_t mnstr_readline(stream *restrict s, void *restrict buf, size_t maxcnt);
@@ -2694,10 +2694,10 @@ int mnstr_writeHge(stream *s, hge val);
 int mnstr_writeHgeArray(stream *restrict s, const hge *restrict val, size_t 
cnt);
 int mnstr_writeInt(stream *s, int val);
 int mnstr_writeIntArray(stream *restrict s, const int *restrict val, size_t 
cnt);
-int mnstr_writeLng(stream *s, lng val);
-int mnstr_writeLngArray(stream *restrict s, const lng *restrict val, size_t 
cnt);
-int mnstr_writeSht(stream *s, short val);
-int mnstr_writeShtArray(stream *restrict s, const short *restrict val, size_t 
cnt);
+int mnstr_writeLng(stream *s, int64_t val);
+int mnstr_writeLngArray(stream *restrict s, const int64_t *restrict val, 
size_t cnt);
+int mnstr_writeSht(stream *s, int16_t val);
+int mnstr_writeShtArray(stream *restrict s, const int16_t *restrict val, 
size_t cnt);
 int mnstr_writeStr(stream *restrict s, const char *restrict val);
 stream *open_rastream(const char *filename);
 stream *open_rstream(const char *filename);
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -76,7 +76,7 @@ stripQuotes(char *currentquery)
                return NULL;
        q = qry = (char *) malloc(strlen(currentquery) * 2);
        if( q == NULL){
-               fprintf(stderr,"Could not allocate query buffer of size 
"SZFMT"\n", strlen(currentquery) * 2);
+               fprintf(stderr,"Could not allocate query buffer of size %zu\n", 
strlen(currentquery) * 2);
                exit(-1);
        }
        c= currentquery;
@@ -236,14 +236,14 @@ keyvalueparser(char *txt, EventRecord *e
                                 c);
                ev->clkticks = sec * 1000000;
                if (c != NULL) {
-                       lng usec;
+                       int64_t usec;
                        /* microseconds */
                        usec = strtoll(c, NULL, 10);
                        assert(usec >= 0 && usec < 1000000);
                        ev->clkticks += usec;
                }
                if (ev->clkticks < 0) {
-                       fprintf(stderr, "parser: read negative value "LLFMT" 
from\n'%s'\n", ev->clkticks, val);
+                       fprintf(stderr, "parser: read negative value %"PRId64" 
from\n'%s'\n", ev->clkticks, val);
                }
                return 0;
        }
@@ -361,7 +361,7 @@ lineparser(char *row, EventRecord *ev)
        memset(&stm, 0, sizeof(struct tm));
 #ifdef HAVE_STRPTIME
        c = strptime(c + 1, "%H:%M:%S", &stm);
-       ev->clkticks = (((lng) stm.tm_hour * 60 + stm.tm_min) * 60 + 
stm.tm_sec) * 1000000;
+       ev->clkticks = (((int64_t) stm.tm_hour * 60 + stm.tm_min) * 60 + 
stm.tm_sec) * 1000000;
        if (c == NULL)
                return -3;
 #else
@@ -371,7 +371,7 @@ lineparser(char *row, EventRecord *ev)
        c += pos + 1;
 #endif
        if (*c == '.') {
-               lng usec;
+               int64_t usec;
                /* microseconds */
                usec = strtoll(c + 1, NULL, 10);
                assert(usec >= 0 && usec < 1000000);
@@ -381,7 +381,7 @@ lineparser(char *row, EventRecord *ev)
        if (c == NULL)
                return -3;
        if (ev->clkticks < 0) {
-               fprintf(stderr, "parser: read negative value "LLFMT" 
from\n'%s'\n", ev->clkticks, cc);
+               fprintf(stderr, "parser: read negative value %"PRId64" 
from\n'%s'\n", ev->clkticks, cc);
        }
        c++;
 
@@ -547,7 +547,7 @@ renderJSONevent(FILE *fd, EventRecord *e
        if( notfirst)
                fprintf(fd,"},\n{");
        fprintf(fd,"\"user\":\"%s\",\n",ev->user?ev->user:"monetdb");
-       fprintf(fd,"\"clk\":"LLFMT",\n",ev->usec);
+       fprintf(fd,"\"clk\":%"PRId64",\n",ev->usec);
        fprintf(fd,"\"ctime\":\"%s\",\n",ev->time);
        fprintf(fd,"\"thread\":%d,\n",ev->thread);
        fprintf(fd,"\"function\":\"%s\",\n",ev->function);
@@ -570,9 +570,9 @@ renderJSONevent(FILE *fd, EventRecord *e
                fprintf(fd,"\"state\":\"system\",\n");
                break;
        }
-       fprintf(fd,"\"usec\":"LLFMT",\n",ev->ticks);
-       fprintf(fd,"\"rss\":"LLFMT",\n",ev->rss);
-       fprintf(fd,"\"size\":"LLFMT",\n",ev->size);
+       fprintf(fd,"\"usec\":%"PRId64",\n",ev->ticks);
+       fprintf(fd,"\"rss\":%"PRId64",\n",ev->rss);
+       fprintf(fd,"\"size\":%"PRId64",\n",ev->size);
        if( strstr(ev->stmt," ]"))
                *strstr(ev->stmt," ]") = 0;
        fprintf(fd,"\"stmt\":\"%s\",\n",ev->stmt);
diff --git a/clients/mapiclient/eventparser.h b/clients/mapiclient/eventparser.h
--- a/clients/mapiclient/eventparser.h
+++ b/clients/mapiclient/eventparser.h
@@ -34,7 +34,7 @@
 #define TME_HH 16
 #define TME_DD 32
 
-#define US_MS ((lng) 1000)
+#define US_MS ((int64_t) 1000)
 #define US_SS (US_MS * 1000)
 #define US_MM (US_SS * 60)
 #define US_HH (US_MM * 60)
@@ -68,19 +68,19 @@ typedef struct  {
        char *user; 
        int pc;         // instruction counter in block
        int tag;        // unique MAL block invocation tag
-       lng eventnr;// serial event number
+       int64_t eventnr;// serial event number
        int thread;     // worker thread involved
-       lng usec;       // usec since start of session
+       int64_t usec;   // usec since start of session
        char *time;     // string rep of clock
-       lng clkticks;
-       lng ticks;
-       lng rss;
-       lng size;       // size of temporary produced
-       lng inblock;
-       lng oublock;
-       lng majflt;
-       lng swaps;
-       lng csw;
+       int64_t clkticks;
+       int64_t ticks;
+       int64_t rss;
+       int64_t size;   // size of temporary produced
+       int64_t inblock;
+       int64_t oublock;
+       int64_t majflt;
+       int64_t swaps;
+       int64_t csw;
        char *stmt;     // MAL statement, cpu loads or commentary
        char *beauty;// MAL statement compressed
        char *fcn;      // MAL operator
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -107,7 +107,7 @@ renderEvent(EventRecord *ev){
        if( ev->eventnr < 0)
                return;
        fprintf(s, "[ ");
-       fprintf(s, LLFMT",      ", ev->eventnr);
+       fprintf(s, "%"PRId64",  ", ev->eventnr);
        printf("\"%s\", ", ev->time);
        if( ev->function && *ev->function)
                fprintf(s, "\"%s[%d]%d\",       ", ev->function, ev->pc, 
ev->tag);
@@ -121,14 +121,14 @@ renderEvent(EventRecord *ev){
        case MDB_PING: fprintf(s, "\"ping \",   "); break;
        case MDB_SYSTEM: fprintf(s, "\"system\",        "); 
        }
-       fprintf(s, LLFMT",      ", ev->ticks);
-       fprintf(s, LLFMT",      ", ev->rss);
-       fprintf(s, LLFMT",      ", ev->size);
-       fprintf(s, LLFMT",      ", ev->inblock);
-       fprintf(s, LLFMT",      ", ev->oublock);
-       fprintf(s, LLFMT",      ", ev->majflt);
-       fprintf(s, LLFMT",      ", ev->swaps);
-       fprintf(s, LLFMT",      ", ev->csw);
+       fprintf(s, "%"PRId64",  ", ev->ticks);
+       fprintf(s, "%"PRId64",  ", ev->rss);
+       fprintf(s, "%"PRId64",  ", ev->size);
+       fprintf(s, "%"PRId64",  ", ev->inblock);
+       fprintf(s, "%"PRId64",  ", ev->oublock);
+       fprintf(s, "%"PRId64",  ", ev->majflt);
+       fprintf(s, "%"PRId64",  ", ev->swaps);
+       fprintf(s, "%"PRId64",  ", ev->csw);
        fprintf(s, "\"%s\"      ]\n", ev->stmt);
 }
 
diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c
--- a/clients/mapiclient/tachograph.c
+++ b/clients/mapiclient/tachograph.c
@@ -75,9 +75,9 @@ static int pccount;
 #define FINISHED 2
 typedef struct{
        int state;
-       lng etc;
-       lng actual;
-       lng clkticks;
+       int64_t etc;
+       int64_t actual;
+       int64_t clkticks;
        char *stmt;
 } Event;
 
@@ -125,9 +125,9 @@ stop_disconnect:
 
 char *currentfunction= 0;
 int currenttag;                // to distinguish query invocations
-lng starttime = 0;
-lng finishtime = 0;
-lng duration =0;
+int64_t starttime = 0;
+int64_t finishtime = 0;
+int64_t duration =0;
 char *prevquery= 0;
 int prevprogress =0;// pc of previous progress display
 int prevlevel =0; 
@@ -171,7 +171,7 @@ static void resetTachograph(void){
 
 static char stamp[BUFSIZ]={0};
 static void
-rendertime(lng ticks, int flg)
+rendertime(int64_t ticks, int flg)
 {
        int t, hr,min,sec;
 
@@ -193,9 +193,9 @@ rendertime(lng ticks, int flg)
 
 
 static void
-showBar(int level, lng clk, char *stmt)
+showBar(int level, int64_t clk, char *stmt)
 {
-       lng i =0, nl;
+       int64_t i =0, nl;
        size_t stamplen=0;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to