Message ID | 1496406158-12663-6-git-send-email-palves@redhat.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 22463 invoked by alias); 2 Jun 2017 12:29:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22367 invoked by uid 89); 2 Jun 2017 12:29:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:679 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Jun 2017 12:29:07 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB42BC049D59 for <gdb-patches@sourceware.org>; Fri, 2 Jun 2017 12:22:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CB42BC049D59 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CB42BC049D59 Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 486014DA33 for <gdb-patches@sourceware.org>; Fri, 2 Jun 2017 12:22:44 +0000 (UTC) From: Pedro Alves <palves@redhat.com> To: gdb-patches@sourceware.org Subject: [PATCH 05/40] command.h: Include scoped_restore_command.h Date: Fri, 2 Jun 2017 13:22:03 +0100 Message-Id: <1496406158-12663-6-git-send-email-palves@redhat.com> In-Reply-To: <1496406158-12663-1-git-send-email-palves@redhat.com> References: <1496406158-12663-1-git-send-email-palves@redhat.com> |
Commit Message
Pedro Alves
June 2, 2017, 12:22 p.m. UTC
This file depends on scoped_restore: extern scoped_restore_tmpl<int> prevent_dont_repeat (void); But doesn't include the corresponding header. gdb/ChangeLog: yyyy-mm-dd Pedro Alves <palves@redhat.com> * command.h: Include "scoped_restore_command.h". --- gdb/command.h | 1 + 1 file changed, 1 insertion(+)
Comments
Pedro Alves <palves@redhat.com> writes: > This file depends on scoped_restore: > > extern scoped_restore_tmpl<int> prevent_dont_repeat (void); > > But doesn't include the corresponding header. It is a function declaration, so why does it need scoped_restore? $ make check-headers CHECK_HEADERS="command.h" The command above doesn't complain anything. I tried gcc-5, 6, and 7.
On 06/27/2017 12:30 PM, Yao Qi wrote: > Pedro Alves <palves@redhat.com> writes: > >> This file depends on scoped_restore: >> >> extern scoped_restore_tmpl<int> prevent_dont_repeat (void); >> >> But doesn't include the corresponding header. > > It is a function declaration, so why does it need scoped_restore? I don't understand. Why wouldn't it? If the compiler doesn't know what scoped_restore_tmpl is, how can that compile? > > $ make check-headers CHECK_HEADERS="command.h" > > The command above doesn't complain anything. I tried gcc-5, 6, and 7. Odd. Let me take another look. I ran into this because at some point I added "#include "command.h" somewhere, which then failed to compile. Thanks, Pedro Alves
On 06/27/2017 12:45 PM, Pedro Alves wrote: > > On 06/27/2017 12:30 PM, Yao Qi wrote: >> Pedro Alves <palves@redhat.com> writes: >> >>> This file depends on scoped_restore: >>> >>> extern scoped_restore_tmpl<int> prevent_dont_repeat (void); >>> >>> But doesn't include the corresponding header. >> >> It is a function declaration, so why does it need scoped_restore? > > I don't understand. Why wouldn't it? If the compiler doesn't > know what scoped_restore_tmpl is, how can that compile? > >> >> $ make check-headers CHECK_HEADERS="command.h" >> >> The command above doesn't complain anything. I tried gcc-5, 6, and 7. > > Odd. Let me take another look. OK, so defs.h includes utils.h, which includes scoped_restore.h, as found via this hack: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git c/gdb/command.h w/gdb/command.h index aa179e9..f587ebd 100644 --- c/gdb/command.h +++ w/gdb/command.h @@ -415,6 +415,8 @@ extern void error_no_arg (const char *) ATTRIBUTE_NORETURN; extern void dont_repeat (void); +template <typename T> union scoped_restore_tmpl; + extern scoped_restore_tmpl<int> prevent_dont_repeat (void); /* Used to mark commands that don't do anything. If we just leave the ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/gdb/command.h:418:29: error: ‘union’ tag used in naming ‘struct scoped_restore_tmpl<T>’ [-fpermissive] template <typename T> union scoped_restore_tmpl; ^ In file included from src/gdb/utils.h:25:0, from src/gdb/defs.h:785, from <command-line>:0: src/gdb/common/scoped_restore.h:50:7: note: ‘struct scoped_restore_tmpl<T>’ was previously declared here class scoped_restore_tmpl : public scoped_restore_base ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > I ran into this because at some point I added "#include "command.h" > somewhere, which then failed to compile. I don't remember exactly where I added the #include "command.h" that triggered this. Must have been somewhere that caused "command.h" to be included via "defs.h", before the "#include utils.h" line. Let me try removing it from the series, see if I can still reproduce it. Thanks, Pedro Alves
On 06/27/2017 12:52 PM, Pedro Alves wrote: > I don't remember exactly where I added the #include "command.h" that > triggered this. Must have been somewhere that caused "command.h" to > be included via "defs.h", before the "#include utils.h" line. > > Let me try removing it from the series, see if I can still reproduce it. Found it. Patch #11 (https://sourceware.org/ml/gdb-patches/2017-06/msg00023.html) later does: diff --git c/gdb/symtab.h w/gdb/symtab.h index 5901cf9..fb08479 100644 --- c/gdb/symtab.h +++ w/gdb/symtab.h @@ -25,6 +25,7 @@ #include "gdbtypes.h" #include "common/enum-flags.h" #include "common/function-view.h" +#include "completer.h" which without this fix would break building all .o files like this: In file included from src/gdb/completer.h:21:0, from src/gdb/symtab.h:28, from src/gdb/language.h:26, from src/gdb/frame.h:72, from src/gdb/gdbarch.h:39, from src/gdb/defs.h:636, from src/gdb/top.c:20: src/gdb/command.h:434:8: error: ‘scoped_restore_tmpl’ does not name a type extern scoped_restore_tmpl<int> prevent_dont_repeat (void); ^ Makefile:1911: recipe for target 'top.o' failed because completer.h includes command.h, and that include chain happens before utils.h is included at the end of defs.h. I think it'd be good if defs.h didn't pull in so much, but I think that's orthogonal, and the current fix stands on its own. I should have included this info in the original submission. Sorry about that. Thanks, Pedro Alves
diff --git a/gdb/command.h b/gdb/command.h index aa179e9..4a56a51 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -19,6 +19,7 @@ #define COMMAND_H 1 #include "gdb_vecs.h" +#include "common/scoped_restore.h" /* This file defines the public interface for any code wanting to create commands. */