On 13/11/20 22:46 +0100, Jakub Jelinek wrote:
On Fri, Nov 13, 2020 at 04:39:25PM -0500, Jason Merrill wrote:
On 11/13/20 2:20 PM, Tom Tromey wrote:
> > > > > > "Jakub" == Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> 
writes:
>
> Jakub> 2020-11-13  Jakub Jelinek  <ja...@redhat.com>
>
> Jakub>  * c-cppbuiltin.c: Include configargs.h.
> Jakub>  (c_cpp_builtins): For C++11 and later if THREAD_MODEL_SPEC is not
> Jakub>  defined, predefine __STDCPP_THREADS__ to 1 unless thread_model is
> Jakub>  "single".
>
> Note this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63287

Any opinions about the relative advantage of doing this in the compiler vs.
doing it in the library, as in Jonathan's patch in the PR?

If it is done in the library, it will be defined only if any of the library
headers are included.
The https://eel.is/c++draft/cpp.predefined wording doesn't look like it
would allow defining it only if certain headers are included
(unlike e.g. the __cpp_lib_* macros which have associated list of headers
that should define those).

Right, the standard says "The values of the predefined macros (except
for __FILE__ and __LINE__) remain constant throughout the translation
unit."

Libc++ defines it in the library, and I added a testcase showing why
that's non-conforming to https://bugs.llvm.org/show_bug.cgi?id=33230#c11

Reply via email to