From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 023E43AAA080 for ; Fri, 13 Mar 2020 19:09:03 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F0179561B1; Fri, 13 Mar 2020 15:09:02 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com 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 sIOr6yTFPp98; Fri, 13 Mar 2020 15:09:02 -0400 (EDT) Received: from murgatroyd.Home (184-96-250-69.hlrn.qwest.net [184.96.250.69]) (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 A34F0561B0; Fri, 13 Mar 2020 15:09:02 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v3 18/29] Fix up complaints.h for namespace use Date: Fri, 13 Mar 2020 13:08:44 -0600 Message-Id: <20200313190855.28662-19-tromey@adacore.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200313190855.28662-1-tromey@adacore.com> References: <20200313190855.28662-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 19:09:03 -0000 If 'complaint' is used in a namespace context, it will fail because 'stop_whining' is only declared at the top level. This patch fixes this problem in a simple way, by moving the declaration of 'stop_whining' out of the macro and to the top-level. gdb/ChangeLog 2020-03-13 Tom Tromey * complaints.h (stop_whining): Declare at top-level. (complaint): Don't declare stop_whining. --- gdb/ChangeLog | 5 +++++ gdb/complaints.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/complaints.h b/gdb/complaints.h index b3bb4068e1b..6ad056d257e 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -25,6 +25,10 @@ extern void complaint_internal (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2); +/* This controls whether complaints are emitted. */ + +extern int stop_whining; + /* Register a complaint. This is a macro around complaint_internal to avoid computing complaint's arguments when complaints are disabled. Running FMT via gettext [i.e., _(FMT)] can be quite expensive, for @@ -32,8 +36,6 @@ extern void complaint_internal (const char *fmt, ...) #define complaint(FMT, ...) \ do \ { \ - extern int stop_whining; \ - \ if (stop_whining > 0) \ complaint_internal (FMT, ##__VA_ARGS__); \ } \ -- 2.21.1