This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libiberty PATCH] Add ATTRIBUTE_PURE to ansidecl
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Jul 2004 11:26:40 +0200
- Subject: [libiberty PATCH] Add ATTRIBUTE_PURE to ansidecl
This can be used to mark get_attr_* functions as pure. It can also be
used for functions in libiberty (lbasename is the only one where it may
be somewhat useful).
Ok for mainline and src?
Paolo
Index: ansidecl.h
===================================================================
RCS file: /cvs/gcc/gcc/include/ansidecl.h,v
retrieving revision 1.16
diff -u -r1.16 ansidecl.h
--- ansidecl.h 17 Jun 2003 14:10:00 -0000 1.16
+++ ansidecl.h 20 Jul 2004 09:19:59 -0000
@@ -277,6 +277,15 @@
# endif /* GNUC >= 3.3 */
#endif /* ATTRIBUTE_NONNULL */
+/* Attribute `pure' was valid as of gcc 3.0. */
+#ifndef ATTRIBUTE_PURE
+# if (GCC_VERSION >= 3000)
+# define ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define ATTRIBUTE_PURE
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_PURE */
+
/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
This was the case for the `printf' format attribute by itself
before GCC 3.3, but as of 3.3 we need to add the `nonnull'