Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <>2003-03-25 23:56:02 +0300
committercvs2svn <>2003-03-25 23:56:02 +0300
commit8ed0d1ced5ea081b1d3091e2c04b595c555f98b5 (patch)
treeea38f9f8b487e1418fd862abc010e40b283b461c /include/ansidecl.h
parenteb5090421a0452e1519c10734dac03c9cee39a58 (diff)
This commit was manufactured by cvs2svn to create branchcagney_framebase-20030326-branchpoint
'cagney_framebase-20030326-branch'. Sprout from cagney_lazyid-20030317-branch 2003-03-17 10:34:30 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch' Cherrypick from master 2003-03-25 20:56:01 UTC Nick Clifton <nickc@redhat.com> 'Add iWMMXt support': include/ChangeLog include/ansidecl.h include/coff/ChangeLog include/coff/arm.h include/elf/ChangeLog include/elf/arm.h include/gdb/ChangeLog include/gdb/sim-arm.h include/hashtab.h include/opcode/ChangeLog include/opcode/s390.h
Diffstat (limited to 'include/ansidecl.h')
-rw-r--r--include/ansidecl.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/ansidecl.h b/include/ansidecl.h
index d169b4f50..f8f2d737b 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -268,8 +268,21 @@ So instead we use the macro below and test it against specific values. */
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
+/* Attribute `nonnull' was valid as of gcc 3.3. */
+#ifndef ATTRIBUTE_NONNULL
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
+# else
+# define ATTRIBUTE_NONNULL(m)
+# endif /* GNUC >= 3.3 */
+#endif /* ATTRIBUTE_NONNULL */
+
+/* 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'
+ attribute to retain this behavior. */
#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
@@ -277,6 +290,21 @@ So instead we use the macro below and test it against specific values. */
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
#endif /* ATTRIBUTE_PRINTF */
+/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
+ NULL format specifier was allowed as of gcc 3.3. */
+#ifndef ATTRIBUTE_NULL_PRINTF
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+# else
+# define ATTRIBUTE_NULL_PRINTF(m, n)
+# endif /* GNUC >= 3.3 */
+# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
+# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
+# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
+# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
+# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
+#endif /* ATTRIBUTE_NULL_PRINTF */
+
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */