Changeset: 3c42202f88b4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3c42202f88b4
Modified Files:
        clients/Tests/exports.stable.out
        sql/server/rel_optimize_sel.c
        sql/storage/store.c
Branch: nested
Log Message:

Merge with default branch.


diffs (truncated from 626 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
@@ -1764,7 +1764,7 @@ int mnstr_readStr(stream *restrict s, ch
 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);
 void mnstr_set_bigendian(stream *s, bool bigendian);
-void mnstr_set_error(stream *s, mnstr_error_kind kind, const char *fmt, ...) 
__attribute__((__format__(__printf__, 3, 4)));
+void mnstr_set_error(stream *s, mnstr_error_kind kind, _In_z_ 
_Printf_format_string_ const char *fmt, ...) 
__attribute__((__format__(__printf__, 3, 4)));
 void mnstr_settimeout(stream *s, unsigned int ms, bool (*func)(void *), void 
*data);
 const char *mnstr_version(void);
 ssize_t mnstr_write(stream *restrict s, const void *restrict buf, size_t 
elmsize, size_t cnt);
diff --git a/clients/examples/C/bincopydata.h b/clients/examples/C/bincopydata.h
--- a/clients/examples/C/bincopydata.h
+++ b/clients/examples/C/bincopydata.h
@@ -12,7 +12,7 @@
 #include "copybinary.h"
 #include "copybinary_support.h"
 
-_Noreturn void croak(int status, const char *msg, ...)
+_Noreturn void croak(int status, _In_z_ _Printf_format_string_ const char 
*msg, ...)
        __attribute__((__format__(__printf__, 2, 3)));
 
 void gen_decimal_tinyints(FILE *f, bool byteswap, long nrecs, char *arg);
@@ -48,4 +48,3 @@ struct rng {
 };
 #define rng_next(rng) ((rng)->state = (uint64_t)(rng)->state * 48271 % 
0x7fffffff)
 #define my_favorite_rng() ((struct rng) { .state = 42 })
-
diff --git a/clients/examples/C/streamcat.c b/clients/examples/C/streamcat.c
--- a/clients/examples/C/streamcat.c
+++ b/clients/examples/C/streamcat.c
@@ -75,7 +75,7 @@ static void copy_stream_to_file(stream *
 
 static void copy_file_to_stream(FILE *in, stream *out, size_t bufsize, bool 
do_flush, mnstr_flush_level flush_level);
 
-_Noreturn static void croak(int status, const char *msg, ...)
+_Noreturn static void croak(int status, _In_z_ _Printf_format_string_ const 
char *msg, ...)
        __attribute__((__format__(__printf__, 2, 3)));
 
 /* Format the message and write it to stderr. Then exit with the given status.
diff --git a/clients/mapilib/mapi_intern.h b/clients/mapilib/mapi_intern.h
--- a/clients/mapilib/mapi_intern.h
+++ b/clients/mapilib/mapi_intern.h
@@ -272,11 +272,11 @@ void mapi_clrError(Mapi mid)
        __attribute__((__nonnull__(1)));
 MapiMsg mapi_setError(Mapi mid, const char *msg, const char *action, MapiMsg 
error)
        __attribute__((__nonnull__(2, 3)));
-MapiMsg mapi_printError(Mapi mid, const char *action, MapiMsg error, const 
char *fmt, ...)
+MapiMsg mapi_printError(Mapi mid, const char *action, MapiMsg error, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
        __attribute__((__nonnull__(2))) __attribute__((__format__(__printf__, 
4, 5)));
 
 void mapi_impl_log_data(Mapi mid, const char *filename, long line, const char 
*mark, const char *data, size_t len);
-void mapi_impl_log_record(Mapi mid, const char *filename, long line, const 
char *mark, const char *fmt, ...)
+void mapi_impl_log_record(Mapi mid, const char *filename, long line, const 
char *mark, _In_z_ _Printf_format_string_ const char *fmt, ...)
        __attribute__((__format__(__printf__, 5, 6)));
 #define mapi_log_data(mid, mark, start, len)  do { if ((mid)->tracelog) 
mapi_impl_log_data(mid, __func__, __LINE__, mark, start, len); } while (0)
 #define mapi_log_record(mid, mark, ...)  do { if ((mid)->tracelog) 
mapi_impl_log_record(mid, __func__, __LINE__, mark, __VA_ARGS__); } while (0)
@@ -324,8 +324,8 @@ void close_connection(Mapi mid);
 void set_uri(Mapi mid);
 
 #ifdef HAVE_OPENSSL
-MapiMsg croak_openssl(Mapi mid, const char *action, const char *fmt, ...)
-       __attribute__(( __format__(__printf__, 3, 4) ));
+MapiMsg croak_openssl(Mapi mid, const char *action, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
+       __attribute__((__format__(__printf__, 3, 4)));
 
 MapiMsg add_system_certificates(Mapi mid, SSL_CTX *ctx);
 #endif
diff --git a/clients/mapilib/msettings_internal.h 
b/clients/mapilib/msettings_internal.h
--- a/clients/mapilib/msettings_internal.h
+++ b/clients/mapilib/msettings_internal.h
@@ -76,7 +76,7 @@ struct msettings {
 };
 
 
-const char *format_error(msettings *mp, const char *fmt, ...)
+const char *format_error(msettings *mp, _In_z_ _Printf_format_string_ const 
char *fmt, ...)
        __attribute__((__format__(__printf__, 2, 3)));
 
 // wrappers around mp->allocator
@@ -138,7 +138,7 @@ msettings_strdup(const msettings *mp, co
 }
 
 
-static inline char* msettings_allocprintf(const msettings *mp, const char 
*fmt, ...)
+static inline char* msettings_allocprintf(const msettings *mp, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
        __attribute__((__format__(__printf__, 2, 3)));
 
 static inline char*
diff --git a/clients/mapilib/parseurl.c b/clients/mapilib/parseurl.c
--- a/clients/mapilib/parseurl.c
+++ b/clients/mapilib/parseurl.c
@@ -66,7 +66,7 @@ advance(scanner *sc)
        return sc->c;
 }
 
-static bool complain(scanner *sc, const char *fmt, ...)
+static bool complain(scanner *sc, _In_z_ _Printf_format_string_ const char 
*fmt, ...)
        __attribute__((__format__(printf, 2, 3)));
 
 static bool
diff --git a/clients/mapilib/writeurl.c b/clients/mapilib/writeurl.c
--- a/clients/mapilib/writeurl.c
+++ b/clients/mapilib/writeurl.c
@@ -77,7 +77,7 @@ ob_append_escaped(struct outbuf *ob, con
        }
 }
 
-static void ob_printf(struct outbuf *ob, const char *fmt, ...)
+static void ob_printf(struct outbuf *ob, _In_z_ _Printf_format_string_ const 
char *fmt, ...)
        __attribute__((__format__(__printf__, 2, 3)));
 
 static void
diff --git a/clients/odbc/driver/SQLDriverConnect.c 
b/clients/odbc/driver/SQLDriverConnect.c
--- a/clients/odbc/driver/SQLDriverConnect.c
+++ b/clients/odbc/driver/SQLDriverConnect.c
@@ -189,7 +189,10 @@ MNDBDriverConnect(ODBCDbc *dbc,
        scratch_alloc = buildConnectionString(dsn ? dsn : "DEFAULT", settings);
        if (!scratch_alloc)
                goto failure;
-       out_len = strlcpy((char*)OutConnectionString, scratch_alloc, 
BufferLength);
+       if (OutConnectionString)
+               out_len = strlcpy((char*)OutConnectionString, scratch_alloc, 
BufferLength);
+       else
+               out_len = strlen(scratch_alloc);
        if (StringLength2Ptr)
                *StringLength2Ptr = (SQLSMALLINT)out_len;
        if (out_len + 1 > (size_t)BufferLength) {
diff --git a/clients/odbc/driver/SQLGetDiagField.c 
b/clients/odbc/driver/SQLGetDiagField.c
--- a/clients/odbc/driver/SQLGetDiagField.c
+++ b/clients/odbc/driver/SQLGetDiagField.c
@@ -36,7 +36,7 @@
                        size_t _l;                                      \
                        if (len < 0)                                    \
                                return SQL_ERROR;                       \
-                       _l = strlcpy((char *) buf, str, len);           \
+                       _l = buf ? strlcpy((char *) buf, str, len) : 
strlen(str); \
                        if (lenp)                                       \
                                *lenp = (SQLSMALLINT) _l;               \
                        if (buf == NULL || _l >= (size_t) len)          \
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -97,7 +97,7 @@ stream_export const char* mnstr_peek_err
 stream_export mnstr_error_kind mnstr_errnr(const stream *s);
 stream_export const char *mnstr_error_kind_name(mnstr_error_kind k);
 stream_export void mnstr_clearerr(stream *s);
-stream_export void mnstr_set_error(stream *s, mnstr_error_kind kind, const 
char *fmt, ...)
+stream_export void mnstr_set_error(stream *s, mnstr_error_kind kind, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
        __attribute__((__format__(__printf__, 3, 4)));
 
 
diff --git a/common/stream/stream_internal.h b/common/stream/stream_internal.h
--- a/common/stream/stream_internal.h
+++ b/common/stream/stream_internal.h
@@ -179,14 +179,14 @@ struct stream {
 void mnstr_va_set_error(stream *s, mnstr_error_kind kind, const char *fmt, 
va_list ap)
        __attribute__((__visibility__("hidden")));
 
-void mnstr_set_error_errno(stream *s, mnstr_error_kind kind, const char *fmt, 
...)
+void mnstr_set_error_errno(stream *s, mnstr_error_kind kind, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
        __attribute__((__format__(__printf__, 3, 4)))
        __attribute__((__visibility__("hidden")));
 
 void mnstr_copy_error(stream *dst, stream *src)
        __attribute__((__visibility__("hidden")));
 
-void mnstr_set_open_error(const char *name, int errnr, const char *fmt, ...)
+void mnstr_set_open_error(const char *name, int errnr, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
        __attribute__((__format__(__printf__, 3, 4)))
        __attribute__((__visibility__("hidden")));
 
diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -20,16 +20,28 @@
 #define GCC_Pragma(pragma)
 #endif
 
+/* if __has_attribute is not known to the preprocessor, we ignore
+ * attributes completely (see monetdb_config.h); if it is known, use it
+ * to find out whether specific attributes that we use are known */
 #if defined(__has_attribute)
-#if ! __has_attribute(__access__)
+#if !__has_attribute(__access__)
 #define __access__(...)
 #endif
-#if ! __has_attribute(__nonnull__)
+#if !__has_attribute(__format__)
+#define __format__(...)
+#endif
+#if !__has_attribute(__nonnull__)
 #define __nonnull__(...)
 #endif
-#else
-#define __access__(...)
-#define __nonnull__(...)
+#if !__has_attribute(__nonnull_if_nonzero__)
+#define __nonnull_if_nonzero__(...)
+#endif
+#if !__has_attribute(__pure__)
+#define __pure__
+#endif
+#if !__has_attribute(__sentinel__)
+#define __sentinel__
+#endif
 #endif
 
 #ifndef mutils_export
@@ -52,7 +64,9 @@
  */
 
 #ifndef HAVE_STRNLEN
+__attribute__((__pure__))
 __attribute__((__nonnull__(1)))
+__attribute__((__access__(read_only, 1, 2)))
 static inline size_t
 strnlen(const char *s, size_t n)
 {
@@ -101,7 +115,6 @@ strlcpy(char *restrict dst, const char *
        return strlen(src);
 }
 #endif
-#define strcpy_len strlcpy
 
 #ifndef HAVE_STPCPY
 /* Copy the input string into a destination string.  The programmer is
@@ -124,7 +137,8 @@ stpcpy(char *restrict dst, const char *r
  * truncated (but it is guaranteed to be null-terminated). It returns
  * the length of the string, or -1 if it truncated. */
 __attribute__((__access__(write_only, 1, 3)))
-__attribute__((__nonnull__(1, 2)))
+__attribute__((__nonnull_if_nonzero__(1, 3)))
+__attribute__((__nonnull__(2)))
 static inline ssize_t
 strtcpy(char *restrict dst, const char *restrict src, size_t dsize)
 {
@@ -260,11 +274,9 @@ checkUTF8(const char *v)
        return true;
 }
 
-static inline int vreallocprintf(char **buf, size_t *pos, size_t *size, const 
char *fmt, va_list ap)
-       __attribute__((__format__(__printf__, 4, 0)));
-
+__attribute__((__format__(__printf__, 4, 0)))
 static inline int
-vreallocprintf(char **buf, size_t *pos, size_t *capacity, const char *fmt, 
va_list args)
+vreallocprintf(char **buf, size_t *pos, size_t *capacity, _In_z_ 
_Printf_format_string_ const char *fmt, va_list args)
 {
        va_list ap;
 
@@ -313,11 +325,9 @@ vreallocprintf(char **buf, size_t *pos, 
        }
 }
 
-static inline int reallocprintf(char **buf, size_t *pos, size_t *size, const 
char *fmt, ...)
-       __attribute__((__format__(__printf__, 4, 5)));
-
+__attribute__((__format__(__printf__, 4, 5)))
 static inline int
-reallocprintf(char **buf, size_t *pos, size_t *capacity, const char *fmt, ...)
+reallocprintf(char **buf, size_t *pos, size_t *capacity, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
 {
        int n;
        va_list ap;
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -57,9 +57,6 @@
  * use as a Boolean. */
 typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
 
-gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char 
*format, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-
 typedef struct allocator allocator;
 /* checkpoint or snapshot of allocator internal state we can use
  * to restore to a point in time */
@@ -77,6 +74,9 @@ typedef struct {
 #include "stream.h"
 #include "mstring.h"
 
+gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char 
*format, ...)
+       __attribute__((__format__(__printf__, 1, 2)));
+
 #undef MIN
 #undef MAX
 #define MAX(A,B)       ((A)<(B)?(B):(A))
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -12,38 +12,15 @@
 #define _GDK_SYSTEM_H_
 
 /* if __has_attribute is not known to the preprocessor, we ignore
- * attributes completely; if it is known, use it to find out whether
- * specific attributes that we use are known */
-#ifndef __has_attribute
-#ifndef __GNUC__
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to