brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 2c6f983 Raw
44 lines · plain
1===================2Feature Test Macros3===================4 5.. contents::6   :local:7 8Overview9========10 11Libc++ implements the C++ feature test macros as specified in the C++20 standard,12and before that in non-normative guiding documents13(`See cppreference <https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros>`_)14 15 16Design17======18 19Feature test macros are tricky to track, implement, test, and document correctly.20They must be available from a list of headers, they may have different values in21different dialects, and they may or may not be implemented by libc++. In order to22track all of these conditions correctly and easily, we want a Single Source of23Truth (SSoT) that defines each feature test macro, its values, the headers it24lives in, and whether or not is is implemented by libc++. From this SSoA we25have enough information to automatically generate the `<version>` header,26the tests, and the documentation.27 28Therefore we maintain a SSoA in `libcxx/utils/generate_feature_test_macro_components.py`29which doubles as a script to generate the following components:30 31* The `<version>` header.32* The version tests under `support.limits.general`.33* Documentation of libc++'s implementation of each macro.34 35Usage36=====37 38The `generate_feature_test_macro_components.py` script is used to track and39update feature test macros in libc++.40 41Whenever a feature test macro is added or changed, the table should be updated42and the script should be re-ran. The script will clobber the existing test files,43the documentation and the `<version>` header.44