[xslt] more warnings cleanup
- From: Stefan Kost <ensonic hora-obscura de>
- To: "xslt gnome org" <xslt gnome org>
- Subject: [xslt] more warnings cleanup
- Date: Mon, 09 May 2011 14:47:46 +0300
hi Daniel,
0001-testWriter-xmlTextWriterWriteFormatElement-wants-an-.patch
more cast fixes.
0003-various-use-STDOUT_FILENO-instead-of-1-in-write-call.patch
this imho makes the code more readable
0004-python-flag-two-unused-args.patch
0005-python-remove-unused-variable.patch
two more trivial ones
one source of warnings left is the compilation of threads.c
$ make threads.o
gcc -DHAVE_CONFIG_H -I. -I./include -I./include -D_REENTRANT -g -O2
-pedantic -W -Wformat -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 -Wredundant-decls -MT threads.o -MD -MP -MF
.deps/threads.Tpo -c -o threads.o threads.c
threads.c:53: warning: redundant redeclaration of ‘pthread_once’
/usr/include/pthread.h:478: note: previous declaration of ‘pthread_once’
was here
threads.c:56: warning: redundant redeclaration of ‘pthread_getspecific’
/usr/include/pthread.h:1103: note: previous declaration of
‘pthread_getspecific’ was here
threads.c:58: warning: redundant redeclaration of ‘pthread_setspecific’
/usr/include/pthread.h:1106: note: previous declaration of
‘pthread_setspecific’ was here
threads.c:61: warning: redundant redeclaration of ‘pthread_key_create’
/usr/include/pthread.h:1095: note: previous declaration of
‘pthread_key_create’ was here
threads.c:64: warning: redundant redeclaration of ‘pthread_key_delete’
/usr/include/pthread.h:1100: note: previous declaration of
‘pthread_key_delete’ was here
threads.c:67: warning: function declaration isn’t a prototype
threads.c:66: warning: redundant redeclaration of ‘pthread_mutex_init’
/usr/include/pthread.h:733: note: previous declaration of
‘pthread_mutex_init’ was here
threads.c:69: warning: function declaration isn’t a prototype
threads.c:68: warning: redundant redeclaration of ‘pthread_mutex_destroy’
/usr/include/pthread.h:738: note: previous declaration of
‘pthread_mutex_destroy’ was here
It comes from this commit: git show dbfe05af
commit dbfe05aff4d242e31fcd7621a4901a6fa10b988e
Author: Daniel Veillard <veillard src gnome org>
Date: Wed May 4 09:18:00 2005 +0000
on linux/gcc use weak definitions to avoid linking with pthread library on
* Makefile.am configure.in threads.c: on linux/gcc use weak definitions
to avoid linking with pthread library on non-threaded environments.
* xpath.c: applied patch from Mark Vakoc w.r.t. a buggy namespace
list allocation.
Daniel
I see the point in adding the weak-attribute. Altough I wonder why most
of the functions are not completely defines (e.g. pthread_mutex_init)
but some others are. If I complete them those warnings disappear. I'll
try if there is a way to avoid the warnings about the redeclaration.
http://stackoverflow.com/questions/5935539/using-attribute-weak-leads-to-warning-redundant-redeclaration-of-xxx-a
Stefan
>From 55f86a0b124c2155e61cc0002bbf775563999c6f Mon Sep 17 00:00:00 2001
From: Stefan Kost <ensonic users sf net>
Date: Mon, 9 May 2011 11:45:23 +0300
Subject: [PATCH 1/9] testWriter: xmlTextWriterWriteFormatElement wants an int instead of a long int
Fixes compiler warnings about wrong argument type.
---
doc/examples/testWriter.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c
index e158f97..9bf590f 100644
--- a/doc/examples/testWriter.c
+++ b/doc/examples/testWriter.c
@@ -160,7 +160,7 @@ testXmlwriterFilename(const char *uri)
/* Write an element named "X_ORDER_ID" as child of HEADER. */
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
- "%010d", 53535L);
+ "%010d", 53535);
if (rc < 0) {
printf
("testXmlwriterFilename: Error at xmlTextWriterWriteFormatElement\n");
@@ -439,7 +439,7 @@ testXmlwriterMemory(const char *file)
/* Write an element named "X_ORDER_ID" as child of HEADER. */
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
- "%010d", 53535L);
+ "%010d", 53535);
if (rc < 0) {
printf
("testXmlwriterMemory: Error at xmlTextWriterWriteFormatElement\n");
@@ -468,7 +468,7 @@ testXmlwriterMemory(const char *file)
/* Write an element named "NAME_2" as child of HEADER. */
tmp = ConvertInput("Jörg", MY_ENCODING);
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
-
+
if (rc < 0) {
printf
("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
@@ -709,7 +709,7 @@ testXmlwriterDoc(const char *file)
/* Write an element named "X_ORDER_ID" as child of HEADER. */
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
- "%010d", 53535L);
+ "%010d", 53535);
if (rc < 0) {
printf
("testXmlwriterDoc: Error at xmlTextWriterWriteFormatElement\n");
@@ -975,7 +975,7 @@ testXmlwriterTree(const char *file)
/* Write an element named "X_ORDER_ID" as child of HEADER. */
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
- "%010d", 53535L);
+ "%010d", 53535);
if (rc < 0) {
printf
("testXmlwriterTree: Error at xmlTextWriterWriteFormatElement\n");
--
1.7.1
>From 8c7cdf4eb69bfe7da717d2e7f34d9a053afc0c29 Mon Sep 17 00:00:00 2001
From: Stefan Kost <ensonic users sf net>
Date: Mon, 9 May 2011 12:31:54 +0300
Subject: [PATCH 3/9] various: use STDOUT_FILENO instead of '1' in write calls for readability
---
nanoftp.c | 2 +-
xmllint.c | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/nanoftp.c b/nanoftp.c
index a7ca5b6..ba104ef 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -1797,7 +1797,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
return(-1);
}
#ifdef DEBUG_FTP
- write(1, &buf[indx], len);
+ write(STDOUT_FILENO, &buf[indx], len);
#endif
indx += len;
buf[indx] = 0;
diff --git a/xmllint.c b/xmllint.c
index 8af56cd..8ccac5a 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -11,6 +11,12 @@
#include <string.h>
#include <stdarg.h>
#include <assert.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
#if defined (_WIN32) && !defined(__CYGWIN__)
#if defined (_MSC_VER) || defined(__BORLANDC__)
@@ -2550,7 +2556,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_0, NULL, 1, &result);
if (size >= 0) {
- if (write(1, result, size) == -1) {
+ if (write(STDOUT_FILENO, result, size) == -1) {
fprintf(stderr, "Can't write data\n");
}
xmlFree(result);
@@ -2564,7 +2570,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_1, NULL, 1, &result);
if (size >= 0) {
- if (write(1, result, size) == -1) {
+ if (write(STDOUT_FILENO, result, size) == -1) {
fprintf(stderr, "Can't write data\n");
}
xmlFree(result);
@@ -2579,7 +2585,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_EXCLUSIVE_1_0, NULL, 1, &result);
if (size >= 0) {
- if (write(1, result, size) == -1) {
+ if (write(STDOUT_FILENO, result, size) == -1) {
fprintf(stderr, "Can't write data\n");
}
xmlFree(result);
@@ -2610,7 +2616,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
fprintf(stderr, "Failed to save\n");
progresult = XMLLINT_ERR_OUT;
} else {
- if (write(1, result, len) == -1) {
+ if (write(STDOUT_FILENO, result, len) == -1) {
fprintf(stderr, "Can't write data\n");
}
xmlFree(result);
--
1.7.1
>From dc87548d71a7de7ad8725677780817cd3ba87705 Mon Sep 17 00:00:00 2001
From: Stefan Kost <ensonic users sf net>
Date: Mon, 9 May 2011 12:52:28 +0300
Subject: [PATCH 4/9] python: flag two unused args
---
python/libxml.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/libxml.c b/python/libxml.c
index b0043e6..cfdaac8 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -1745,7 +1745,7 @@ typedef struct
typedef xmlValidCtxtPyCtxt *xmlValidCtxtPyCtxtPtr;
static void
-libxml_xmlValidCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str)
+libxml_xmlValidCtxtGenericErrorFuncHandler(void *ctx, ATTRIBUTE_UNUSED int severity, char *str)
{
PyObject *list;
PyObject *result;
@@ -1772,7 +1772,7 @@ libxml_xmlValidCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str)
}
static void
-libxml_xmlValidCtxtGenericWarningFuncHandler(void *ctx, int severity, char *str)
+libxml_xmlValidCtxtGenericWarningFuncHandler(void *ctx, ATTRIBUTE_UNUSED int severity, char *str)
{
PyObject *list;
PyObject *result;
--
1.7.1
>From c0759f7598d63214bce52bdce407f8407d4fbcec Mon Sep 17 00:00:00 2001
From: Stefan Kost <ensonic users sf net>
Date: Mon, 9 May 2011 12:54:10 +0300
Subject: [PATCH 5/9] python: remove unused variable
---
python/libxml.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/python/libxml.c b/python/libxml.c
index cfdaac8..3e26e2d 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -2762,7 +2762,6 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
xmlDocPtr doc;
const char *encoding;
int format;
- int len;
xmlSaveCtxtPtr ctxt;
xmlBufferPtr buf;
int options = 0;
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]