From: Tomi Ollila Date: Tue, 1 Mar 2016 19:30:07 +0000 (+0200) Subject: [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=28da349ce6e9fa14ce80f07753da4125d4b4767f;p=notmuch-archives.git [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers --- diff --git a/26/311ff3af8099101d96e5b50212fafd2329a8bd b/26/311ff3af8099101d96e5b50212fafd2329a8bd new file mode 100644 index 000000000..d6dc5f2f7 --- /dev/null +++ b/26/311ff3af8099101d96e5b50212fafd2329a8bd @@ -0,0 +1,89 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 34B366DE01F7 + for ; Tue, 1 Mar 2016 11:30:08 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.307 +X-Spam-Level: +X-Spam-Status: No, score=0.307 tagged_above=-999 required=5 tests=[AWL=0.316, + HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-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 WyoYyzqGJ8ST for ; + Tue, 1 Mar 2016 11:30:05 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id 8E5606DE00DF + for ; Tue, 1 Mar 2016 11:30:05 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id C676A1001A7; Tue, 1 Mar 2016 21:30:09 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Cc: tomi.ollila@iki.fi +Subject: [PATCH v2] lib: NOTMUCH_DEPRECATED macro also for older compilers +Date: Tue, 1 Mar 2016 21:30:07 +0200 +Message-Id: <1456860607-3523-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 2.6.4 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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, 01 Mar 2016 19:30:08 -0000 + +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 +