This is the mail archive of the
mailing list for the GCC project.
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
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?
2009-05-22 Ben Elliston <firstname.lastname@example.org>
* 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.
--- 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)
#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)