math.h included before __config
| Bugzilla Link | 36382 |
| Resolution | FIXED |
| Resolved on | Apr 30, 2018 07:29 |
| Version | unspecified |
| OS | All |
| CC | @hfinkel,@mclow,@pcc |
Extended Description
A recent change (https://reviews.llvm.org/rL323490) added support for the MS Windows platforms to include the C math.h header as the first thing in the C++ math.h. This creates a problem for C libraries that require some configuration to provide the correct functionality for libc++.
Such configuration could be done in __config before, but now there is no such place. Can we move __config to be included before the C math.h?
This has been resolved in r325760.
Including a C++ header file in a C library is trying to solve it the wrong way around. It would not work as the C math.h library can be used without a C++ library present.
I believe Marshall Clow's approach would solve it.
I have added a suggestion here https://reviews.llvm.org/rL323490
In general, every libc++ file should include <__config> as the first thing.
Couldn't you solve this problem by adding #include <__config> to your math.h header?