[libcxx-commits] [PATCH] D96786: Including <ciso646> should result in an #error since C++17

Yuriy Chernyshov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 1 11:04:23 PST 2021


georgthegreat updated this revision to Diff 327193.
georgthegreat added a comment.

I have implemented similar patch in all headers mentioned in C++ working draft as reserved / removed.

`<cstdalign>` in not present in libc++ though marked as removed only in C++20.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96786/new/

https://reviews.llvm.org/D96786

Files:
  libcxx/include/ccomplex
  libcxx/include/ciso646
  libcxx/include/cstdbool
  libcxx/include/ctgmath


Index: libcxx/include/ctgmath
===================================================================
--- libcxx/include/ctgmath
+++ libcxx/include/ctgmath
@@ -21,6 +21,10 @@
 #include <ccomplex>
 #include <cmath>
 
+#if _LIBCPP_STD_VER > 17
+#error "C++20 removed the <ctgmath> header. Please, use <tgmath.h> instead"
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
Index: libcxx/include/cstdbool
===================================================================
--- libcxx/include/cstdbool
+++ libcxx/include/cstdbool
@@ -21,6 +21,10 @@
 
 #include <__config>
 
+#if _LIBCPP_STD_VER > 17
+#error "C++20 removed the <cstdbool> header. bool, true and false are provided as compiler builtins"
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
Index: libcxx/include/ciso646
===================================================================
--- libcxx/include/ciso646
+++ libcxx/include/ciso646
@@ -17,6 +17,10 @@
 
 #include <__config>
 
+#if _LIBCPP_STD_VER > 14
+#error "C++17 removed the <ciso646> header. If you are trying to detect the standard library, use <version> instead"
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
Index: libcxx/include/ccomplex
===================================================================
--- libcxx/include/ccomplex
+++ libcxx/include/ccomplex
@@ -19,6 +19,10 @@
 
 #include <complex>
 
+#if _LIBCPP_STD_VER > 17
+#error "C++20 removed the <ccomplex> header. Please, include <complex> or <complex.h> instead"
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96786.327193.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210301/cec5616f/attachment-0001.bin>


More information about the libcxx-commits mailing list