This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Replace __cplusplus comparisons with TEST_STD_VER and __has_feature with TEST_HAS_FEATURE.
ClosedPublic

Authored by STL_MSFT on Jun 7 2016, 12:38 PM.

Details

Summary

Replace cplusplus comparisons with TEST_STD_VER and has_feature with TEST_HAS_FEATURE.

These replacements were performed by a script. Additional changes performed manually:

Include test_macros.h when it's needed and we weren't already dragging it in.

Manually update test/support/count_new.hpp to use TEST_HAS_FEATURE.

In test/support/test_macros.h, allow TEST_STD_VER to be overridden. (I'm doing this through a force-included header in my test harness. This change to test_macros.h is necessary because I can't modify __cplusplus itself.)

Diff Detail

Event Timeline

STL_MSFT updated this revision to Diff 59937.Jun 7 2016, 12:38 PM
STL_MSFT retitled this revision from to [libcxx] [test] Replace __cplusplus comparisons with TEST_STD_VER and __has_feature with TEST_HAS_FEATURE..
STL_MSFT updated this object.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.
EricWF edited edge metadata.Jun 13 2016, 8:15 PM

Please change the TEST_HAS_FEATURE(XXX) into TEST_STD_VER >= 11 for the following C++11 features:

  • cxx_noexcept
  • cxx_atomic
  • cxx_access_control_sfinae

Also if the entire test is wrapped in a TEST_HAS_FEATURE(XXX) please translate that into a // UNSUPPORTED: c++98, c++03 comment at the top of the file.

[Eric Fiselier]

Please change the TEST_HAS_FEATURE(XXX) into TEST_STD_VER >= 11 for the following C++11 features:

  • cxx_noexcept
  • cxx_atomic
  • cxx_access_control_sfinae

Also if the entire test is wrapped in a TEST_HAS_FEATURE(XXX) please
translate that into a // UNSUPPORTED: c++98, c++03 comment at the top of the file.

Sure. Would you like cxx_attributes and/or cxx_strong_enums to receive the same treatment?

STL

[Eric Fiselier]

Please change the TEST_HAS_FEATURE(XXX) into TEST_STD_VER >= 11 for the following C++11 features:

  • cxx_noexcept
  • cxx_atomic
  • cxx_access_control_sfinae

Also if the entire test is wrapped in a TEST_HAS_FEATURE(XXX) please
translate that into a // UNSUPPORTED: c++98, c++03 comment at the top of the file.

Sure. Would you like cxx_attributes and/or cxx_strong_enums to receive the same treatment?

Yeah, cxx_strong_enums and cxx_attributes can be changed as well. I wasn't on top of it last night apparently.

Thank you for this patch. I know it's huge but it's also a huge improvement.

STL

STL_MSFT updated this revision to Diff 60738.Jun 14 2016, 1:51 PM
STL_MSFT edited edge metadata.

As requested, inspect TEST_STD_VER instead of the features cxx_access_control_sfinae, cxx_atomic, cxx_attributes, cxx_noexcept, and cxx_strong_enums. (Replaced by a script.) Additionally as requested, switch to UNSUPPORTED comments instead of guarding the whole body of main. (Replaced by hand.)

EricWF accepted this revision.Jun 14 2016, 2:22 PM
EricWF edited edge metadata.

Thank you! I'll commit once my test-suite with -Wundef finishes.

This revision is now accepted and ready to land.Jun 14 2016, 2:22 PM
EricWF closed this revision.Jun 14 2016, 2:41 PM

Only 4 missing #include "test_macros.h", and I'm sure all of them were my fault.

Committed as r272716.

Thanks again. I owe you a case of your preferred caffeine fix.