[PATCH] D42403: libcxx: Move #include_next <math.h> out of header guard in wrapper header.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 18:36:26 PST 2018


pcc created this revision.
pcc added reviewers: compnerd, smeenai, EricWF, mclow.lists.

Code on Windows expects to be able to do:

#define _USE_MATH_DEFINES
 #include <math.h>

and receive the definitions of mathematical constants, even if <math.h>
has previously been included. To support this scenario, re-include
<math.h> every time the wrapper header is included.


https://reviews.llvm.org/D42403

Files:
  libcxx/include/math.h


Index: libcxx/include/math.h
===================================================================
--- libcxx/include/math.h
+++ libcxx/include/math.h
@@ -8,6 +8,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include_next <math.h>
+
 #ifndef _LIBCPP_MATH_H
 #define _LIBCPP_MATH_H
 
@@ -298,8 +300,6 @@
 #pragma GCC system_header
 #endif
 
-#include_next <math.h>
-
 #ifdef __cplusplus
 
 // We support including .h headers inside 'extern "C"' contexts, so switch


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42403.130996.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180123/c893fb92/attachment.bin>


More information about the llvm-commits mailing list