On Fri, Jun 18, 2021 at 11:21 AM Daniel Ruoso <daniel@ruoso.com> wrote:
On Fri, Jun 18, 2021 at 2:01 PM Gabriel Dos Reis <gdr@microsoft.com> wrote:
  • but you cannot discover the graph with a simple lexer 

Yes, and I have not found that to be an actual problem in practice.  In fact there is really nothing new here

You are right that when you look at the translation units you're trying to build, nothing changes. And, to be clear, I'm not trying to change the language to preclude the use of macros in the source files themselves.

What I'm advocating for is that when you have a pre-built artifact, having to re-run that preprocessor for the module interface files at best is repeating work that was already done when the library was built, at worst may introduce an ODR violation. The requirement that I'm presenting is scoped for when you're consuming modules outside of the current build.

Oh, sorry, that sounds a bit different again from what I thought we were discussing - I could see that being useful, but owing to the BMIs being non-portable, I'd not be in favor of some standardized file format for discovering that. A standardized entry point to the compiler to query a BMI for its dependency information sounds OK though (again, consistency between Clang and GCC and anyone else who's making a GCC-like/compatible command line interface).

Though, generally, since BMIs generally won't be/can't be distributed it seems of limited value - whatever system built the BMI would be the same system using it later & probably would remember in its own way what the dependencies were.