public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Jeff Law <law@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Ian Lance Taylor <iant@golang.org>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Marek Polacek <polacek@redhat.com>,
	Gcc Patch List <gcc-patches@gcc.gnu.org>,
	Jason Merrill <jason@redhat.com>
Subject: Re: [PATCH 1/3] improve detection of attribute conflicts (PR 81544)
Date: Thu, 24 Aug 2017 21:10:00 -0000	[thread overview]
Message-ID: <7e1f1d8c-a35f-ade5-76bd-b506c6d60e21@gmail.com> (raw)
In-Reply-To: <c6c50436-d6f8-69ee-3550-432cd3e32bc7@gmail.com>

The bulk of this patch touches what I think is considered
the middle-end (attribs.c) so let me include its maintainers,
Ian, Jeff, and Richard:

   https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01087.html

The high-level description and rationale for the change are
here:

   https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00602.html

Thanks
Martin

On 08/17/2017 10:03 AM, Martin Sebor wrote:
> Attached is an updated patch with just the minor editorial
> tweaks for the issues pointed out by Marek (stray comments
> and spaces), and with the C++ and libstdc++ bits removed
> and posted separately.  I also added some text to the manual
> to clarify the const/pure effects.
>
> I thought quite a bit more about the const/pure attributes we
> discussed and tried the approach of warning only on a const
> declaration after one with attribute pure has been used, but
> otherwise allowing and silently ignoring pure after const.
> In the end I decided against it, for a few reasons (most of
> which I already mentioned but just to summarize).
>
> First, there is the risk that someone will write code based
> on the pure declaration even if there's no intervening call
> to the function between it and the const one.  Code tends to
> be sloppy, and it's also not uncommon to declare the same
> function more than once, for whatever reason.  (The ssa-ccp-2.c
> test is an example of the latter.)
>
> Second, there are cases of attribute conflicts that GCC already
> points out that are much more benign in their effects (the ones
> I know about are always_inline/noinline and cold/hot).  In light
> of the risk above it seems only helpful to include const/pure in
> the same set.
>
> Third, I couldn't find another pair of attributes that GCC would
> deliberately handle this way (silently accept both but prefer one
> over the other), and introducing a special case just for these
> two seemed like a wart.
>
> Finally, compiling Binutils, GDB, Glkibc, and the Linux kernel
> with the enhanced warning didn't turn up any code that does this
> sort of thing, either intentionally or otherwise.
>
> With that, I've left the handling unchanged.
>
> I do still have the question whether diagnosing attribute
> conflicts under -Wattributes is right.  The manual implies
> that -Wattributes is for attributes in the wrong places or
> on the wrong entities, and that -Wignored-attributes should
> be expected instead when GCC decides to drop one for some
> reason.
>
> It is a little unfortunate that many -Wattributes warnings
> print just "attribute ignored" (and have done so for years).
> I think they should all be enhanced to also print why the
> attribute is ignored (e.g., "'packed' attribute on function
> declarations ignored/not valid/not supported" or something
> like that).  Those that ignore attributes that would
> otherwise be valid e.g., because they conflict with other
> specifiers of the same attribute but with a different
> operand might then be candidate for changing to
> -Wignored-attributes.
>
> Thanks
> Martin
>

  reply	other threads:[~2017-08-24 20:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 16:14 Martin Sebor
2017-08-09 11:53 ` Marek Polacek
2017-08-09 14:19   ` Martin Sebor
2017-08-09 17:13     ` Joseph Myers
2017-08-09 19:26       ` Martin Sebor
2017-08-09 20:47         ` Joseph Myers
2017-08-10  4:47           ` Martin Sebor
2017-08-10 23:51             ` Joseph Myers
2017-08-11 16:46               ` Martin Sebor
2017-08-11 16:49                 ` Joseph Myers
2017-08-17 18:23                 ` Martin Sebor
2017-08-24 21:10                   ` Martin Sebor [this message]
2017-08-29  5:21                     ` Martin Sebor
2017-09-06 23:30                   ` Joseph Myers
2017-09-19 19:48                     ` Martin Sebor
2017-09-19 21:00                       ` Joseph Myers
2017-09-20 18:04                         ` Martin Sebor
2017-10-02 22:24                           ` Jeff Law
2018-04-04 16:16                             ` Andreas Krebbel
2018-04-04 16:51                               ` Andreas Krebbel
2018-04-04 17:18                                 ` Martin Sebor
2018-04-04 17:35                                 ` Jakub Jelinek
2018-04-05  7:01                                   ` Andreas Krebbel
2018-04-05 10:35                                     ` Jakub Jelinek
2017-09-12 17:06                   ` Jeff Law
2017-09-19 20:00                     ` Martin Sebor
2017-09-12 15:44               ` Jeff Law
2017-09-12 15:50           ` 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=7e1f1d8c-a35f-ade5-76bd-b506c6d60e21@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@golang.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=law@redhat.com \
    --cc=polacek@redhat.com \
    --cc=richard.guenther@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).