Changeset: 8fa95f19b998 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8fa95f19b998
Modified Files:
        clients/Tests/exports.stable.out
        clients/examples/C/bincopydata.h
        clients/examples/C/streamcat.c
        clients/mapilib/mapi_intern.h
        clients/mapilib/msettings_internal.h
        clients/mapilib/parseurl.c
        clients/mapilib/writeurl.c
        common/stream/stream.h
        common/stream/stream_internal.h
        common/utils/mstring.h
        gdk/gdk.h
        gdk/gdk_system.h
        gdk/gdk_utils.c
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_exception.h
        monetdb_config.h.in
        sql/backends/monet5/UDF/pyapi3/convert_loops.h
        sql/storage/store.c
Branch: default
Log Message:

Update compiler attributes.


diffs (truncated from 400 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
@@ -1760,7 +1760,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/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,24 +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
-#if ! __has_attribute(__nonnull_if_nonzero__)
+#if !__has_attribute(__nonnull_if_nonzero__)
 #define __nonnull_if_nonzero__(...)
 #endif
-#if ! __has_attribute(__pure__)
-#define __pure__(...)
+#if !__has_attribute(__pure__)
+#define __pure__
 #endif
-#else
-#define __access__(...)
-#define __nonnull__(...)
-#define __nonnull_if_nonzero__(...)
-#define __pure__(...)
+#if !__has_attribute(__sentinel__)
+#define __sentinel__
+#endif
 #endif
 
 #ifndef mutils_export
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__
-/* we can define __has_attribute as 1 since we define __attribute__ as empty */
-#define __has_attribute(attr)  1
-#ifndef __attribute__
-#define __attribute__(attr)    /* empty */
-#endif
-#else
-/* older GCC does have attributes, but not __has_attribute and not all
- * attributes that we use are known */
-#define __has_attribute__access__ 0
-#define __has_attribute__alloc_size__ 1
-#define __has_attribute__cold__ 1
-#define __has_attribute__const__ 1
-#define __has_attribute__constructor__ 1
-#define __has_attribute__designated_init__ 0
-#define __has_attribute__format__ 1
-#define __has_attribute__malloc__ 1
-#define __has_attribute__nonnull__ 1
-#define __has_attribute__nonstring__ 0
-#define __has_attribute__pure__ 1
-#define __has_attribute__returns_nonnull__ 0
-#define __has_attribute__visibility__ 1
-#define __has_attribute__warn_unused_result__ 1
-#define __has_attribute(attr)  __has_attribute##attr
-#endif
-#endif
+ * 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__)
 #define __access__(...)
 #endif
+#if !__has_attribute(__aligned__)
+#define __aligned__(...)
+#endif
 #if !__has_attribute(__alloc_size__)
 #define __alloc_size__(...)
 #endif
@@ -62,16 +39,22 @@
 #if !__has_attribute(__format__)
 #define __format__(...)
 #endif
-/* attribute malloc with argument seems to have been introduced in gcc 13 */
 #if !__has_attribute(__malloc__)
 #define __malloc__
 #define __malloc__(...)
 #elif !defined(__GNUC__) || __GNUC__ < 13
+/* attribute malloc with argument seems to have been introduced in gcc 13 */
 #define __malloc__(...)
 #endif
+#if !__has_attribute(__noinline__)
+#define __noinline__
+#endif
 #if !__has_attribute(__nonnull__)
 #define __nonnull__(...)
 #endif
+#if !__has_attribute(__nonnull_if_nonzero__)
+#define __nonnull_if_nonzero__(...)
+#endif
 #if !__has_attribute(__nonstring__)
 #define __nonstring__
 #endif
@@ -81,14 +64,16 @@
 #if !__has_attribute(__returns_nonnull__)
 #define __returns_nonnull__
 #endif
+#if !__has_attribute(__sentinel__)
+#define __sentinel__
+#endif
 #if !__has_attribute(__visibility__)
 #define __visibility__(...)
-#elif defined(__CYGWIN__)
-#define __visibility__(...)
 #endif
 #if !__has_attribute(__warn_unused_result__)
 #define __warn_unused_result__
 #endif
+#endif
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to