Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D10C433EF for ; Fri, 19 Nov 2021 16:27:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CE2661B1E for ; Fri, 19 Nov 2021 16:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236460AbhKSQaj (ORCPT ); Fri, 19 Nov 2021 11:30:39 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:46661 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbhKSQai (ORCPT ); Fri, 19 Nov 2021 11:30:38 -0500 Received: from mail-wm1-f43.google.com ([209.85.128.43]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MOAmt-1n39g730tV-00OXVm; Fri, 19 Nov 2021 17:27:34 +0100 Received: by mail-wm1-f43.google.com with SMTP id c71-20020a1c9a4a000000b0032cdcc8cbafso7922477wme.3; Fri, 19 Nov 2021 08:27:34 -0800 (PST) X-Gm-Message-State: AOAM533P80MPamrpRG5ICwckOx5oi49rNDBjA3YDxc3fGHoEwrTgJNyc P0GZ8xQ7hihRqJydWxdBP6upGaoDkrDb7E1jIeg= X-Google-Smtp-Source: ABdhPJw9pjl15kxNckhoztOwSEHm2BAFAg53rxD/nLG+Vq3q5u2bghokZvEuTw1FbjRLUctINZWvpCeY9JlD3tiwY20= X-Received: by 2002:a1c:2382:: with SMTP id j124mr1036531wmj.35.1637339254218; Fri, 19 Nov 2021 08:27:34 -0800 (PST) MIME-Version: 1.0 References: <20211119113644.1600-1-alx.manpages@gmail.com> <434296d3-8fe1-f1d2-ee9d-ea25d6c4e43e@gmail.com> <2d790206-124b-f850-895f-a57a74c55f79@gmail.com> In-Reply-To: <2d790206-124b-f850-895f-a57a74c55f79@gmail.com> From: Arnd Bergmann Date: Fri, 19 Nov 2021 17:27:17 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code To: "Alejandro Colomar (man-pages)" Cc: Arnd Bergmann , Andy Shevchenko , LKML , Ajit Khaparde , Andrew Morton , Bjorn Andersson , Borislav Petkov , Corey Minyard , Chris Mason , Christian Brauner , David Sterba , Jani Nikula , Jason Wang , Jitendra Bhivare , John Hubbard , "John S . Gruber" , Jonathan Cameron , Joonas Lahtinen , Josef Bacik , Kees Cook , Ketan Mukadam , Len Brown , "Michael S. Tsirkin" , Miguel Ojeda , Mike Rapoport , Nick Desaulniers , "Rafael J. Wysocki" , Rasmus Villemoes , Rodrigo Vivi , Russell King , Somnath Kotur , Sriharsha Basavapatna , Subbu Seetharaman , Intel Graphics , ACPI Devel Maling List , Linux ARM , linux-btrfs , linux-scsi , Networking , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:WnwNnQls7mfdin+Yp4JuTfdBk9FL8BMP42ZEZdFoDyMySz32xsc s+UnEAeP/43vAmvHlAAgpYkVx8608SzoPK+4TAkus8YolAMhWxzN2Z7r6UvgT3CrJ2guZeL IGYQC1COwgRgAxqBJFM1O3mlltJDxttlN4Z3DufHVIlIOtVJctGNYpZIJkou8YxTB32Zw+2 fg9AIJ80yUX3AEssiybyg== X-UI-Out-Filterresults: notjunk:1;V03:K0:5H6za9UVbdo=:RnBcymBwS3Z0v259rLRDiL uZaP3KG9mJQ5elYe/xWaPVVh+qX3k8inTUc7mji5iKcSPPyLRFu9d9DZtwuDF9NUft0G4ytWb 9zrolj+Co/ceB1IS8giEQPZuLKPKR8s7vfCnkpXS9Gd2pm4ZlyNo4Me7E6ub28hXqSH2kCk+Q TmVolFeTk+TI/rCV3Vm0mMl8/bN8fxvqglW7HZi/M3iGoBmL7nGpn7ffsAoY74alRUfXZnCJQ MWR/Eat/EXRVWwpwO8zmIBLpoxXGkN1qGuYk4SEVJmlOl0qUvYSlzLwFzHyoXQ3/IsZG4Mtuh 3CtM6LVHiP2d+Z8ynGo0KC46YGIBPZDQRLQmij4Wgvh+4mRxq8m4vYfbxfdbnVAXa9B1pn/aI 9pJ/3KIKOw0UdncGzKoGgCTLZXcXn7DPCxEZLgPoyuPF3ww7eQerEjiY/JmBatboJecdV1JKH R9S45hh0rrI6EzTC1oZaUP70mrgc/UNVwXJjE60niOB1eRzgRRGa7OoP+MdptuANJ4BdqUKAM RgMvyH1bXIJdGMKqqeRD72dssa79Nbh4JewnScIsCKLUN++ObuPCOAk3odr3q3l4EFz4UDTPc PfM7ivBVCqj09TFeNOCOnq03/6CDzt4qnyK1r4a1Rz1uCIarP7h1oxTL3PAnJKTosonpNp3ez 8B+/9YAJMjqqiX7beWp3FgmKt3axNnd+xvIiJB2zq4LJJhUretz3I2DZiQayu0hAjpw2wBERO tx9Zns+UyjZWPmWmQ/uMJFShTxp0oNdgGi4mcmNfH3z1D3RrnYTRHhEr7IKox0iIpzpvkcE+Q 8onXCEmOuAApBUdoDJKEeOvbEkpuyWp/x2UQoeT3yfKnu4ZTX0= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 19, 2021 at 5:22 PM Alejandro Colomar (man-pages) wrote: > On 11/19/21 17:18, Arnd Bergmann wrote: > > On Fri, Nov 19, 2021 at 5:10 PM Andy Shevchenko > > wrote: > >> On Fri, Nov 19, 2021 at 04:57:46PM +0100, Arnd Bergmann wrote: > > > >>> The main problem with this approach is that as soon as you start > >>> actually reducing the unneeded indirect includes, you end up with > >>> countless .c files that no longer build because they are missing a > >>> direct include for something that was always included somewhere > >>> deep underneath, so I needed a second set of scripts to add > >>> direct includes to every .c file. > >> > >> Can't it be done with cocci support? > > > > There are many ways of doing it, but they all tend to suffer from the > > problem of identifying which headers are actually needed based on > > the contents of a file, and also figuring out where to put the extra > > #include if there are complex #ifdefs. > > > > For reference, see below for the naive pattern matching I tried. > > This is obviously incomplete and partially wrong. > > FYI, if you may not know the tool, > theres include-what-you-use(1) (a.k.a. iwyu(1))[1], > although it is still not mature, > and I'm helping improve it a bit. Yes, I know that one, I tried using it as well, but it did not really scale to the size of the kernel as it requires having all files to use the correct set of #include, and to know about all the definitions. Arnd