On 5/25/12, Jonathan Wakely <jwakely....@gmail.com> wrote: > On 25 May 2012 21:26, Diego Novillo wrote: > > - Some files give syntax errors when compiled in isolation > > because they are missing symbols. for example, ext/algorithm > > needs __gnu_cxx::is_sorted. > > I'm not sure what this refers to (<ext/algorithm> either > defines __gnu_cxx::is_sorted or has a using declaration for > std::is_sorted in C++11 mode) but I'm very much in favour of > anything that moves towards support for modules, so if there's > anything libstdc++-related I can do to help please let me know.
The main thing you can do is try to make sure that all headers are independently compilable. If that isn't possible, then those headers that cannot be independently compilable should be identified and/or segregated. As an example, there is on header that expect a type parameter in a preprocessor symbol. That header is included several times with different #defines ahead of it. Clearly that structure is there to reduce the redundancy in the headers. However, it's not friendly to interpreting the headers as modules. There are two techniques that are friendlier. First, define a macro that produces the declarations. Second, have an external script generate the headers. The redundancy will appear in the user-facing headers, but not in the sources programmed. The second thing you can do is minimize the number of behaviors that depend on command-line arguments. These bloat the number of compiled forms of any given header. -- Lawrence Crowl