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 791E06DE17E7 for ; Tue, 29 Dec 2015 03:53:13 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.543 X-Spam-Level: X-Spam-Status: No, score=-0.543 tagged_above=-999 required=5 tests=[AWL=0.177, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-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 w2ixne8PCLK4 for ; Tue, 29 Dec 2015 03:53:10 -0800 (PST) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by arlo.cworth.org (Postfix) with ESMTPS id 75A7A6DE17E1 for ; Tue, 29 Dec 2015 03:53:10 -0800 (PST) Received: by mail-wm0-f48.google.com with SMTP id f206so35548007wmf.0 for ; Tue, 29 Dec 2015 03:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=gJDb91SBvAJdrqd0GE0Fa3//0HXVbMQfBxs6e1NQHyg=; b=Sij/8QYbjTHgmwWM6UfRPVzv8saMMxu7KQO7tHTUYJsz23LIlsFIsL54negmhnKjoU g51A7rHLCuAZUc8TMBztdLNsgvDXf4DQuULt+hR5pKnQ5Ju/ot6oHEGe01k9s4pRQFND FJcf+Pn7DUSrtxhTcRTCV56BN11TpWyezzXXFoVVohYzlwUF03gy9yevhwTMvJDm3b6R p2obn1TAQdqmFNXNiWs+R9Ea6ifPPx2epLzAi3rmPmmsUgXIgl2ok5swWz9DVzpj9QFQ 73CZ0VHxGyBWzvyBhoWvcb7V3z+bx9Gufajbl2gyAHfjyR0fG+bNa90oM2erE1g4VA4n RXiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=gJDb91SBvAJdrqd0GE0Fa3//0HXVbMQfBxs6e1NQHyg=; b=Lbt5ovUc/UaM0+0/zSvy+9MpEwMB9R+edOFLViSUboTGrL2OBuS4VHA8IMQY1/M6gS 3wo9BMBiT3OOVbc1yjZ/xp/fC0Y39LDh+Az/XpBYF0JzXGb+YkGsi1wdjl6J6nn6jVG9 VVz2KO8C6YoEfq85D1Sb8UMJhTL/MeZJJPuX9lBGIwIt9uZf2ahCOS1yc8Gqe0p0GAzP fmUQdsGLd8nHkU7tTMyoEVeWq8FBcQeGYSuCeYtmVKTmX7G7nhAveiou0CyQZ6cUpoK+ yM632h5S1Y/vsoZn7Uanm3ewcBUial5OvSiHZxU2MOPB2sMiAByabbI+jEaKnSPp8NvL v5lQ== X-Gm-Message-State: ALoCoQlfxClOY5bOx6WK5O3S6xogGiWmyhe5qC9l04Ps6wk777iph5BVLkbWhOwuQTg5VeqZu3g8bw8B1pgxbj6KGwZJ1Ok4qA== X-Received: by 10.195.18.100 with SMTP id gl4mr6327520wjd.177.1451389988307; Tue, 29 Dec 2015 03:53:08 -0800 (PST) Received: from localhost (mobile-access-bceee6-244.dhcp.inet.fi. [188.238.230.244]) by smtp.gmail.com with ESMTPSA id u69sm19259063wmu.20.2015.12.29.03.53.07 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Dec 2015 03:53:07 -0800 (PST) From: Jani Nikula To: Tomi Ollila , notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro In-Reply-To: <1439303834-27030-1-git-send-email-tomi.ollila@iki.fi> References: <1439303834-27030-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.21+27~g2b12735 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Tue, 29 Dec 2015 13:52:20 +0200 Message-ID: <87k2nxh3pn.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain 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, 29 Dec 2015 11:53:13 -0000 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