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.4 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 8C2B31F85E for ; Thu, 12 Jul 2018 19:19:47 +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=PgB16TGHhwrr4jP6 XtMQZZdf/KongIwEgmFK6KgAHrPR1s7PdZRKd+1DhWc//lKMdqCMkrMNOj6ICtN7 7ammGFUxX+D36cVNs7s16zqpmd/p1wOllg9ec6Ef4+c8J8zb9ZyNcfsRuLCDsVlY 8A154N5pu5m29ZkJFC0xnI05PRo= 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=n/sMvA06T7fUc9ql7FsKqt OsEMI=; b=fzrWAHuO9EVQzEHc7LjaeoJiZnG1+q/es30qX/HTpVFT0iXay77fWX /T9k3GXiX7OX1A0B4PFnmmK+uHx7Eia0v9OmNCY9l6XLFZoldrsJpjE5Ez9Voh4J P/P1rhaPidTVXnMIQmN3Qorgw8ypQ32DYDiNHB9iEMLgkBvwhpeq0= Received: (qmail 127880 invoked by alias); 12 Jul 2018 19:19:45 -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 127859 invoked by uid 89); 12 Jul 2018 19:19:44 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-vk0-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zDZIigT5cC4X0HTm1YWb5RDTDPu9/+D66gl0oBwOS0g=; b=Iq9FIWOhB2WW+KmzMLMTK5FpveiymsWnsQ0vRPzQs2e0FNBEk+7d3o9UI+L3hOarVE Q1eql0mwP9n+QQS3v+VU+qx1z0Qh4FMGAnT1UiVx7vEbHia0HJmTvURvaPhfStsD+FZ4 duoFmrbGBebvRa3G91Z9/TMnPpydfyoVM6C+E= Subject: Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions To: Florian Weimer , 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> <8c257a2d-60b4-e12d-28a5-d7a4fc4408de@redhat.com> From: Adhemerval Zanella Openpgp: preference=signencrypt Message-ID: <837df3e1-dbcf-ecc4-55ab-e89d7c447bba@linaro.org> Date: Thu, 12 Jul 2018 16:19:36 -0300 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: <8c257a2d-60b4-e12d-28a5-d7a4fc4408de@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/07/2018 15:24, Florian Weimer wrote: > 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.) Also on GCC BZ#53769 [1] Joseph wrote that check for __STDC_VERSION__ and/or __STDC_NO_THREADS__ is not meaningful to documented incomplete compiler support for language standard. This is at least for GCC standpoint, not sure about other compilers. We could add a check like: #if (defined (__GNUC__) && !__GNUC_PREREQ (4.9)) || (!defined (__cpluscplus) && __cplusplus < 201103L) # define __STDC_NO_THREADS__ 1 #endif [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769