When we added support for the no-exceptions build of libc++, all the tests that used exceptions got a blanket XFAIL for the no-exceptions variety.
Previously, we tried to fix-up these tests with an elaborate setjmp/longjmp hackery (see D14653), which was rejected on the grounds of being too complicated / obtrusive.
The current patch is a representative fix that does the most obvious thing instead: use pre-processor macros to exclude just the bits of the test that use exceptions. Unlike in the previous patch, this means we are not trying to associate / verify a particular behaviour of the no-exceptions library with respect to exceptional situations (like calling abort). Here we simply save the parts of the test that has nothing to do with exceptions, I think this is a fair compromise.
We could also split the test file into two; one that uses exceptions and one that does not, though I can't think of any added benefits of that approach.
If this patch is approved I'll go ahead and update the rest of the tests (~150) to follow the same.
I prefer putting the #if on the inside of the function so you don't also have to #ifdef it out in main() below.