From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C80406DE0244 for ; Tue, 11 Aug 2015 07:37:35 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.276 X-Spam-Level: X-Spam-Status: No, score=0.276 tagged_above=-999 required=5 tests=[AWL=0.816, RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sK7-dk5adroe for ; Tue, 11 Aug 2015 07:37:33 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 32B6E6DE119D for ; Tue, 11 Aug 2015 07:37:32 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id E95761000CA; Tue, 11 Aug 2015 17:37:19 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro Date: Tue, 11 Aug 2015 17:37:14 +0300 Message-Id: <1439303834-27030-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.0.0 Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 14:37:35 -0000 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