From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id CD0173858430 for ; Sat, 9 Jul 2022 05:57:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD0173858430 Received: by mail-wm1-x329.google.com with SMTP id o19-20020a05600c511300b003a2de48b4bbso871972wms.5 for ; Fri, 08 Jul 2022 22:57:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=skKEkXqnAgHE+bpOcf0G9uVrgDX1GOxqeG8+XTIjfMQ=; b=QPDaXWvwLnXzYuQMfX98vfzjSK6pcakyOSOHUA3dYY3rMBqGPWjJ7BiVmK6+ow/H4a KpTKm/Ic1mELRu2BS70oyjdWFBqiNTa6N1Q56HBjoA9fkeGxP78JDzxKuKNmHw/KMkod uV6Rfq96S7sdKc4GSDg4uxw6JJZfe3P5uTaRvlnAKW5wwqeUBW3IpbGQUpyxxftEAtAG iJCHbqsKo45ier+tet2iOIttbCM2tTRWGnbm8Un0PbUKkL1vzu0Jn1mcbTEf4thc3ApH azsER5kkblhh6UAYkJdf/ufCsp2rwcWGfweO9vgJQEULs82wXTBk+xNEmhkGKDN2+7Ah igVA== X-Gm-Message-State: AJIora+KnQvr8p8zu5wVI6j4Z8irN8zMYnhNGlnxjyj8nxAy3ixIh7Eg dvgmoKq0dZ7uvtzb3qghS7g7yc2I/bpjcXbD08D7Lg== X-Google-Smtp-Source: AGRyM1uouWp3pNjfFKMm2NkHvY2CGcU/QJdbdyyX5jYCQtqzYtA5EsE97XSqLyiOVepDfgAonbQkA3Z6GP4BoR5YBRs= X-Received: by 2002:a05:600c:4fc8:b0:3a1:99cf:7fe with SMTP id o8-20020a05600c4fc800b003a199cf07femr3564019wmq.142.1657346264155; Fri, 08 Jul 2022 22:57:44 -0700 (PDT) MIME-Version: 1.0 References: <20220628010427.1856503-1-cjdb@google.com> In-Reply-To: From: Manoj Gupta Date: Fri, 8 Jul 2022 22:57:33 -0700 Message-ID: Subject: Re: [PATCH] [PATCH] [gdb] adds `` to list of includes To: Enze Li Cc: Christopher Di Bella , gdb-patches@sourceware.org X-Spam-Status: No, score=-27.3 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Sat, 09 Jul 2022 05:57:48 -0000 I work on ChromeOS and can provide answers to this. does not include provide std::back_inserter as per C++ spec. It is provided by [1]. The fact that it worked so far is just an accident that libc++ and libstdc++ were including this header with . With libc++, it is no longer true. See commit "[libc++] Removes unneeded includes." in libc++ [2]. It is therefore not surprising that gdb fails to build. On Fri, Jul 8, 2022 at 9:30 PM Enze Li wrote: > Hi Christopher, > > Unfortunately, since I don't have a ChromeBook, I can not reproduce the > problem you encountered. > > I tried to reproduce your problem on a x86_64-linux device and still > did not reproduce it with the trunk. After digging into this deeply, I > found that 'gdb/value.c' has already includes the 'vector' header file > after preprocessing. > > Here's what I got, > > value.c > |--defs.h > |--common-defs.h > |--common-utils.h (#include ) > > Finally, I noticed that you were compiling gdb-9.2. I know nothing > about the maintenance of closed branch. You may want to keep PING and > maintainers would show up to look at this. > > Inclusion of is not guaranteed to provide . And I believe that the current gdb still does not include in value.c [3]. So I am sure that this patch is still needed in trunk. Note: Looking at value.c, I think it needs more header includes e.g. std::move [4] is used but is not included. [1] https://en.cppreference.com/w/cpp/iterator/back_inserter [2] [libc++] Removes unneeded includes: https://reviews.llvm.org/rG4cd04d1687f1096990119304a3eb22081ab4bb29 [3] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/value.c;h=022fca91a42a8b4d5bccc745b62e642aea8a02ed;hb=refs/heads/master [4]: https://en.cppreference.com/w/cpp/utility/move Thanks, Manoj > Thanks, > Enze > > On Fri, 2022-07-01 at 14:50 -0700, Christopher Di Bella wrote: > > Hi Enze, > > > > `std::back_inserter` is defined in , which isn't included > > in `gdb/value.c`. Because the C preprocessor imports headers by > > copy/pasting the contents at the `#include` site, this means that > > another standard library header is exposing it (presumably > > ``). > > > > We experienced this on ChromeOS, which uses Clang and libc++ to build > > things. > > > > ``` > > /tmp/portage/sys-devel/gdb-9.2.20200923-r7/work/gdb- > > 9.2/gdb/value.c:1648:52: error: no member named 'back_inserter' in > > namespace 'std' > > std::move (iter + 1, all_values.end (), std::back_inserter > > (result)); > > ~~~~~^ > > 1 error generated. > > ``` > > > > On Fri, 1 Jul 2022 at 06:45, Enze Li wrote: > > > On Tue, 2022-06-28 at 01:04 +0000, Christopher Di Bella via Gdb- > > > patches > > > wrote: > > > > `std::back_inserter` is defined in ``, which is > > > > currently > > > > being transitively included by one of the other headers. This is > > > > causing > > > > gdb to fail to build on certain platforms, which is fixed by > > > > explicitly > > > > including it. > > > > > > Hi Christopher, > > > > > > I didn't get your point through the commit message. Can you > > > clarify > > > exactly on which platforms, and what build error you encountered? > > > So > > > that I can reproduce the issue. > > > > > > Thanks, > > > Enze > > > > > > > > > > --- > > > > gdb/value.c | 1 + > > > > 1 file changed, 1 insertion(+) > > > > > > > > diff --git a/gdb/value.c b/gdb/value.c > > > > index 022fca91a42..ba7ae1a0e18 100644 > > > > --- a/gdb/value.c > > > > +++ b/gdb/value.c > > > > @@ -40,6 +40,7 @@ > > > > #include "cp-abi.h" > > > > #include "user-regs.h" > > > > #include > > > > +#include > > > > #include "completer.h" > > > > #include "gdbsupport/selftest.h" > > > > #include "gdbsupport/array-view.h" > > > > > > > > >