Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2016-03-01 Thread Justus Winter
Quoting Jani Nikula (2015-12-29 12:52:20)
> > __has_extension() replacement was modeled after __has_attribute()
> > definition in compat/function-attributes.h. Thanks Justus.

Hum, I didn't even recall doing that.

> > +/* clang provides this macro to test for support for language
> > + * extensions. If it isn't defined, this provides a compatibility
> > + * macro for other compilers.
> > + */
> > +#ifndef __has_extension
> > +#define __has_extension(x) 0
> > +#endif
> 
> This file is included by the users of the library, and thus this
> definition leaks to our users. It might cause problems if the users have
> different expectations for handling ifndef __has_extension. I don't
> think we should define things outside of our namespace in notmuch.h.

Indeed, even more so since the __ namespace is reserved.  But that
should be easy to fix, right?  Simply pick a less problematic name for
the new macro.

I'd love to see this issue fixed.

Cheers,
Justus
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-12-29 Thread Jani Nikula
On Tue, 11 Aug 2015, Tomi Ollila  wrote:
> Some compilers (older than gcc 4.5 and clang 2.9) do support
> __attribute__ ((deprecated)) but not
> __attribute__ ((deprecated("message"))).
>
> Check (clang) and know (gcc) which versions support which variants
> and make two definitions of define NOTMUCH_DEPRECATED macro;
> one with and and one without the ("message") part.
>
> __has_extension() replacement was modeled after __has_attribute()
> definition in compat/function-attributes.h. Thanks Justus.
> ---
>  lib/notmuch.h | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index b1f5bfa..3f4621b 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -59,8 +59,22 @@ NOTMUCH_BEGIN_DECLS
>  #define LIBNOTMUCH_MINOR_VERSION 3
>  #define LIBNOTMUCH_MICRO_VERSION 0
>  
> +/* clang provides this macro to test for support for language
> + * extensions. If it isn't defined, this provides a compatibility
> + * macro for other compilers.
> + */
> +#ifndef __has_extension
> +#define __has_extension(x) 0
> +#endif

This file is included by the users of the library, and thus this
definition leaks to our users. It might cause problems if the users have
different expectations for handling ifndef __has_extension. I don't
think we should define things outside of our namespace in notmuch.h.

BR,
Jani.

> +
> +#if __clang__ && __has_extension(attribute_deprecated_with_message) || \
> +__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 5
>  #define NOTMUCH_DEPRECATED(major,minor) \
>  __attribute__ ((deprecated ("function deprecated as of libnotmuch " 
> #major "." #minor)))
> +#else
> +#define NOTMUCH_DEPRECATED(major,minor) __attribute__ ((deprecated))
> +#endif
> +
>  #endif /* __DOXYGEN__ */
>  
>  /**
> -- 
> 2.4.3
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-12-08 Thread David Bremner
Tomi Ollila  writes:

> Some compilers (older than gcc 4.5 and clang 2.9) do support
> __attribute__ ((deprecated)) but not
> __attribute__ ((deprecated("message"))).
>
> Check (clang) and know (gcc) which versions support which variants
> and make two definitions of define NOTMUCH_DEPRECATED macro;
> one with and and one without the ("message") part.
>
> __has_extension() replacement was modeled after __has_attribute()
> definition in compat/function-attributes.h. Thanks Justus.

Hi Tomi;

I keep coming back to review this patch, but I'm blocked by the fact
that clang++ is broken on Debian (and lots of other places, I guess) for
months.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797038

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-12-08 Thread Tomi Ollila
On Tue, Dec 08 2015, David Bremner  wrote:

> Tomi Ollila  writes:
>
>> Some compilers (older than gcc 4.5 and clang 2.9) do support
>> __attribute__ ((deprecated)) but not
>> __attribute__ ((deprecated("message"))).
>>
>> Check (clang) and know (gcc) which versions support which variants
>> and make two definitions of define NOTMUCH_DEPRECATED macro;
>> one with and and one without the ("message") part.
>>
>> __has_extension() replacement was modeled after __has_attribute()
>> definition in compat/function-attributes.h. Thanks Justus.
>
> Hi Tomi;
>
> I keep coming back to review this patch, but I'm blocked by the fact
> that clang++ is broken on Debian (and lots of other places, I guess) for
> months.
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797038

Personally I am not fond of the commit message but I don't want to
emphasize the change by sending an updated one. We could move it
to *moreinfo* to get it out of our ways for the time being -- and
see whether things stabilize (to one way or another) to decide 
whether to push this further. 

>
> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-08-11 Thread Tomi Ollila
Some compilers (older than gcc 4.5 and clang 2.9) do support
__attribute__ ((deprecated)) but not
__attribute__ ((deprecated("message"))).

Check (clang) and know (gcc) which versions support which variants
and make two definitions of define NOTMUCH_DEPRECATED macro;
one with and and one without the ("message") part.

__has_extension() replacement was modeled after __has_attribute()
definition in compat/function-attributes.h. Thanks Justus.
---
 lib/notmuch.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index b1f5bfa..3f4621b 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -59,8 +59,22 @@ NOTMUCH_BEGIN_DECLS
 #define LIBNOTMUCH_MINOR_VERSION   3
 #define LIBNOTMUCH_MICRO_VERSION   0

+/* clang provides this macro to test for support for language
+ * extensions. If it isn't defined, this provides a compatibility
+ * macro for other compilers.
+ */
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+
+#if __clang__ && __has_extension(attribute_deprecated_with_message) || \
+__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 5
 #define NOTMUCH_DEPRECATED(major,minor) \
 __attribute__ ((deprecated ("function deprecated as of libnotmuch " #major 
"." #minor)))
+#else
+#define NOTMUCH_DEPRECATED(major,minor) __attribute__ ((deprecated))
+#endif
+
 #endif /* __DOXYGEN__ */

 /**
-- 
2.4.3



[PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-08-11 Thread Tomi Ollila
Some compilers (older than gcc 4.5 and clang 2.9) do support
__attribute__ ((deprecated)) but not
__attribute__ ((deprecated(message))).

Check (clang) and know (gcc) which versions support which variants
and make two definitions of define NOTMUCH_DEPRECATED macro;
one with and and one without the (message) part.

__has_extension() replacement was modeled after __has_attribute()
definition in compat/function-attributes.h. Thanks Justus.
---
 lib/notmuch.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index b1f5bfa..3f4621b 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -59,8 +59,22 @@ NOTMUCH_BEGIN_DECLS
 #define LIBNOTMUCH_MINOR_VERSION   3
 #define LIBNOTMUCH_MICRO_VERSION   0
 
+/* clang provides this macro to test for support for language
+ * extensions. If it isn't defined, this provides a compatibility
+ * macro for other compilers.
+ */
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+
+#if __clang__  __has_extension(attribute_deprecated_with_message) || \
+__GNUC__  4 || __GNUC__ == 4  __GNUC_MINOR__ = 5
 #define NOTMUCH_DEPRECATED(major,minor) \
 __attribute__ ((deprecated (function deprecated as of libnotmuch  #major 
. #minor)))
+#else
+#define NOTMUCH_DEPRECATED(major,minor) __attribute__ ((deprecated))
+#endif
+
 #endif /* __DOXYGEN__ */
 
 /**
-- 
2.4.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch