This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: improve ATTRIBUTE_GCC_DIAG


On Wed, 2009-05-20 at 07:54 -0700, Ian Lance Taylor wrote:

> I think this is a valid point.  We do want to see the warnings when
> bootstrapping on release branches.  So I think what we should do is: if
> configured with --enable-checking=release (or --enable-checking=no),
> then only issue the warnings if the compiler is being compiled by the
> same version.  That will eliminate the warnings in the case where users
> are most likely to see them and be confused, without hampering
> developers.

I tried a few approaches to this problem, none of which were
particularly good.  In the end, I settled on this simple version, but it
suffers from the problem of needing this version to be incremented at
the same time as the overall GCC version number.

Short of having autoconf (or make) generate a header file with the
encoded version number in it, does anyone have any other ideas?

Cheers, Ben


2009-05-22  Ben Elliston  <bje@au.ibm.com>

        * toplev.h (ATTRIBUTE_GCC_DIAG): When building with checking
        disabled, use the __format__ attribute only if compiling with the
        same version of GCC as the sources.

Index: toplev.h
===================================================================
--- toplev.h    (revision 147790)
+++ toplev.h    (working copy)
@@ -49,7 +49,7 @@
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
    specifiers.  We must use custom format checks.  */
-#if GCC_VERSION >= 4001
+#if ENABLE_CHECKING || GCC_VERSION == 4005
 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]