summaryrefslogtreecommitdiffstats
path: root/libcxx/docs/DesignDocs
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-01-16 01:37:43 +0000
committerEric Fiselier <eric@efcs.ca>2019-01-16 01:37:43 +0000
commit32784a740a0282dc6f4390b683ed6c6516f4d66c (patch)
tree04747397f1cf0d73d679572ce709ab61df6776da /libcxx/docs/DesignDocs
parent56c587adfd2999a5f096cf49266552de931aa1e3 (diff)
downloadbcm5719-llvm-32784a740a0282dc6f4390b683ed6c6516f4d66c.tar.gz
bcm5719-llvm-32784a740a0282dc6f4390b683ed6c6516f4d66c.zip
Implement feature test macros using a script.
Summary: This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a. The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++. When a new feature test macro is added or needed, the table should be updated and the script re-run. Reviewers: mclow.lists, jfb, serge-sans-paille Reviewed By: mclow.lists Subscribers: arphaman, jfb, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D56750 llvm-svn: 351286
Diffstat (limited to 'libcxx/docs/DesignDocs')
-rw-r--r--libcxx/docs/DesignDocs/FeatureTestMacros.rst44
1 files changed, 44 insertions, 0 deletions
diff --git a/libcxx/docs/DesignDocs/FeatureTestMacros.rst b/libcxx/docs/DesignDocs/FeatureTestMacros.rst
new file mode 100644
index 00000000000..d55af96c674
--- /dev/null
+++ b/libcxx/docs/DesignDocs/FeatureTestMacros.rst
@@ -0,0 +1,44 @@
+===================
+Feature Test Macros
+===================
+
+.. contents::
+ :local:
+
+Overview
+========
+
+Libc++ implements the C++ feature test macros as specified in the C++2a standard,
+and before that in non-normative guiding documents (`See cppreference <https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros>`)
+
+Design
+======
+
+Feature test macros are tricky to track, implement, test, and document correctly.
+They must be available from a list of headers, they may have different values in
+different dialects, and they may or may not be implemented by libc++. In order to
+track all of these conditions correctly and easily, we want a Single Source of
+Truth (SSoT) that defines each feature test macro, its values, the headers it
+lives in, and whether or not is is implemented by libc++. From this SSoA we
+have enough information to automatically generate the `<version>` header,
+the tests, and the documentation.
+
+Therefore we maintain a SSoA in
+`libcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py`
+which doubles as a script to generate the following components:
+
+* The `<version>` header.
+* The version tests under `support.limits.general`.
+* Documentation of libc++'s implementation of each macro.
+
+Usage
+=====
+
+The `generate_feature_test_macro_components.py` script is used to track and
+update feature test macros in libc++.
+
+Whenever a feature test macro is added or changed, the table should be updated
+and the script should be re-ran. The script will clobber the existing test files
+and the documentation and it will generate a new `<version>` header as a
+temporary file. The generated `<version>` header should be merged with the
+existing one. \ No newline at end of file
OpenPOWER on IntegriCloud