public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714)
Date: Fri, 23 Apr 2021 09:24:48 -0600	[thread overview]
Message-ID: <a72cdbc6-7ed9-4448-259a-d8df2944d46e@gmail.com> (raw)
In-Reply-To: <6c23d4f8-9c48-6bf6-ed13-a02ac66bc92b@cs.ucla.edu>

On 4/22/21 6:11 PM, Paul Eggert wrote:
> 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 
> need to remember, why not add support to the existing __attr_access 
> macro? That is, uses can look like this:
> 
>       __THROW __attr_access ((__none__, 2));
> 
> if we define __attr_access with something like the attached patch.

I don't have a preference for how to define the macro.  I went with
a new one because Joseph suggested that approach in hist comments
on the mismatched allocation patch (for the __attr_dealloc macros).
The other approach I considered was using the __attr_access macro
but guarding it for GCC 11 in situ.  Since functions like
pthread_setspecific are exceeingly rare, I don't expect the new
attribute to be used very much at all (if you do know of other
such functions, though, please let me know so I can annotate them
as well).

As for your suggested change. 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.  Maybe because they're a C99
feature and Glibc supports older compilers?

If this isn't the case and others share your preference for this
approach I don't mind changing it.

> 
> Alternatively, one could keep both cdefs.h and the callers simple by 
> doing access attribute checking only for GCC 11 and later. That'd be 
> good enough in the long run.

I'd view disabling the checking with older GCC releases as a QoI
regression, so I'm not in favor of this alternative.

Martin

  reply	other threads:[~2021-04-23 15:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 21:30 Martin Sebor
2021-04-22 22:26 ` Martin Sebor
2021-04-23  0:11 ` Paul Eggert
2021-04-23 15:24   ` Martin Sebor [this message]
2021-04-23 20:19     ` Paul Eggert
2021-04-23 21:29       ` Martin Sebor
2021-04-24  0:27         ` Paul Eggert
2021-04-26 19:38           ` Martin Sebor
2021-04-27  4:41 ` Florian Weimer
2021-04-27 19:07   ` Martin Sebor
2021-04-27 21:07     ` Joseph Myers
2021-04-27 21:46       ` Martin Sebor
2021-04-27 21:58         ` Joseph Myers
2021-04-27 22:57           ` Martin Sebor
2021-04-28  1:09             ` Martin Sebor
2021-04-28  7:32               ` Florian Weimer
2021-04-28 14:49                 ` Martin Sebor
2021-04-29  7:45                   ` Florian Weimer
2021-04-29 14:55                     ` Martin Sebor
2021-04-29 16:16                       ` Florian Weimer
2021-04-28  1:30             ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a72cdbc6-7ed9-4448-259a-d8df2944d46e@gmail.com \
    --to=msebor@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).