<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 6, 2019 at 4:01 PM Nathan Sidwell <<a href="mailto:nathan@acm.org">nathan@acm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 3/6/19 3:01 PM, Mathias Stearn wrote:<br>
> <br>
> <br>
> On Wed, Mar 6, 2019 at 10:18 AM Nathan Sidwell <<a href="mailto:nathan@acm.org" target="_blank">nathan@acm.org</a> <br>
> <mailto:<a href="mailto:nathan@acm.org" target="_blank">nathan@acm.org</a>>> wrote:<br>
> <br>
> Yes, a BMI is required for a header import. Textually including the<br>
> header import's original header file is not equivalent.<br>
> <br>
> <br>
> It won't be required for the scan stage will it? If it is, there is a <br>
> bootstrapping problem because there is no good way to figure out which <br>
> order to build the header-unit BMIs in if they import other <br>
> header-units. I've been assuming that the scan stage will be able to <br>
> just temporarily mask off the defines and replace them with the correct <br>
> ones for the header-unit while scanning a file, so that scanning has no <br>
> generated dependencies.<br>
<br>
As header units export #defines, which can go on to determine the path <br>
of conditional inclusion, you have to decide:<br>
<br>
a) if you want precise scanning, you need the header units at scan time<br>
<br>
b) if you're ok with imprecise scanning (getting false positives). But <br>
you need something other than the C++ preprocessor<br></blockquote><div><br></div><div>If in addition to being told which headers are importable, the scanner/preprocessor is also told what flags are used for each of those headers, how hard would it be to just resolve it precisely internally? I assume it could be done by something like push_macroing all current macros, figuring out which builtin macros to use for the header unit, then when you are done processing that header merge the pushed macros with the current macros using the rules for modules. Is that infeasably hard or not work for some reason?</div></div></div>