Subject: Re: [boost] questions regarding dependency reports(s)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-09-26 19:10:57
On Friday 26 September 2014 15:35:54 Robert Ramey wrote:
> What would it take to make a version of BCP which, given
> an arbitrary group of source files, returns a list of headers
> and *.cpp files which could be used to build the app?
The main problem with bcp and header-based dependency tracking in general is
dealing with preprocessor tricks which affect the inclusion graph. The cases
when a macro unfolds in the header name are not uncommon. Even more
complicated are cases when #include directives are conditioned on some tests
like compiler version or platform or macros defined in other headers.
You could collect dependencies that correspond to a particular environment
(e.g. the one you're currently running) but that wouldn't be a portable
distribution. I suppose, the more correct approach would be to build a
superposition of all possible condition results and preprocess each header in
every possible way, but that's beyond what a normal C++ preprocessor does and
I doubt this would be practical.
I think the most feasible way to do it is to preprocess headers multiple times
according to a number of pre-defined environment presets, each corresponding
to a platform Boost supports. It will still work rather slow, and defining
these presets would be a tough job, but at least this looks doable.