From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 4EE8E3854802 for ; Fri, 13 Nov 2020 22:52:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4EE8E3854802 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-swRgbcEmMt-M2xjR6SXqfQ-1; Fri, 13 Nov 2020 17:52:27 -0500 X-MC-Unique: swRgbcEmMt-M2xjR6SXqfQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70811801F9B; Fri, 13 Nov 2020 22:52:26 +0000 (UTC) Received: from localhost (unknown [10.33.36.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8AF75B4A3; Fri, 13 Nov 2020 22:52:25 +0000 (UTC) Date: Fri, 13 Nov 2020 22:52:25 +0000 From: Jonathan Wakely To: Jakub Jelinek Cc: Jason Merrill , Tom Tromey , Jakub Jelinek via Gcc-patches , John David Anglin Subject: Re: [PATCH] c++: Predefine __STDCPP_THREADS__ in the compiler if thread model is not single Message-ID: <20201113225225.GN503596@redhat.com> References: <20201113172945.GH3788@tucnak> <87k0up9i86.fsf@tromey.com> <20201113214659.GL3788@tucnak> MIME-Version: 1.0 In-Reply-To: <20201113214659.GL3788@tucnak> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 22:52:34 -0000 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 writes: >> > >> > Jakub> 2020-11-13 Jakub Jelinek >> > >> > 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