mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-01 14:06:55 +03:00
Fix libxslt format warnings
* config.h.in: Let autoconf have its way with the file. * configure.in: Replace "-Wformat" with "-Wformat=2 -Wmissing-format-attribute". Add "-Wformat=2 -Wmissing-format-attribute" to default CFLAGS. * libxslt/transform.c: (xsltDocumentElem): Fix missing placeholder in format string. Make "unsupported method" format strings more consistent by putting method name in parenthesis. (xsltApplyStylesheetInternal): Ditto. * libxslt/xsltconfig.h.in: (LIBXSLT_ATTR_FORMAT): Add macro to decorate functions that have format string arguments. * libxslt/xsltutils.c: (xsltGenericErrorDefaultFunc): Add macro to decorate functions that have format string arguments. (xsltGenericDebugDefaultFunc): Ditto. * libxslt/xsltutils.h: (xsltTransformError): Add LIBXSLT_ATTR_FORMAT macro. * xsltproc/xsltproc.c: (endTimer): Add predeclaration with LIBXSLT_ATTR_FORMAT macro. Fixes bug #762006. https://bugzilla.gnome.org/show_bug.cgi?id=762006
This commit is contained in:
committed by
Nick Wellnhofer
parent
d182d8f6ba
commit
866fc3b67e
@ -431,7 +431,7 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
|
|||||||
then
|
then
|
||||||
with_mem_debug="yes"
|
with_mem_debug="yes"
|
||||||
fi
|
fi
|
||||||
CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
|
CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat=2 -Wmissing-format-attribute -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
|
AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
|
||||||
@ -525,7 +525,7 @@ if test "${GCC}" != "yes" ; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
CFLAGS="${CFLAGS} -Wall"
|
CFLAGS="${CFLAGS} -Wall -Wformat=2 -Wmissing-format-attribute"
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
alpha*-*-linux* )
|
alpha*-*-linux* )
|
||||||
CFLAGS="${CFLAGS} -mieee"
|
CFLAGS="${CFLAGS} -mieee"
|
||||||
|
@ -3714,7 +3714,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
xmlDictReference(res->dict);
|
xmlDictReference(res->dict);
|
||||||
} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
|
} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
|
||||||
xsltTransformError(ctxt, NULL, inst,
|
xsltTransformError(ctxt, NULL, inst,
|
||||||
"xsltDocumentElem: unsupported method xhtml\n",
|
"xsltDocumentElem: unsupported method xhtml (%s)\n",
|
||||||
style->method);
|
style->method);
|
||||||
ctxt->type = XSLT_OUTPUT_HTML;
|
ctxt->type = XSLT_OUTPUT_HTML;
|
||||||
res = htmlNewDocNoDtD(doctypeSystem, doctypePublic);
|
res = htmlNewDocNoDtD(doctypeSystem, doctypePublic);
|
||||||
@ -3735,7 +3735,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
xsltTransformError(ctxt, NULL, inst,
|
xsltTransformError(ctxt, NULL, inst,
|
||||||
"xsltDocumentElem: unsupported method %s\n",
|
"xsltDocumentElem: unsupported method (%s)\n",
|
||||||
style->method);
|
style->method);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -5973,7 +5973,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
|
|||||||
#endif
|
#endif
|
||||||
} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
|
} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
|
||||||
xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
|
xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
|
||||||
"xsltApplyStylesheetInternal: unsupported method xhtml, using html\n",
|
"xsltApplyStylesheetInternal: unsupported method xhtml (%s), using html\n",
|
||||||
style->method);
|
style->method);
|
||||||
ctxt->type = XSLT_OUTPUT_HTML;
|
ctxt->type = XSLT_OUTPUT_HTML;
|
||||||
res = htmlNewDoc(doctypeSystem, doctypePublic);
|
res = htmlNewDoc(doctypeSystem, doctypePublic);
|
||||||
@ -6000,7 +6000,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
|
xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
|
||||||
"xsltApplyStylesheetInternal: unsupported method %s\n",
|
"xsltApplyStylesheetInternal: unsupported method (%s)\n",
|
||||||
style->method);
|
style->method);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,17 @@ extern "C" {
|
|||||||
#define ATTRIBUTE_UNUSED
|
#define ATTRIBUTE_UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXSLT_ATTR_FORMAT:
|
||||||
|
*
|
||||||
|
* This macro is used to indicate to GCC the parameters are printf-like
|
||||||
|
*/
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define LIBXSLT_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
|
||||||
|
#else
|
||||||
|
#define LIBXSLT_ATTR_FORMAT(fmt,args)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXSLT_PUBLIC:
|
* LIBXSLT_PUBLIC:
|
||||||
*
|
*
|
||||||
|
@ -519,7 +519,7 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
|
|||||||
*
|
*
|
||||||
* Default handler for out of context error messages.
|
* Default handler for out of context error messages.
|
||||||
*/
|
*/
|
||||||
static void
|
static void LIBXSLT_ATTR_FORMAT(2,3)
|
||||||
xsltGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
xsltGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
|||||||
*
|
*
|
||||||
* Default handler for out of context error messages.
|
* Default handler for out of context error messages.
|
||||||
*/
|
*/
|
||||||
static void
|
static void LIBXSLT_ATTR_FORMAT(2,3)
|
||||||
xsltGenericDebugDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
xsltGenericDebugDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
xsltStylesheetPtr style,
|
xsltStylesheetPtr style,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
...);
|
...) LIBXSLT_ATTR_FORMAT(4,5);
|
||||||
|
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
|
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libxslt/libxslt.h"
|
#include "libxslt/libxslt.h"
|
||||||
|
#include "libxslt/xsltconfig.h"
|
||||||
#include "libexslt/exslt.h"
|
#include "libexslt/exslt.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
@ -236,6 +237,8 @@ my_gettimeofday(struct timeval *tvp, void *tzp)
|
|||||||
#endif /* HAVE_SYS_TIMEB_H */
|
#endif /* HAVE_SYS_TIMEB_H */
|
||||||
#endif /* !HAVE_GETTIMEOFDAY */
|
#endif /* !HAVE_GETTIMEOFDAY */
|
||||||
|
|
||||||
|
static void endTimer(const char *format, ...) LIBXSLT_ATTR_FORMAT(1,2);
|
||||||
|
|
||||||
#if defined(HAVE_GETTIMEOFDAY)
|
#if defined(HAVE_GETTIMEOFDAY)
|
||||||
static struct timeval begin, endtime;
|
static struct timeval begin, endtime;
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user