From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 619773858422 for ; Tue, 26 Jul 2022 23:45:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 619773858422 Received: by mail-wm1-x32c.google.com with SMTP id r206-20020a1c44d7000000b003a34ac64bdfso17746wma.1 for ; Tue, 26 Jul 2022 16:45:14 -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=TOsyVBuAr6hjwjLWKGXC31+sfINEVxw9SuKjZIXuR9E=; b=gSyptdw6PpkCi11hd9185HRs40VpedDSn5oyF5Ys1Tc6xcGRTLe1/s4bJ/6l7f6HWg 4HL0he4/jUCN1wJ/1hVnt6cg0bqbB/DgDzfXGDZclYTkZCtQB/oUzHGvZBM2jSymFbJC RzYNXK44TcoqTWz0a0DjNUDPIDkFEvMv2jWsZBSR/Yuoo+wQafiInFGoMaPG3Pg0wzsU 5JcJ1vH61VgVpdy79UEa/YWMuWIGO3gMlVzEwb9nev5JtYPwdzHZU9vP+Dp386fskgcJ /IjT94aWlilKtS+WmgEj96Zy1ezflpmRcCfKWFbJfSo55afvmxfn1QSJ8rU9oSSewLmS Qi6w== X-Gm-Message-State: AJIora8qKo6ZEL8H6UTKGfYFGR6irIONROWaaBdEIjyvI5C0tiYK5Mt7 irBnN/YKagudm3cuq3CChsJRyNvXbe+pqdyJxQAy3A== X-Google-Smtp-Source: AGRyM1uuHUVmgoapcsolRpU3E45BJUhFruk97VBEZPj3T6bZbnqyduBmlJNHT2ItIRCsGok/84FQFTqOt8LsXOJhMwM= X-Received: by 2002:a1c:19c3:0:b0:39c:6479:3ca with SMTP id 186-20020a1c19c3000000b0039c647903camr912457wmz.27.1658879113044; Tue, 26 Jul 2022 16:45:13 -0700 (PDT) MIME-Version: 1.0 References: <20220720060120.1250880-1-cjdb@google.com> <145f7f34-6558-bd0d-7e74-a7183332c196@palves.net> <5035eff4-c960-3770-cf1a-eddb2301792f@simark.ca> In-Reply-To: <5035eff4-c960-3770-cf1a-eddb2301792f@simark.ca> From: Manoj Gupta Date: Tue, 26 Jul 2022 16:45:01 -0700 Message-ID: Subject: Re: [PATCH] [PATCH] [gdb] adds several headers to the include list To: Simon Marchi Cc: Pedro Alves , Christopher Di Bella , gdb-patches@sourceware.org X-Spam-Status: No, score=-27.2 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, 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: Tue, 26 Jul 2022 23:45:20 -0000 On Fri, Jul 22, 2022 at 12:26 PM Simon Marchi wrote: > > > On Thu, Jul 21, 2022 at 10:41 AM Pedro Alves pedro@palves.net>> wrote: > > > > > diff --git a/gdb/value.c b/gdb/value.c > > > index 022fca91a42..c9bec678d95 100644 > > > --- a/gdb/value.c > > > +++ b/gdb/value.c > > > @@ -40,6 +40,9 @@ > > > #include "cp-abi.h" > > > #include "user-regs.h" > > > #include > > > +#include > > > +#include > > > +#include > > > > It seems to me that should have beeen included in the > header (value.h): > > > > $ grep std::vector value.h > > std::vector > *val_chain, > > extern std::vector value_release_to_mark > > > > This looks like a pervasive thing in the gdb codebase. > > I just quickly grepped for '#include ' for files that have a > "std::vector" in the gdb codebase . > > > > There are 200+ files that use std::vector but do not include > i.e. they rely on a transitive include through other headers. > > > > Thanks, > > Manoj > > > Indeed, ideally every file would include what it uses. I don't know > about you, but I don't see that as a big problem though. The worst that > can happen is that you need to fix some includes when shuffling things. > I don't think that a file relying on a transitive include can lead to > some wrong behavior. > > I think the opposite is more annoying though, files including headers > they no longer need to. Let's say foo.c unnecessarily includes > breakpoint.h, then when changing breakpoint.h, foo.c will unnecessarily > get re-built. I sometimes run some files through include-what-you-use > [1] and remove the includes it tells me are unnecessary. > Unfortunately, it only works for main source files, it won't tell you > that foo.h unnecessarily includes bar.h. It might be possible to get it > to work by trying to compile foo.h as a main source file, but that's not > really possible in our context, with how things are done currently. > > I do agree that including unneeded headers is also annoying. In large projects like Chromium, headers bloat can significantly increase build times and is not easy to find out the extraneous ones. That said, iwyu is a great tool if it can be made to work. Simon > > [1] https://github.com/include-what-you-use/include-what-you-use >