This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Mark atomic tests UNSUPPORTED for c++03 and c++98.
AbandonedPublic

Authored by EricWF on Oct 23 2014, 8:14 PM.

Details

Summary

clang doesn't provide the atomic intrinsics in C++03 and lower so even including atomic leads to a compile error. This header is strictly not supported in c++03.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 15375.Oct 23 2014, 8:14 PM
EricWF retitled this revision from to [libcxx] Mark atomic tests UNSUPPORTED for c++03 and c++98..
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: mclow.lists, danalbert, jroelofs.
EricWF added a subscriber: Unknown Object (MLST).
danalbert accepted this revision.Oct 23 2014, 8:16 PM
danalbert edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 23 2014, 8:16 PM
danalbert requested changes to this revision.Oct 23 2014, 8:18 PM
danalbert edited edge metadata.

Actually, on second thought, shouldn't these be XFAIL? Do we care about ensuring that you can't use <atomic> for < C++11?

This revision now requires changes to proceed.Oct 23 2014, 8:18 PM

Are you saying that if we plan to support <atomic> in C++03 we should mark them as XFAIL? I don't think <atomic> will ever be supported below c++11, hence the use of <atomic> in c++03 is "unsupported".

Let me know if I didn't understand anything.

I'm saying we might want to verify that these do in fact fail. UNSUPPORTED
causes the test to not be run, XFAIL tests to ensure failure, which is
possibly what we want here. OTOH, our test configuration isn't set up to do
conditional _compile time_ failures, so maybe we should just settle for
UNSUPPORTED.

I'm saying we might want to verify that these do in fact fail. UNSUPPORTED
causes the test to not be run, XFAIL tests to ensure failure, which is
possibly what we want here.
OTOH, our test configuration isn't set up to do
conditional _compile time_ failures, so maybe we should just settle for UNSUPPORTED.

Your right. That's probably a good idea. <atomic> is unique in that it actually explicitly errors when it is included but won't work.
.fail.cpp tests are expected to fail at compile time. I think we should do is leave these tests as unsupported and add a cxx03.fail.cpp test
that ensures including <atomic> results in a compiler failures.

Here's my gripe. I like the separation between

  1. XFAIL - tests that should be fixed.
  2. UNSUPPORTED - tests I don't care about at all.

It makes it a lot easier to watch just the tests I care about. Adding one XFAIL test seems a touch cleaner, and will guarantee the same thing.

EricWF updated this revision to Diff 15379.Oct 23 2014, 9:37 PM
EricWF edited edge metadata.

Added two tests to ensure that <atomic> doesn't compile when one of the following is true:

  1. __cplusplus < 201103L
  2. _LIBCPP_HAS_NO_THREADS is defined.

The added tests are:

  • /test/atomics/c++11-only.fail.cpp
  • /test/atomics/libcpp-no-threads.fail.cpp
EricWF abandoned this revision.Oct 27 2014, 1:56 PM

It seems like it might be possible to get these tests working in C++03 mode under clang. Abandoning this so we can try and get them working instead.

jroelofs added inline comments.Oct 27 2014, 2:08 PM
test/atomics/libcpp-no-threads.fail.cpp
1

test/atomics/libcpp-no-threads.fail.cpp looks useful to me as a separate change, though we probably ought to think about how to support fail tests that are conditional on platform specifics (which is what this test really ought to be).

I think the way forward on that would be to add support for support for implicit "XFAIL: *" in *.fail.cpp tests when an XFAIL line isn't specified. Then the afformentioned test should have an "XFAIL: libcpp-has-no-threads".

Something to discus at the cross testing BOF, I suppose....