port patch from Marcus Meissner to add gcc checking for printf like
* include/libxml/parser.h include/libxml/xmlwriter.h
include/libxml/relaxng.h include/libxml/xmlversion.h.in
include/libxml/xmlwin32version.h.in include/libxml/valid.h
include/libxml/xmlschemas.h include/libxml/xmlerror.h:
port patch from Marcus Meissner to add gcc checking for
printf like functions parameters, should fix #65068
* doc/apibuild.py doc/*: modified the script accordingly
and regenerated
* xpath.c xmlmemory.c threads.c: fix a few warnings
Daniel
svn path=/trunk/; revision=3813
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index 4079295..05c9f29 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -382,18 +382,27 @@
#define LIBXML_ZLIB_ENABLED
#endif
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include <ansidecl.h>
+#endif
+
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
-#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
+
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__((unused))
#endif
+
+/**
+ * ATTRIBUTE_ALLOC_SIZE:
+ *
+ * Macro used to indicate to GCC this is an allocator function
+ */
+
#ifndef ATTRIBUTE_ALLOC_SIZE
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -403,11 +412,44 @@
#else
# define ATTRIBUTE_ALLOC_SIZE(x)
#endif
+
+/**
+ * ATTRIBUTE_PRINTF:
+ *
+ * Macro used to indicate to GCC the parameter are printf like
+ */
+
+#ifndef ATTRIBUTE_PRINTF
+# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
+# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
+# else
+# define ATTRIBUTE_PRINTF(fmt,args)
+# endif
#else
-#define ATTRIBUTE_UNUSED
-#define ATTRIBUTE_ALLOC_SIZE(x)
+# define ATTRIBUTE_PRINTF(fmt,args)
#endif
+#else /* ! __GNUC__ */
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * Macro used to signal to GCC unused function parameters
+ */
+#define ATTRIBUTE_UNUSED
+/**
+ * ATTRIBUTE_ALLOC_SIZE:
+ *
+ * Macro used to indicate to GCC this is an allocator function
+ */
+#define ATTRIBUTE_ALLOC_SIZE(x)
+/**
+ * ATTRIBUTE_PRINTF:
+ *
+ * Macro used to indicate to GCC the parameter are printf like
+ */
+#define ATTRIBUTE_PRINTF(fmt,args)
+#endif /* __GNUC__ */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */