C++ Logo

sg15

Advanced search

Re: P2962R0: Communicating the "Baseline Compile Command" for C++ Modules support

From: Chuanqi Xu <chuanqi.xcq_at_[hidden]>
Date: Mon, 16 Oct 2023 10:56:56 +0800
Hi Daniel,
 Thanks for the paper. My instinct reaction to the paper is that it sounds better to rename `C++ Modules` to `Header Units` in the title (and other places). IIUC, the paper itself has nothing to do with named modules. So a narrower title may be helpful to understand.
 Then a question about the definition of `the baseline commnad` is:
> The Baseline Compile Command is a fragment of the compilation command that does not contain: 1) which file is being translated, 2) which outputs should be produced, and 3)any Local Preprocessor Arguments.
 My reaction to the line is: so we (the tools) don't need an explicit baseline compile command. It looks not hard to extract the `baseline command` from the actual command line.
 But laterly in the example of compilation commands:
> {
> “directory”: “/path/to/build/dir”,
> “file”: “/path/to/source/main_translation_unit.cpp”,
> “arguments”: [ “g++”, “-o” ,”main_translation_unit.o”,
> “-DFOO=1”, “-DBAR=2”, “-I/one/path”,
> “-I/other/path” ],
> “output”: “main_translation_unit.o”,
> “baseline-arguments”: [“g++”, “-DFOO=1”, “-I/one/path” ]
> }
 Here we can find `-DBAR=2` and `-I/other/path` is not presented in the `baseline-arguments`. Then I got confused about the definition of the baseline compile command. Also I am wondering how should the build systems to understand what `-D` and `-I` options should be put into the `baseline-arguments` and what shouldn't.
Thanks,
Chuanqi
Thanks,
Chuanqi
------------------------------------------------------------------
From:Daniel Ruoso (BLOOMBERG/ 919 3RD A) via SG15 <sg15_at_[hidden]>
Send Time:2023 Oct. 14 (Sat.) 01:42
To:sg15 <sg15_at_[hidden]>
Cc:Daniel Ruoso (BLOOMBERG/ 919 3RD A) <druoso_at_[hidden]>
Subject:[SG15] P2962R0: Communicating the "Baseline Compile Command" for C++ Modules support
Hello,
In the discussions in Varna, it became clear that build systems would need to communicate the "baseline compile command" to the tool that does the dependency scanning in order to correctly emulate the import.
At the same time, Static Analysis Tools that need to produce their own BMI for the code will also need to be able to assemble their own command for different modules.
So here's a paper describing the "baseline compile command" and also providing recommendations on how to communicate that across tooling in an interoperable way: https://wg21.link/P2962R0 <https://wg21.link/P2962R0 >
Daniel

Received on 2023-10-16 02:57:04