unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers
@ 2016-03-01 19:30 Tomi Ollila
  2016-03-05  0:44 ` David Bremner
  2016-03-14 23:02 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Tomi Ollila @ 2016-03-01 19:30 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

Some compilers (older than gcc 4.5 and clang 2.9) do support
__attribute__ ((deprecated)) but not
__attribute__ ((deprecated("message"))).

Check if clang version is at least 3.0, or gcc version
is at least 4.5 to define NOTMUCH_DEPRECATED as the
latter variant above. Otherwise define NOTMUCH_DEPRECATED
as the former variant above.

For a bit simpler implementation clang 2.9 is not included
to use the newer variant. It is just one release, and the
older one works fine. Clang 3.0 was released around 2011-11
and gcc 5.1 2015-04-22 (therefore newer macro for gcc 4.5+)
---

V2 of id:1439303834-27030-1-git-send-email-tomi.ollila@iki.fi
-- without the namespace problem (and somewhat better commit message).

 lib/notmuch.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 310a8b8a3132..cb46fc057d3e 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -59,8 +59,17 @@ NOTMUCH_BEGIN_DECLS
 #define LIBNOTMUCH_MINOR_VERSION	3
 #define LIBNOTMUCH_MICRO_VERSION	0
 
+
+#if defined (__clang_major__) && __clang_major__ >= 3 \
+    || defined (__GNUC__) && __GNUC__ >= 5 \
+    || defined (__GNUC__) && __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.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers
  2016-03-01 19:30 [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers Tomi Ollila
@ 2016-03-05  0:44 ` David Bremner
  2016-03-14 23:02 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2016-03-05  0:44 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> Some compilers (older than gcc 4.5 and clang 2.9) do support
> __attribute__ ((deprecated)) but not
> __attribute__ ((deprecated("message"))).

I _still_ can't properly link against xapian with Clang (in debian
testing/unstable), but oh well, it doesn't break things with GCC.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers
  2016-03-01 19:30 [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers Tomi Ollila
  2016-03-05  0:44 ` David Bremner
@ 2016-03-14 23:02 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2016-03-14 23:02 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> Some compilers (older than gcc 4.5 and clang 2.9) do support
> __attribute__ ((deprecated)) but not
> __attribute__ ((deprecated("message"))).
>
> Check if clang version is at least 3.0, or gcc version
> is at least 4.5 to define NOTMUCH_DEPRECATED as the
> latter variant above. Otherwise define NOTMUCH_DEPRECATED
> as the former variant above.


pushed,

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-14 23:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-01 19:30 [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers Tomi Ollila
2016-03-05  0:44 ` David Bremner
2016-03-14 23:02 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).