Changeset: b3a07b55ba60 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b3a07b55ba60
Modified Files:
        clients/examples/C/streamcat.c
        clients/mapilib/mapi.h
        clients/mapilib/mapi_intern.h
        clients/mapilib/msettings_internal.h
        clients/mapilib/parseurl.c
        clients/mapilib/writeurl.c
        clients/odbc/driver/ODBCGlobal.h
        common/stream/stream.h
        gdk/gdk_string.c
        monetdb5/mal/mal.h
        sql/backends/monet5/copy_misc.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/vaults/parquet/pqc_filemetadata.c
        sql/backends/monet5/vaults/parquet/pqc_reader.c
Branch: default
Log Message:

No need to have separate declaration just for attributes.


diffs (229 lines):

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,14 +75,12 @@ 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, _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.
  * If status is 1, include USAGE in the message.
  */
+__attribute__((__format__(__printf__, 2, 3)))
 static void
-croak(int status, const char *msg, ...)
+croak(int status, _In_z_ _Printf_format_string_ const char *msg, ...)
 {
        va_list ap;
 
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -255,7 +255,8 @@ mapi_export const char *mapi_get_host(Ma
        __attribute__((__nonnull__(1)));
 mapi_export const char *mapi_get_user(Mapi mid)
        __attribute__((__nonnull__(1)));
-mapi_export const char *mapi_get_mapi_version(void);
+mapi_export const char *mapi_get_mapi_version(void)
+       __attribute__((__const__));
 mapi_export const char *mapi_get_monet_version(Mapi mid)
        __attribute__((__nonnull__(1)));
 mapi_export const char *mapi_get_motd(Mapi mid)
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
@@ -275,7 +275,8 @@ void mapi_clrError(Mapi mid)
 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, _In_z_ 
_Printf_format_string_ const char *fmt, ...)
-       __attribute__((__nonnull__(2))) __attribute__((__format__(__printf__, 
4, 5)));
+       __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, _In_z_ _Printf_format_string_ const char *fmt, ...)
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
@@ -141,7 +141,8 @@ msettings_strdup(const msettings *mp, co
 
 __attribute__((__format__(__printf__, 2, 3)))
 static inline char*
-msettings_allocprintf(const msettings *mp, const char *fmt, ...)
+msettings_allocprintf(const msettings *mp,
+                     _In_z_ _Printf_format_string_ const char *fmt, ...)
 {
        char *buffer = NULL;
        va_list ap, ap2;
diff --git a/clients/mapilib/parseurl.c b/clients/mapilib/parseurl.c
--- a/clients/mapilib/parseurl.c
+++ b/clients/mapilib/parseurl.c
@@ -66,11 +66,9 @@ advance(scanner *sc)
        return sc->c;
 }
 
-static bool complain(scanner *sc, _In_z_ _Printf_format_string_ const char 
*fmt, ...)
-       __attribute__((__format__(printf, 2, 3)));
-
+__attribute__((__format__(printf, 2, 3)))
 static bool
-complain(scanner *sc, const char *fmt, ...)
+complain(scanner *sc, _In_z_ _Printf_format_string_ const char *fmt, ...)
 {
        // do not overwrite existing error message,
        // the first one is usually the most informative.
diff --git a/clients/mapilib/writeurl.c b/clients/mapilib/writeurl.c
--- a/clients/mapilib/writeurl.c
+++ b/clients/mapilib/writeurl.c
@@ -77,11 +77,9 @@ ob_append_escaped(struct outbuf *ob, con
        }
 }
 
-static void ob_printf(struct outbuf *ob, _In_z_ _Printf_format_string_ const 
char *fmt, ...)
-       __attribute__((__format__(__printf__, 2, 3)));
-
+__attribute__((__format__(__printf__, 2, 3)))
 static void
-ob_printf(struct outbuf *ob, const char *fmt, ...)
+ob_printf(struct outbuf *ob, _In_z_ _Printf_format_string_ const char *fmt, 
...)
 {
        va_list ap;
        size_t avail = ob->end - ob->pos;
diff --git a/clients/odbc/driver/ODBCGlobal.h b/clients/odbc/driver/ODBCGlobal.h
--- a/clients/odbc/driver/ODBCGlobal.h
+++ b/clients/odbc/driver/ODBCGlobal.h
@@ -98,11 +98,9 @@ extern const char *ODBCdebug;
 
 extern void setODBCdebug(const char *filename, bool overrideEnvVar);
 
-static inline void ODBCLOG(_In_z_ _Printf_format_string_ const char *fmt, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-
+__attribute__((__format__(__printf__, 1, 2)))
 static inline void
-ODBCLOG(const char *fmt, ...)
+ODBCLOG(_In_z_ _Printf_format_string_ const char *fmt, ...)
 {
        va_list ap;
 
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -78,7 +78,8 @@ typedef enum mnstr_flush_level {
        MNSTR_FLUSH_ALL = 2,  // write all data and also reset compression state
 } mnstr_flush_level;
 
-stream_export const char *mnstr_version(void);
+stream_export const char *mnstr_version(void)
+       __attribute__((__const__));
 
 stream_export char *mnstr_error(const stream *s);
 stream_export const char* mnstr_peek_error(const stream *s);
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -7151,9 +7151,9 @@ static const int casefold[4672] = {
  * large enough, it is extended using the given allocator; on return
  * (with or without error), the current buffer is in *buf, and the
  * current size in *buflen. */
+__attribute__((__access__(read_write, 2)))
+__attribute__((__access__(read_write, 3)))
 static gdk_return
-       __attribute__((__access__(read_write, 2)))
-       __attribute__((__access__(read_write, 3)))
 convertcase(allocator *ma, char **restrict buf, size_t *restrict buflen,
            const uint8_t *restrict s, int direction)
 {
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -72,7 +72,8 @@ mal_export int mal_init(const char *cons
                                                const char *initpasswd, const 
char *caller_revision);
 mal_export _Noreturn void mal_exit(int status);
 mal_export void mal_reset(void);
-mal_export const char *mal_version(void);
+mal_export const char *mal_version(void)
+       __attribute__((__const__));
 
 /* This should be here, but cannot, as "Client" isn't known, yet ... |-(
  * For now, we move the prototype declaration to src/mal/mal_client.c,
diff --git a/sql/backends/monet5/copy_misc.c b/sql/backends/monet5/copy_misc.c
--- a/sql/backends/monet5/copy_misc.c
+++ b/sql/backends/monet5/copy_misc.c
@@ -88,12 +88,11 @@ copy_destroy_error_handling(struct error
                BBPunfix(admin->rows->batCacheid);
 }
 
+__attribute__((__format__(__printf__, 7, 0)))
 static void
-format_error(struct error_handling *restrict admin, lng row_number, int 
column_1based, const char *colname,char *buf, char *buf_end, const char 
*format, va_list ap)
-       __attribute__((__format__(__printf__, 7, 0)));
-
-static void
-format_error(struct error_handling *restrict admin, lng row_1based, int 
column_1based, const char *colname,char *buf, char *buf_end, const char 
*format, va_list ap)
+format_error(struct error_handling *restrict admin, lng row_1based,
+                        int column_1based, const char *colname, char *buf, 
char *buf_end,
+                        _In_z_ _Printf_format_string_ const char *format, 
va_list ap)
 {
        char col_msg[100];
        if (is_int_nil(column_1based))
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -968,13 +968,13 @@ sql_relation2stmt(backend *be, sql_rel *
        return s;
 }
 
-static int
 #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 8
 /* bug on CentOS 7 (gnuc 4.8.5) where this function gets inlined and
  * the compiler then complains about query getting modified after the
  * setjmp call; fix is to explicitly prevent inlining */
 __attribute__((__noinline__))
 #endif
+static int
 backend_dumpstmt_body(backend *be, MalBlkPtr mb, sql_rel *r, int top, int 
add_end, const char *query)
 {
        mvc *m = be->mvc;
diff --git a/sql/backends/monet5/vaults/parquet/pqc_filemetadata.c 
b/sql/backends/monet5/vaults/parquet/pqc_filemetadata.c
--- a/sql/backends/monet5/vaults/parquet/pqc_filemetadata.c
+++ b/sql/backends/monet5/vaults/parquet/pqc_filemetadata.c
@@ -61,13 +61,11 @@ struct pqc_file {
 
 #define PQC_MAGIC(c) ((c)[0] == 'P' && (c)[1] == 'A' && (c)[2] == 'R' && 
(c)[3] == '1')
 
+#define ERRSIZE 1024
+__attribute__((__format__(__printf__, 2, 3)))
 static void
-pq_set_error( pqc_file *pq, const char *format, ... )
-       __attribute__((__format__(__printf__, 2, 3)));
-
-#define ERRSIZE 1024
-static void
-pq_set_error( pqc_file *pq, const char *format, ... )
+pq_set_error(pqc_file *pq,
+                        _In_z_ _Printf_format_string_ const char *format, ... )
 {
        va_list ap;
 
diff --git a/sql/backends/monet5/vaults/parquet/pqc_reader.c 
b/sql/backends/monet5/vaults/parquet/pqc_reader.c
--- a/sql/backends/monet5/vaults/parquet/pqc_reader.c
+++ b/sql/backends/monet5/vaults/parquet/pqc_reader.c
@@ -128,12 +128,10 @@ struct pqc_reader_t {
        pqc_creader_t *creader; /* per worker readers */
 };
 
+__attribute__((__format__(__printf__, 2, 3)))
 static void
-pqc_set_error( pqc_reader_t *r, const char *format, ... )
-       __attribute__((__format__(__printf__, 2, 3)));
-
-static void
-pqc_set_error( pqc_reader_t *r, const char *format, ... )
+pqc_set_error(pqc_reader_t *r,
+                         _In_z_ _Printf_format_string_ const char *format, ... 
)
 {
        va_list ap;
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to