From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) by sourceware.org (Postfix) with ESMTPS id BA7823944837 for ; Fri, 23 Apr 2021 20:19:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BA7823944837 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eggert@cs.ucla.edu Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 01F1616010A; Fri, 23 Apr 2021 13:19:40 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ala-27UR8bVB; Fri, 23 Apr 2021 13:19:39 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 37084160186; Fri, 23 Apr 2021 13:19:39 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nKIBc8AxOKpE; Fri, 23 Apr 2021 13:19:39 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0ECA216010A; Fri, 23 Apr 2021 13:19:39 -0700 (PDT) To: Martin Sebor Cc: GNU C Library References: <2ec7fadb-cc15-a005-f708-d2adecc8cc39@gmail.com> <6c23d4f8-9c48-6bf6-ed13-a02ac66bc92b@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714) Message-ID: Date: Fri, 23 Apr 2021 13:19:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------AE92F130146EAEE6078C69A2" Content-Language: en-US X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 20:19:42 -0000 This is a multi-part message in MIME format. --------------AE92F130146EAEE6078C69A2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 4/23/21 8:24 AM, Martin Sebor wrote: >=20 > I think we considered variadic macros > when we first introduced the attribute but rejected it for some > reason that I'm not sure I remember.=C2=A0 Maybe because they're a C99 > feature and Glibc supports older compilers? That shouldn't be an issue here, since the suggested change uses=20 variadic macros for GCC 10 only. Unless people were worried about running something like 'gcc -ansi' or=20 'gcc -std=3Dc89? To head that off at the pass, we can do the GCC 10 stuff= =20 only if !__STRICT_ANSI__. Also, while we're at it we should be=20 C99-compatible in the variadic part (i.e., at least one named argument).=20 Something like the attached (untested) patch, say. --------------AE92F130146EAEE6078C69A2 Content-Type: text/x-patch; charset=UTF-8; name="cdefs-2.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cdefs-2.diff" diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 8e244a77cf..b3b5456efd 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -586,15 +586,23 @@ _Static_assert (0, "IEEE 128-bits long double requi= res redirection on this platf # define __HAVE_GENERIC_SELECTION 0 #endif =20 -#if __GNUC_PREREQ (10, 0) /* Designates a 1-based positional argument ref-index of pointer type that can be used to access size-index elements of the pointed-to array according to access mode, or at least one element when size-index is not provided: access (access-mode, [, ]) */ -#define __attr_access(x) __attribute__ ((__access__ x)) +#if __GNUC_PREREQ (11, 0) +# define __attr_access(x) __attribute__ ((__access__ x)) +#elif __GNUC_PREREQ (10, 0) && !defined __STRICT_ANSI__ +# define __attr_access(x) __attr_access1 x +# define __attr_access1(mode, ...) __attr_access##mode (mode, __VA_ARGS_= _) +# define __attr_access__none__(mode, ...) +# define __attr_access__read_only__(mode, ...) \ + __attribute__ ((__access__ (mode, __VA_ARGS__))) +# define __attr_access__read_write__ __attr_access__read_only__ +# define __attr_access__write_only__ __attr_access__read_only__ #else -# define __attr_access(x) +# define __attr_access(x) #endif =20 /* Specify that a function such as setjmp or vfork may return --------------AE92F130146EAEE6078C69A2--