[libcxx-dev] How to check for a feature-test macro

Louis Dionne via libcxx-dev libcxx-dev at lists.llvm.org
Tue Dec 11 07:57:09 PST 2018



> On Dec 10, 2018, at 20:14, Casey Carter <cacarter at microsoft.com> wrote:
> 
> I don't have context for the original issue, but our test selector does inspect some of the LIT control comments. Specifically, it skips tests with any of the comments:
> 
> // REQUIRES: c++11
> // REQUIRES: c++11 || c++14
> // REQUIRES: c++98 || c++03
> // REQUIRES: c++98 || c++03 || c++11 || c++14
> // UNSUPPORTED: c++14, c++17, c++2a
> 
> So if were talking about something that doesn't touch those, it won't affect our typical usage.
> 
> From: Stephan T. Lavavej
> Sent: Monday, December 10, 2018 15:43
> To: Jonathan Wakely; ldionne at apple.com
> Cc: Richard Smith; Marshall Clow; libcxx-dev at lists.llvm.org; Billy O'Neal (VC LIBS); Casey Carter
> Subject: RE: [libcxx-dev] How to check for a feature-test macro
>  
> (+Casey who also works on this)
> 
> When running libcxx's tests against MSVC's STL, we have an MSVC-internal skipped_tests.txt (full content available if requested) which says:
> 
> # *** MISSING STL FEATURES ***
> # C++20 P0122R7 "<span>"
> upstream\test\std\containers\views\types.pass.cpp
> [...]
> 
> # C++20 P0355R7 "<chrono> Calendars And Time Zones"
> upstream\test\std\utilities\time\days.pass.cpp
> [...]
> 
> Updating this requires minimal effort. It's more problematic when existing tests are modified to test new features, since we have to skip the entire test even if only a small part is affected.
> 
> Guarding tests with feature-test macros in their source code (as opposed to "the LIT level", which I believe is machinery that we don't use) would be ideal, I think.

Why do you not use `lit` to run the test suite?

As I understand it, MSVC would prefer disabling tests that are not supported using `#if !defined(<feature>)`. This can be made to work, but what I don't like is that it removes visibility into what tests are passing and which ones are not supported. Right now, we can easily tell how many tests are unsupported by an implementation because those are marked by LIT as `UNSUPPORTED`. If we start using feature test macros to disable tests, we lose that.

Louis

> 
> The annoying thing is when features are added without corresponding feature-test macros. There's a bunch of those right now. We'll probably need the skip-tests approach for those.
> 
> STL
> 
> -----Original Message-----
> From: Jonathan Wakely <cxx at kayari.org> 
> Sent: Monday, December 10, 2018 12:10 PM
> To: ldionne at apple.com
> Cc: Richard Smith <richard at metafoo.co.uk>; Marshall Clow <mclow.lists at gmail.com>; libcxx-dev at lists.llvm.org; Stephan T. Lavavej <stl at exchange.microsoft.com>; Billy O'Neal (VC LIBS) <bion at microsoft.com>
> Subject: Re: [libcxx-dev] How to check for a feature-test macro
> 
> On Mon, 10 Dec 2018 at 19:47, Louis Dionne wrote:
> > We should also see how other implementations that use our test suite feel about this (CCing them).
> 
> I only use your tests a few times a year, run by hand. If I get a load of FAILs because I've not implemented something yet and you have, that's not a problem. I don't expect to get 100% green when I run your tests.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20181211/7db8a447/attachment-0001.html>


More information about the libcxx-dev mailing list