From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 38ED21F85E for ; Thu, 12 Jul 2018 18:25:29 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=ZL98EqUxa0y/pi56 sIhkpmLWLQTXPPBMfQC4Q5tK5WwVcoSJA780yVyPh/e9xLxZgxK7aySBpMoFgPBI 9gCikSRJ7YHvP4UmHGUam5Go9mvAXvKOFhvmsSb6tn3OODXNwVyivYgMV23QGSKY MNpF1m11opcrFHMnQrTWE6lBnxg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=fxHYvFnZIuGTawskqbs+tn GyJKw=; b=kvtMyGC4AavDr2D0lRzTTdR5KxV78/EurjYcbUFoS1gGFZj5fb2ACT m+SGhmBG8vqjFaIxw9PUZB8RIhrswznoVKHn/6wJCcKfMJe0TvEPA8p7DGjbiP7m c208nmB7PeMMLLcSiZhrp76F9HRVdg48EkLlo7MrfCqIHhyBJCxfg= Received: (qmail 80376 invoked by alias); 12 Jul 2018 18:25:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 80018 invoked by uid 89); 12 Jul 2018 18:25:03 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.redhat.com Subject: Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions To: Adhemerval Zanella , libc-alpha@sourceware.org References: <1517591084-11347-1-git-send-email-adhemerval.zanella@linaro.org> <1517591084-11347-2-git-send-email-adhemerval.zanella@linaro.org> From: Florian Weimer Message-ID: <8c257a2d-60b4-e12d-28a5-d7a4fc4408de@redhat.com> Date: Thu, 12 Jul 2018 20:24:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 07/12/2018 07:52 PM, Adhemerval Zanella wrote: > > > On 12/07/2018 13:46, Florian Weimer wrote: >> On 02/02/2018 06:04 PM, Adhemerval Zanella wrote: >> >>> diff --git a/include/stdc-predef.h b/include/stdc-predef.h >>> index c569759..c2ab78a 100644 >>> --- a/include/stdc-predef.h >>> +++ b/include/stdc-predef.h >>> @@ -57,7 +57,4 @@ >>>      - 3 additional Zanabazar Square characters */ >>>   #define __STDC_ISO_10646__        201706L >>>   -/* We do not support C11 .  */ >>> -#define __STDC_NO_THREADS__        1 >> >> Should we do this only if we know that the compiler has _Thread_local support (based on a GCC and __cplusplus version check)? > > It seems reasonable, since its a installed header. Do we need to > check for __cplusplus too? Shouldn't __GNUC_PREREQ (4.9) be suffice? I think we can use __thread instead of _Thread_local with even older compilers, and also factor in __cplusplus if it is recent enough (essentially 2011 and later) for the !__GNUC__ case. Maybe it's sufficient to say #if !defined (__GNUC__) && !defined (__cpluscplus) \ && __cplusplus < 201103L) # define __STDC_NO_THREADS__ 1 #endif On the other hand, maybe your original change is right because in C11, _Thread_local support is not optional. Implementations are required to recognize the keyword (and presumably ignore it) even if they define __STDC_NO_THREADS__. And our will generally work fine even if the compiler does not actually support _Thread_local. So I'd say go with your original change. (But I do think you need to do something about thread_local in the C++ case, independently of this discussion.) Thanks, Florian