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 0C9F23857804 for ; Fri, 23 Apr 2021 00:11:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0C9F23857804 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 4116F160178; Thu, 22 Apr 2021 17:11:41 -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 77o7qjYMXnVv; Thu, 22 Apr 2021 17:11:40 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7329816017A; Thu, 22 Apr 2021 17:11:40 -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 zZh2klFxBCCU; Thu, 22 Apr 2021 17:11:40 -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 20822160178; Thu, 22 Apr 2021 17:11:40 -0700 (PDT) To: Martin Sebor References: <2ec7fadb-cc15-a005-f708-d2adecc8cc39@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department Cc: GNU C Library Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714) Message-ID: <6c23d4f8-9c48-6bf6-ed13-a02ac66bc92b@cs.ucla.edu> Date: Thu, 22 Apr 2021 17:11:39 -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: <2ec7fadb-cc15-a005-f708-d2adecc8cc39@gmail.com> Content-Type: multipart/mixed; boundary="------------6D702493D8EB6B25092B0E9D" Content-Language: en-US X-Spam-Status: No, score=-9.8 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 00:11:44 -0000 This is a multi-part message in MIME format. --------------6D702493D8EB6B25092B0E9D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 4/22/21 2:30 PM, Martin Sebor via Libc-alpha wrote: > - __THROW; > + __THROW __attr_access_none (2); Instead of inventing a new __attr_access_none macro that developers will=20 need to remember, why not add support to the existing __attr_access=20 macro? That is, uses can look like this: __THROW __attr_access ((__none__, 2)); if we define __attr_access with something like the attached patch. Alternatively, one could keep both cdefs.h and the callers simple by=20 doing access attribute checking only for GCC 11 and later. That'd be=20 good enough in the long run. --------------6D702493D8EB6B25092B0E9D Content-Type: text/x-patch; charset=UTF-8; name="cdefs.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cdefs.diff" diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 8e244a77cf..db3283ec7f 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -586,15 +586,26 @@ _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) +# define __attr_access(x) __attr_access1 x +# define __attr_access1(access_mode, ...) \ + __attr_access##access_mode (__VA_ARGS__) +# define __attr_access__none__(...) +# define __attr_access__read_only__(...) \ + __attribute__ ((__access__ (__read_only__, __VA_ARGS__) +# define __attr_access__read_write__(...) \ + __attribute__ ((__access__ (__read_write__, __VA_ARGS__) +# define __attr_access__write_only__(...) \ + __attribute__ ((__access__ (__write_only__, __VA_ARGS__) #else -# define __attr_access(x) +# define __attr_access(x) #endif =20 /* Specify that a function such as setjmp or vfork may return --------------6D702493D8EB6B25092B0E9D--