Changeset: 3008a274c14d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3008a274c14d
Modified Files:
        clients/Tests/exports.stable.out
        clients/mapilib/mapi.c
        gdk/gdk_system.h
        monetdb5/mal/mal_exception.h
        monetdb_config.h.in
Branch: Jan2022
Log Message:

Aligned attribute presence with oldest GCC we use (CentOS 7).
We use __has_attribute which does not exist on CentOS 7's GCC, so our
work around is now correct with respect to the attributes that compiler
does have.  Newer compilers do have __has_attribute, so they don't need
the work around.


diffs (148 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
@@ -906,7 +906,7 @@ const char *comment_onRef;
 const char *commitRef;
 str compileString(Symbol *fcn, Client c, str s);
 const char *compressRef;
-char *concatErrors(char *err1, const char *err2) __attribute__((__nonnull__(1, 
2))) __attribute__((__returns_nonnull__));
+char *concatErrors(char *err1, const char *err2) 
__attribute__((__nonnull__(1))) __attribute__((__nonnull__(2))) 
__attribute__((__returns_nonnull__));
 const char *connectRef;
 const char *contextRef;
 str convertConstant(malType type, ValPtr vr);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1080,7 +1080,7 @@ static char nomem[] = "Memory allocation
 
 static void
 mapi_clrError(Mapi mid)
-       __attribute__((__nonnull__));
+       __attribute__((__nonnull__(1)));
 
 static void
 mapi_clrError(Mapi mid)
@@ -1095,7 +1095,7 @@ mapi_clrError(Mapi mid)
 
 static MapiMsg
 mapi_setError(Mapi mid, const char *msg, const char *action, MapiMsg error)
-       __attribute__((__nonnull__(2, 3)));
+       __attribute__((__nonnull__(2))) __attribute__((__nonnull__(3)));
 
 static MapiMsg
 mapi_setError(Mapi mid, const char *msg, const char *action, MapiMsg error)
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -24,7 +24,8 @@
  * specific attributes that we use are known */
 #ifndef __has_attribute
 #ifndef __GNUC__
-#define __has_attribute(attr)  0
+/* 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
@@ -33,50 +34,60 @@
  * attributes that we use are known */
 #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__designated_init__ 0
 #define __has_attribute__malloc__ 1
+#define __has_attribute__nonnull__ 1
 #define __has_attribute__nonstring__ 0
-#define __has_attribute__noreturn__ 1
-#define __has_attribute__pure__ 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
-#if !__has_attribute(__warn_unused_result__)
-#define __warn_unused_result__
-#endif
-#if !__has_attribute(__malloc__)
-#define __malloc__
-#endif
 #if !__has_attribute(__alloc_size__)
 #define __alloc_size__(a)
 #endif
+#if !__has_attribute(__cold__)
+#define __cold__
+#endif
+#if !__has_attribute(__const__)
+#define __const__
+#endif
+#if !__has_attribute(__constructor__)
+#define __constructor__
+#endif
+#if !__has_attribute(__designated_init__)
+#define __designated_init__
+#endif
 #if !__has_attribute(__format__)
 #define __format__(a,b,c)
 #endif
+#if !__has_attribute(__malloc__)
+#define __malloc__
+#endif
+#if !__has_attribute(__nonnull__)
+#define __nonnull__(a)
+#endif
 #if !__has_attribute(__nonstring__)
 #define __nonstring__
 #endif
-#if !__has_attribute(__noreturn__)
-#define __noreturn__
-#endif
 #if !__has_attribute(__pure__)
 #define __pure__
 #endif
-#if !__has_attribute(__designated_init__)
-#define __designated_init__
+#if !__has_attribute(__returns_nonnull__)
+#define __returns_nonnull__
 #endif
-/* these are used in some *private.h files */
 #if !__has_attribute(__visibility__)
 #define __visibility__(a)
 #elif defined(__CYGWIN__)
 #define __visibility__(a)
 #endif
-#if !__has_attribute(__cold__)
-#define __cold__
+#if !__has_attribute(__warn_unused_result__)
+#define __warn_unused_result__
 #endif
 
 /* also see gdk.h for these */
diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h
--- a/monetdb5/mal/mal_exception.h
+++ b/monetdb5/mal/mal_exception.h
@@ -51,7 +51,7 @@ mal_export str createMalException(MalBlk
        __attribute__((__format__(__printf__, 4, 5)))
        __attribute__((__returns_nonnull__));
 mal_export char *concatErrors(char *err1, const char *err2)
-       __attribute__((__nonnull__(1, 2)))
+       __attribute__((__nonnull__(1))) __attribute__((__nonnull__(2)))
        __attribute__((__returns_nonnull__));
 mal_export bool isExceptionVariable(const char *nme);
 
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -453,7 +453,7 @@ gmtime_r(const time_t *restrict timep, s
 #endif
 #else
 #define LIB_STARTUP_FUNC(f) \
-        static void f(void) __attribute__((constructor)); \
+        static void f(void) __attribute__((__constructor__)); \
         static void f(void)
 #endif
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to