llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

math.h included before __config

Open cddouma-arm opened this issue 8 years ago • 5 comments

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?

cddouma-arm avatar Feb 14 '18 15:02 cddouma-arm

This has been resolved in r325760.

mclow avatar Apr 30 '18 14:04 mclow

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.

cddouma-arm avatar Feb 15 '18 10:02 cddouma-arm

I have added a suggestion here https://reviews.llvm.org/rL323490

mclow avatar Feb 14 '18 22:02 mclow

In general, every libc++ file should include <__config> as the first thing.

mclow avatar Feb 14 '18 19:02 mclow

Couldn't you solve this problem by adding #include <__config> to your math.h header?

pcc avatar Feb 14 '18 19:02 pcc