From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 85F9A3858D1E for ; Thu, 24 Feb 2022 23:46:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 85F9A3858D1E Received: by mail-qt1-x82a.google.com with SMTP id bc10so1023885qtb.5 for ; Thu, 24 Feb 2022 15:46:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=mppQZD/uhlRqOFbqHmGrxtvcsyv8f5fSBSxlmqfxog8=; b=4Yv1LmW3f1msg+XcqCkBwmgy13qWKN5XAPNYOf7jPVTjxY2aCyKmXfZJM9FpdyPhUX LcGkgZ2m1ypEqoxZSwV6SzhmKNuzdQ6+UcjLnPiazMiXcYjGDrtTsZdvKNFULt4AQSlD mDh+iR4HGLPLhzPr8GddRHE+Dqpdir6qLIDTITKmiRYk4bn+9Kr15Cjr7LCxuL8JYh/O J0ytU3YgHr+gB91Ac4mtp7l8SOrroETJVWdZCWridibgmzMFfCLZUasnqsVIecyz18if q38GDDhnTp8veA17C7QyPAftt+J5Ix/Xha88VXlev2VwG0P9R9E2UaAVziKnIshPGU86 lA9g== X-Gm-Message-State: AOAM530MMXGw7inEz0vgVhE5RQFFBIr5lWpknEKgmC8RlFs9R4zdrRpi j60A662vgPcj749pAmHHM9ykFgGlfx4OGgfg X-Google-Smtp-Source: ABdhPJyGyeL/vUn0bAAieWdY/PWUspyX1OzNBwznIQlsnm4MnJ1EvQUsEdLchEh5n5DkE7H3YZyupQ== X-Received: by 2002:a05:622a:c5:b0:2de:a2fa:d165 with SMTP id p5-20020a05622a00c500b002dea2fad165mr3878742qtw.194.1645746361102; Thu, 24 Feb 2022 15:46:01 -0800 (PST) Received: from localhost (cpe-142-105-146-128.nycap.res.rr.com. [142.105.146.128]) by smtp.gmail.com with ESMTPSA id v13-20020ac8578d000000b002de94b94741sm513980qta.22.2022.02.24.15.46.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 15:46:00 -0800 (PST) Date: Thu, 24 Feb 2022 18:46:30 -0500 From: Ben Boeckel To: gcc@gcc.gnu.org Subject: [modules] Preprocessing requires compiled header unit modules Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/2.0.7 (2021-05-04) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2022 23:46:04 -0000 Hi, I'm looking to update my patch which implements P1689[1] for GCC. I originally wrote this back in February 2019 at Kona for a proof of concept[2], but never really got the time to delve back in until now. I'd like to get header units implemented prior to submitting it as it will be an important part in the long run (as I don't think having a partial implementation in the wild would be beneficial). Now that modules have been merged, my patch works just fine for named modules. However, for header unit modules, it runs into a problem that imported header units are required to be compiled and available in the mapper while scanning for dependencies. Example code: ```c++ # use-header.cpp module; import "header-unit.hpp"; int main(int argc, char* argv[]) { return good; } ``` ```c++ # header-unit.hpp constexpr int good = 0; ``` When trying to preprocess this: ```console % g++ -std=c++20 -fmodules-ts -E use-header.cpp -o use-header.cpp.i In module imported at use-header.cpp:3:1: ./header-unit.hpp: error: failed to read compiled module: No such file or directory ./header-unit.hpp: note: compiled module file is ‘gcm.cache/,/header-unit.hpp.gcm’ ./header-unit.hpp: note: imports must be built before being imported ./header-unit.hpp: fatal error: returning to the gate for a mechanical issue compilation terminated ``` There used to be no need to do this back prior to the modules landing in `master`, but I can see this being an oversight in the meantime. I am not familiar enough with the code to know how to untangle its current state (attempting to bisect the change throws me back in to the depths of the history without modules so "does it work" is unanswerable there). I tried this on commits: 4efde6781bba8d64b9dcff07e7efe71d35aa6f6a c++: Modules Is Landing f4ed267fa5b82d6dafbc8afc82baf45bfcae549c master as of the 23rd Thanks, --Ben [1] https://wg21.link/p1689r4 [2] https://github.com/mathstuf/cxx-modules-sandbox/ (see the `docker` branch for the instructions on putting things together)