[PATCH] D36713: [libc++] Add a persistent way to disable availability

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 14:29:44 PDT 2017


smeenai created this revision.
Herald added a subscriber: mgorny.

Add _LIBCPP_DISABLE_AVAILABILITY to the site config options, and add a
cmake option LIBCXX_DISABLE_AVAILABILITY to control the site config.
This is similar to other options which influence headers and therefore
shold have some way to be set persistently.


https://reviews.llvm.org/D36713

Files:
  CMakeLists.txt
  docs/UsingLibcxx.rst
  include/__config_site.in
  utils/libcxx/test/config.py


Index: utils/libcxx/test/config.py
===================================================================
--- utils/libcxx/test/config.py
+++ utils/libcxx/test/config.py
@@ -652,6 +652,10 @@
                 if feature_macros[m]:
                     define += '=%s' % (feature_macros[m])
                 self.cxx.compile_flags += [define]
+            if m == '_LIBCPP_DISABLE_AVAILABILITY':
+                assert not self.with_availability, \
+                    'Availability is disabled in the site configuration'
+                continue
             if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS':
                 continue
             if m == '_LIBCPP_ABI_VERSION':
Index: include/__config_site.in
===================================================================
--- include/__config_site.in
+++ include/__config_site.in
@@ -22,6 +22,7 @@
 #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
 #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
 #cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
+#cmakedefine _LIBCPP_DISABLE_AVAILABILITY
 #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
 
 #endif // _LIBCPP_CONFIG_SITE
Index: docs/UsingLibcxx.rst
===================================================================
--- docs/UsingLibcxx.rst
+++ docs/UsingLibcxx.rst
@@ -185,6 +185,9 @@
     * Giving `set`, `map`, `multiset`, `multimap` a comparator which is not
       const callable.
 
+**LIBCXX_DISABLE_AVAILABILITY**:
+  This macro disables availability annotations in the libc++ headers.
+
 C++17 Specific Configuration Macros
 -----------------------------------
 **_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES**:
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -606,6 +606,7 @@
 config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL)
 config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
 config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
+config_define_if(LIBCXX_DISABLE_AVAILABILITY _LIBCPP_DISABLE_AVAILABILITY)
 
 # By default libc++ on Windows expects to use a shared library, which requires
 # the headers to use DLL import/export semantics. However when building a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36713.111076.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170814/6745c09a/attachment.bin>


More information about the cfe-commits mailing list