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 via email to