public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] Fix version check for ATTRIBUTE_GCC_DUMP_PRINTF
Date: Mon, 27 Aug 2018 23:46:00 -0000	[thread overview]
Message-ID: <1535416331-352-1-git-send-email-dmalcolm@redhat.com> (raw)
In-Reply-To: <20180827065751.GB2218@tucnak>

On Mon, 2018-08-27 at 08:57 +0200, Jakub Jelinek wrote:
> On Thu, Aug 02, 2018 at 01:54:07PM -0400, David Malcolm wrote:
> > +/* An attribute for annotating formatting printing functions that
> > use
> > +   the dumpfile/optinfo formatting codes.  These are the
> > pretty_printer
> > +   format codes (see pretty-print.c), with additional codes for
> > middle-end
> > +   specific entities (see dumpfile.c).  */
> > +
> > +#if GCC_VERSION >= 3005
> > +#define ATTRIBUTE_GCC_DUMP_PRINTF(m, n) \
> > +  __attribute__ ((__format__ (__gcc_dump_printf__, m ,n))) \
> > +  ATTRIBUTE_NONNULL(m)
> > +#else
> > +#define ATTRIBUTE_GCC_DUMP_PRINTF(m, n) ATTRIBUTE_NONNULL(m)
> > +#endif
> 
> Why >= 3005 rather than >= 9000 ?

I believe I copied the logic from one of the existing __format__
attribute macros.  Maybe my thinking was that it expressed the
version in which format checking was added.

Yes, that's clearly the wrong version to use; sorry about that.

> GCC 8 and earlier will not handle that format attribute anyway and
> will just
> loudly complain.
> 
> 	Jakub

Here a patch that does what you suggest.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

OK for trunk?

gcc/ChangeLog:
	* dumpfile.h (ATTRIBUTE_GCC_DUMP_PRINTF): Change version check on
	GCC_VERSION for usage of "__gcc_dump_printf__" format from
	>= 3005 to >= 9000.
---
 gcc/dumpfile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 0305d36..671b7b9 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
    format codes (see pretty-print.c), with additional codes for middle-end
    specific entities (see dumpfile.c).  */
 
-#if GCC_VERSION >= 3005
+#if GCC_VERSION >= 9000
 #define ATTRIBUTE_GCC_DUMP_PRINTF(m, n) \
   __attribute__ ((__format__ (__gcc_dump_printf__, m ,n))) \
   ATTRIBUTE_NONNULL(m)
-- 
1.8.5.3

  reply	other threads:[~2018-08-27 23:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 21:47 [PATCH 0/5] dump_printf support for middle-end types David Malcolm
2018-07-27 21:47 ` [PATCH 4/5] c-family: clean up the data tables in c-format.c David Malcolm
2018-07-31 12:56   ` Richard Biener
2018-07-31 13:08     ` Marek Polacek
2018-07-27 21:47 ` [PATCH 2/5] dumpfile.c: eliminate special-casing of dump_file/alt_dump_file David Malcolm
2018-07-31 12:54   ` Richard Biener
2018-07-31 15:34     ` David Malcolm
2018-07-31 15:37       ` Richard Biener
2018-07-27 21:47 ` [PATCH 1/5] Simplify dump_context by adding a dump_loc member function David Malcolm
2018-07-31 12:51   ` Richard Biener
2018-07-27 21:47 ` [PATCH 5/5] Formatted printing for dump_* in the middle-end David Malcolm
2018-07-31 13:03   ` Richard Biener
2018-07-31 14:19     ` David Malcolm
2018-07-31 14:21       ` Richard Biener
2018-07-31 14:33         ` Richard Biener
2018-07-31 19:56       ` Joseph Myers
2018-08-02 17:09         ` [PATCH] v2: " David Malcolm
2018-08-09 22:11           ` Joseph Myers
2018-08-17  4:08           ` Jeff Law
2018-08-17 18:24             ` David Malcolm
2018-08-27  6:58           ` Jakub Jelinek
2018-08-27 23:46             ` David Malcolm [this message]
2018-08-28  6:44               ` [PATCH] Fix version check for ATTRIBUTE_GCC_DUMP_PRINTF Jakub Jelinek
2018-08-28 12:26                 ` Jakub Jelinek
2018-08-28 14:19                   ` David Malcolm
2018-07-27 21:47 ` [PATCH 3/5] C++: clean up cp_printer David Malcolm
2018-07-28 14:06   ` Jason Merrill
2018-07-31 12:50 ` [PATCH 0/5] dump_printf support for middle-end types Richard Biener
2018-07-31 14:01   ` David Malcolm

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=1535416331-352-1-git-send-email-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.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).