public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Jeff Law <law@redhat.com>, Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] handle expressions in __builtin_has_attribute (PR 88383)
Date: Thu, 13 Dec 2018 19:56:00 -0000	[thread overview]
Message-ID: <20181213195651.GZ12380@tucnak> (raw)
In-Reply-To: <688c62e2-966a-c950-ca63-b58003610c62@gmail.com>

On Thu, Dec 13, 2018 at 12:48:18PM -0700, Martin Sebor wrote:
> > The support is necessary in order to determine the attributes
> > in expressions such as:
> > 
> >    struct S { __attribute__ ((packed)) int a[32]; };
> > 
> >    extern struct S s;
> > 
> >    _Static_assert (__builtin_has_attribute (s.a, packed));
> 
> An example involving types might be a better one:
> 
>   typedef __attribute__ ((may_alias)) int* BadInt;
> 
>   void f (BadInt *p)
>   {
>     _Static_assert (__builtin_has_attribute (*p, may_alias));
>   }

So how is the builtin defined then?  Is the argument always an expression
and you only return whether its type has the attribute, or do something
different if the expression is of certain kind?
Perhaps it would be better have two builtins, one would always take
type from the expression, the other would only accept decls (or perhaps
some syntax for the FIELD_DECLs).

	Jakub

  reply	other threads:[~2018-12-13 19:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  3:56 Martin Sebor
2018-12-13 18:59 ` Jeff Law
2018-12-13 19:21   ` Martin Sebor
2018-12-13 19:48     ` Martin Sebor
2018-12-13 19:56       ` Jakub Jelinek [this message]
2018-12-13 22:22         ` Martin Sebor
2018-12-13 23:40           ` Jakub Jelinek
2018-12-14  4:04             ` Martin Sebor
2018-12-14  7:41               ` Jakub Jelinek
2018-12-15  0:18                 ` Martin Sebor
2018-12-21  2:56       ` Martin Sebor
2019-01-03 22:22         ` PING " Martin Sebor
2019-01-08  0:32           ` PING #2 " Martin Sebor
2019-01-15 16:31             ` Martin Sebor
2019-01-17  1:16               ` Jeff Law

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=20181213195651.GZ12380@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=msebor@gmail.com \
    /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).