>From 3aa02993f6ddebbc4b1215c0e496001f12772de5 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 11:16:48 +1300 Subject: [PATCH 1/7] util/attr.h: use HAVE___ATTRIBUTE__, not __GNUC__ comparisons The comparisons that look like #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) fail if __GNUC_MINOR__ is 0. The intended comparison is something more like #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) However, given that: * these checks are really trying to test the presence of __attribute__, * there are now credible compilers that are not GCC, which have __attribute__ but might not be good at emulating __GNUC__ numbers, and * we really face little risk of running into GCC 2.95 * we have a HAVE___ATTRIBUTE__ check in ./configure let's not do the version comparisons. (Untested on GCC 2.95, GCC 3.0 and GCC 3.1). Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- lib/util/attr.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/util/attr.h b/lib/util/attr.h index b72696a..8e542c1 100644 --- a/lib/util/attr.h +++ b/lib/util/attr.h @@ -35,7 +35,7 @@ #endif #ifndef _DEPRECATED_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ @@ -43,7 +43,7 @@ #endif #ifndef _WARN_UNUSED_RESULT_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _WARN_UNUSED_RESULT_ __attribute__ ((warn_unused_result)) #else #define _WARN_UNUSED_RESULT_ @@ -51,7 +51,7 @@ #endif #ifndef _NORETURN_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _NORETURN_ __attribute__ ((noreturn)) #else #define _NORETURN_ @@ -59,7 +59,7 @@ #endif #ifndef _PURE_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1) +#ifdef HAVE___ATTRIBUTE__ #define _PURE_ __attribute__((pure)) #else #define _PURE_ @@ -67,7 +67,7 @@ #endif #ifndef NONNULL -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1) +#ifdef HAVE___ATTRIBUTE__ #define NONNULL(param) param __attribute__((nonnull)) #else #define NONNULL(param) param @@ -75,7 +75,7 @@ #endif #ifndef PRINTF_ATTRIBUTE -#if __GNUC__ >= 3 +#ifdef HAVE___ATTRIBUTE__ /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this @@ -87,11 +87,11 @@ #endif #ifndef FORMAT_ATTRIBUTE -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#ifdef HAVE___ATTRIBUTE__ /** Use gcc attribute to check printf fns. a1 is argument to format() * in the above macro. This is needed to support Heimdal's printf * decorations. Note that some gcc 2.x versions don't handle this - * properly, and as such I've used the same minimum from heimdal: GCC 3.1 **/ + * properly. **/ #define FORMAT_ATTRIBUTE(a) __attribute__ ((format a)) #else #define FORMAT_ATTRIBUTE(a) -- 2.5.0 >From e4840da6bb0032adb8bdf091f3cc98a8f05dc4ef Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:26:03 +1300 Subject: [PATCH 2/7] libreplace: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- lib/replace/replace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index c764d06..7080373 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -425,7 +425,7 @@ int rep_dlclose(void *handle); #endif #ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this @@ -437,7 +437,7 @@ int rep_dlclose(void *handle); #endif #ifndef _DEPRECATED_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ -- 2.5.0 >From 49d98da94492fe57a4fdbc3d4522ccb3232aa656 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:26:49 +1300 Subject: [PATCH 3/7] tevent.h: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- lib/tevent/tevent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index cb95507..cc6b15e 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -1752,7 +1752,7 @@ void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp, #ifdef TEVENT_DEPRECATED #ifndef _DEPRECATED_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ -- 2.5.0 >From 2dd4f2414b1763e28486467e8facb0f43acd09c8 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:27:45 +1300 Subject: [PATCH 4/7] s3/modules/getdate: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- source3/modules/getdate.c | 2 +- source3/modules/getdate.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/getdate.c b/source3/modules/getdate.c index a27b75f..6ed9946 100644 --- a/source3/modules/getdate.c +++ b/source3/modules/getdate.c @@ -181,7 +181,7 @@ # include #endif -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +#ifndef HAVE___ATTRIBUTE__ # define __attribute__(x) #endif diff --git a/source3/modules/getdate.y b/source3/modules/getdate.y index 21c01b8..1ddcda4 100644 --- a/source3/modules/getdate.y +++ b/source3/modules/getdate.y @@ -72,7 +72,7 @@ # include #endif -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +#ifndef HAVE___ATTRIBUTE__ # define __attribute__(x) #endif -- 2.5.0 >From bb3b4248c42941a79a5b29a4c110318b9e0967e4 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:28:45 +1300 Subject: [PATCH 5/7] mdssvc/sparql_parser.c: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- source3/rpc_server/mdssvc/sparql_parser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source3/rpc_server/mdssvc/sparql_parser.c b/source3/rpc_server/mdssvc/sparql_parser.c index 8170290..3cd532b 100644 --- a/source3/rpc_server/mdssvc/sparql_parser.c +++ b/source3/rpc_server/mdssvc/sparql_parser.c @@ -241,9 +241,7 @@ typedef short int yytype_int16; #endif #ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# if HAVE___ATTRIBUTE__ # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ -- 2.5.0 >From 7accb192be7951bce60e977f875f3f3a7b91eb50 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:29:50 +1300 Subject: [PATCH 6/7] s4/lib/wmi_wrap: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- source4/lib/wmi/wmi_wrap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/source4/lib/wmi/wmi_wrap.c b/source4/lib/wmi/wmi_wrap.c index a4aaf1b..07eba3e 100644 --- a/source4/lib/wmi/wmi_wrap.c +++ b/source4/lib/wmi/wmi_wrap.c @@ -39,13 +39,7 @@ /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) +# ifdef HAVE___ATTRIBUTE__ # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED -- 2.5.0 >From 37f97fb8973dbac274757a3dc24c9b7a5413d110 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 23 Mar 2016 15:30:22 +1300 Subject: [PATCH 7/7] third_party/zlib/zlib.h: use HAVE___ATTRIBUTE__ instead of __GNUC__ Signed-off-by: Douglas Bagnall --- third_party/zlib/zlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/zlib/zlib.h b/third_party/zlib/zlib.h index aa7f082..a303d77 100644 --- a/third_party/zlib/zlib.h +++ b/third_party/zlib/zlib.h @@ -213,7 +213,7 @@ typedef gz_header FAR *gz_headerp; #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1) +#ifdef HAVE___ATTRIBUTE__ /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this -- 2.5.0