This is an archive of the discontinued LLVM Phabricator instance.

Implement feature test macros using a script.
ClosedPublic

Authored by EricWF on Jan 15 2019, 3:34 PM.

Details

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.

Diff Detail

Repository
rCXX libc++

Event Timeline

EricWF created this revision.Jan 15 2019, 3:34 PM
jfb added a comment.Jan 15 2019, 3:36 PM

Are you missing generate_feature_test_macros_tests.py?

mclow.lists added inline comments.Jan 15 2019, 3:42 PM
test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
112

The constants should have 'L' suffixes. != 201210L

mclow.lists accepted this revision.Jan 15 2019, 4:33 PM

I am coming to like the idea that these tests should live in test/libcxx, not test/std, because they're all about libc++'s implementation status.
That being said, the tests are in test/std today, and this isn't an awful place for them.

We can move them later.

This revision is now accepted and ready to land.Jan 15 2019, 4:33 PM
EricWF updated this revision to Diff 181948.Jan 15 2019, 5:36 PM

Now with documentation!

EricWF updated this revision to Diff 181950.Jan 15 2019, 5:39 PM

Address inline comments about missing L suffix.

In D56750#1358905, @jfb wrote:

Are you missing generate_feature_test_macros_tests.py?

It should be generate_feature_test_macro_components.py in test/std/language.support/support.limits/support.limits.general

This revision was automatically updated to reflect the committed changes.
jfb added inline comments.Jan 15 2019, 9:23 PM
test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
823

Looks like the file gets its own name wrong :(

EricWF marked 3 inline comments as done.Jan 15 2019, 9:47 PM
EricWF added inline comments.
test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
823

Thanks. Should be fixed now.

This is nice! I do have a question: what is TEST_GCC_VER vs TEST_GCC_VER_NEW?