From patchwork Wed Feb 27 22:18:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31670 Received: (qmail 23815 invoked by alias); 27 Feb 2019 22:18:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23784 invoked by uid 89); 27 Feb 2019 22:18:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=transferring, 3004, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Feb 2019 22:18:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6773911659D; Wed, 27 Feb 2019 17:18:16 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id zZaZKzHp7a44; Wed, 27 Feb 2019 17:18:16 -0500 (EST) Received: from murgatroyd.Home (75-166-85-218.hlrn.qwest.net [75.166.85.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 1250E116120; Wed, 27 Feb 2019 17:18:16 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/7] Introduce ATTRIBUTE_UNUSED_RESULT and use it Date: Wed, 27 Feb 2019 15:18:08 -0700 Message-Id: <20190227221814.17661-2-tromey@adacore.com> In-Reply-To: <20190227221814.17661-1-tromey@adacore.com> References: <20190227221814.17661-1-tromey@adacore.com> MIME-Version: 1.0 This introduces the new ATTRIBUTE_UNUSED_RESULT define, and applies it to gdb_argv::release. gdb/ChangeLog 2019-02-27 Tom Tromey * utils.h (class gdb_argv) : Add ATTRIBUTE_UNUSED_RESULT. * common/common-defs.h (ATTRIBUTE_UNUSED_RESULT): Define. --- gdb/ChangeLog | 6 ++++++ gdb/common/common-defs.h | 6 ++++++ gdb/utils.h | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h index 732693d65cc..6b1f004ab1b 100644 --- a/gdb/common/common-defs.h +++ b/gdb/common/common-defs.h @@ -93,6 +93,12 @@ #undef ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF +#if GCC_VERSION >= 3004 +#define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) +#else +#define ATTRIBUTE_UNUSED_RESULT +#endif + #include "libiberty.h" #include "pathmax.h" #include "gdb/signals.h" diff --git a/gdb/utils.h b/gdb/utils.h index 896feb973c9..9dbd6386c68 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -188,7 +188,7 @@ public: /* Return the underlying array, transferring ownership to the caller. */ - char **release () + ATTRIBUTE_UNUSED_RESULT char **release () { char **result = m_argv; m_argv = NULL;