From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iEaIHDcbjGKbQwAAbAwnHQ (envelope-from ) for ; Tue, 24 May 2022 01:39:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EMhMHDcbjGLkOAEAauVa8A (envelope-from ) for ; Tue, 24 May 2022 01:39:35 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 499E439A97 for ; Tue, 24 May 2022 01:39:35 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 010CD5F795; Mon, 23 May 2022 23:39:15 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 2ECBA5F724 for ; Mon, 23 May 2022 23:39:11 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 5E7F05FC0D; Mon, 23 May 2022 19:39:10 -0400 (EDT) Received: (nullmailer pid 3506951 invoked by uid 1000); Mon, 23 May 2022 23:39:02 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 5/8] lib: define macro NODISCARD Date: Mon, 23 May 2022 20:38:58 -0300 Message-Id: <20220523233901.3506880-6-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220523233901.3506880-1-david@tethera.net> References: <20220523233901.3506880-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: CJ6L2C5QKA6DS4PQ2VIVEDON2NKHF4AI X-Message-ID-Hash: CJ6L2C5QKA6DS4PQ2VIVEDON2NKHF4AI X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653349175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=P3W/0ohz5eVGeMlO9pZUGspJ94gx7E15/MtlXTG3qTA=; b=kV+gzx/33Xfp+fimub+g0hwOThnG/AXCpiVpdxPHIG+YtaA5grK9cUSMZsTSw1uu/K9QsR 7kSGdeRHJvT7Pq743glKkOkXLyF8J31hsT0YQ9HQjoVuu3lJwEZmAwECkkIRAreLAb/ShW uBsNmxK337haxupZklT1i7aqmMnZnsQ8hzDRABJitpj+LJSxZTuh0AFatm8QaQCf0zs6fs 8e/OcxJZac3KSrD1Z1Ru0LrR8A2XEAOLrjjbmXjf5sVyQoM0euUsu5/AXgofaugRykxE+T P526NuzMeCV9vfrVX+zXhJcHsZMcWKgV5pgculPxRtGhm/Ob1Dyu9idulk7khQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653349175; a=rsa-sha256; cv=none; b=SdysVw80kYDXfSvmCuWfvRUX9mOdq+JvcBtgISyBWx2qzsAq1gBI7ebrgu+jcmH2pdB5yC JdvtL09tZV4M+nAaMxsERxDoQPO6fG+Zq73iJa5vRtX9chq8lbUtzRoy/KzOFi6/0Ql0xM GXaefGuX5uRxfDuctDGsOtQaFiodNs0uLrDDdUfGKcg5whQ3h7eGZgllh0YVq55wWckPRt x4nNt6QXWsbTU+zCDgRESeyewJ8XBXiO9q5kudTzJXhxDZvJH16ItEKf464xlq/6aLlbPk Bric6qfwZL5UfnYFPxl6+Yz1ccWhhcuB7ymyyKNpJp+izcaNXNg+JiBgwqbacg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.00 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 499E439A97 X-Spam-Score: -2.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: t3sfuvJE4PE9 In either C++17 (or later) mode, or when running cppcheck, this can be used to selectively generate warnings about discarded return values. --- lib/notmuch-private.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index c63cfe5e..1c2290b2 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -750,6 +750,12 @@ _notmuch_talloc_steal (const void *new_ctx, const T *ptr) #undef talloc_steal #define talloc_steal _notmuch_talloc_steal #endif + +#if __cplusplus >= 201703L || __cppcheck__ +#define NODISCARD [[nodiscard]] +#else +#define NODISCARD /**/ +#endif #endif #endif -- 2.35.2