[cfe-dev] [libcxx] Which headers must include other headers?

Howard Hinnant via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 10 07:34:07 PST 2016


On Mar 10, 2016, at 9:02 AM, Craig, Ben via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> My motivation is that I'm running a conformance test suite on my platform (Hexagon + libcxx + libcxxabi + modified Dinkumware C library).  For the portion covering <system_error>, I get a lot of failures because the test suite tries to use / instantiate std::string, and it believes that it should be able to get the template definition transitively through <system_error>.
> 
> I like the compile time benefits of a forward string declaration, I just want to be sure it's conformant.  If not, I'm fine reporting the test as faulty.

This is a minor test suite bug.  <system_error> is not required to include <string>.

There are a few instances where the standard does require one header to include another. For example <utility> is required to include <initiailizer_list>.  When this is so, the synopsis of one header will have the required #include of the other header (in the standard).

There are a few places in the standard that appear to have a circular dependency among the headers.  Care must be taken in the implementation to not actually create a circular dependency.

Howard




More information about the cfe-dev mailing list