- HTMLparser.c HTMLtree.c SAX.c debugXML.c error.c parserInternals.c
testHTML.c testSAX.c tree.c valid.c xmlIO.c xmlmemory.c
xmlversion.h.in xpointer.c: of course the way I defined
UNUSED breaks on old gcc version. Try to be smart and
also define it directly in xmlversion.h
- configure.in: removed -ansi flag from the pedantic set
Daniel
diff --git a/ChangeLog b/ChangeLog
index da3c051..bb4b16a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
-Sat Mar 24 17:45:36 CET 2001
+Mon Mar 26 18:24:52 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * HTMLparser.c HTMLtree.c SAX.c debugXML.c error.c parserInternals.c
+ testHTML.c testSAX.c tree.c valid.c xmlIO.c xmlmemory.c
+ xmlversion.h.in xpointer.c: of course the way I defined
+ UNUSED breaks on old gcc version. Try to be smart and
+ also define it directly in xmlversion.h
+ * configure.in: removed -ansi flag from the pedantic set
+
+Sat Mar 24 17:45:36 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
Huge cleanup, I switched to compile with
-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit
-Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat
diff --git a/HTMLparser.c b/HTMLparser.c
index 49b0264..39447e3 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -56,18 +56,6 @@
int htmlOmittedDefaultValue = 1;
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
xmlChar end, xmlChar end2, xmlChar end3);
@@ -1546,8 +1534,8 @@
* must deallocate it !
*/
xmlChar *
-htmlDecodeEntities(htmlParserCtxtPtr ctxt UNUSED, int len UNUSED,
- xmlChar end UNUSED, xmlChar end2 UNUSED, xmlChar end3 UNUSED) {
+htmlDecodeEntities(htmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED,
+ xmlChar end ATTRIBUTE_UNUSED, xmlChar end2 ATTRIBUTE_UNUSED, xmlChar end3 ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3718,7 +3706,7 @@
* Returns the new parser context or NULL
*/
static htmlParserCtxtPtr
-htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding UNUSED) {
+htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
htmlParserCtxtPtr ctxt;
htmlParserInputPtr input;
/* htmlCharEncoding enc; */
diff --git a/HTMLtree.c b/HTMLtree.c
index a542a57..d62072a 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -36,18 +36,6 @@
/************************************************************************
* *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
-/************************************************************************
- * *
* Getting/Setting encoding meta tags *
* *
************************************************************************/
@@ -698,7 +686,7 @@
*/
static void
htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- const char *encoding UNUSED) {
+ const char *encoding ATTRIBUTE_UNUSED) {
xmlDtdPtr cur = doc->intSubset;
if (cur == NULL) {
@@ -733,7 +721,7 @@
*/
static void
htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
- const char *encoding UNUSED) {
+ const char *encoding ATTRIBUTE_UNUSED) {
xmlChar *value;
if (cur == NULL) {
diff --git a/SAX.c b/SAX.c
index ef5801b..9691a88 100644
--- a/SAX.c
+++ b/SAX.c
@@ -32,13 +32,9 @@
/* #define DEBUG_SAX_TREE */
#ifdef __GNUC__
-#ifndef DEBUG_SAX
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
+#ifdef DEBUG_SAX
+#define ATTRIBUTE_UNUSED
#endif
-#else
-#define UNUSED
#endif
/**
@@ -50,7 +46,7 @@
* Returns a xmlChar *
*/
const xmlChar *
-getPublicId(void *ctx UNUSED)
+getPublicId(void *ctx ATTRIBUTE_UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
return(NULL);
@@ -658,7 +654,7 @@
* Everything is available on the context, so this is useless in our case.
*/
void
-setDocumentLocator(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
+setDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
@@ -1092,7 +1088,7 @@
* called when the end of an element has been detected.
*/
void
-endElement(void *ctx, const xmlChar *name UNUSED)
+endElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserNodeInfo node_info;
@@ -1271,7 +1267,7 @@
* Question: how much at a time ???
*/
void
-ignorableWhitespace(void *ctx UNUSED, const xmlChar *ch UNUSED, int len UNUSED)
+ignorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
diff --git a/configure.in b/configure.in
index ccdc2db..553a145 100644
--- a/configure.in
+++ b/configure.in
@@ -237,8 +237,8 @@
if test "${with_xptr}" = "" ; then
with_xptr="yes"
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 "
-dnl -Wcast-qual
+ CFLAGS="-Wall -g -O -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 "
+dnl -Wcast-qual -ansi
fi
dnl
dnl Aloow to disable various pieces
diff --git a/debugXML.c b/debugXML.c
index 73429c3..0c3f334 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -33,18 +33,6 @@
#include <libxml/HTMLparser.h>
#include <libxml/xmlerror.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
#define IS_BLANK(c) \
(((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' '))
@@ -1087,8 +1075,8 @@
* Returns 0
*/
static int
-xmlShellList(xmlShellCtxtPtr ctxt UNUSED , char *arg UNUSED, xmlNodePtr node,
- xmlNodePtr node2 UNUSED) {
+xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED , char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
xmlNodePtr cur;
if ((node->type == XML_DOCUMENT_NODE) ||
@@ -1120,8 +1108,8 @@
* Returns 0
*/
static int
-xmlShellDir(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr node,
- xmlNodePtr node2 UNUSED) {
+xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE)) {
xmlDebugDumpDocumentHead(stdout, (xmlDocPtr) node);
@@ -1146,8 +1134,8 @@
* Returns 0
*/
static int
-xmlShellCat(xmlShellCtxtPtr ctxt, char *arg UNUSED, xmlNodePtr node,
- xmlNodePtr node2 UNUSED) {
+xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
#ifdef LIBXML_HTML_ENABLED
if (node->type == XML_HTML_DOCUMENT_NODE)
@@ -1183,8 +1171,8 @@
* Returns 0 or -1 if loading failed
*/
static int
-xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED,
- xmlNodePtr node2 UNUSED) {
+xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNUSED,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
xmlDocPtr doc;
int html = 0;
@@ -1236,7 +1224,7 @@
*/
static int
xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
- xmlNodePtr node2 UNUSED) {
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
if (node == NULL)
return(-1);
if ((filename == NULL) || (filename[0] == 0)) {
@@ -1303,8 +1291,8 @@
* Returns 0 or -1 in case of error
*/
static int
-xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED,
- xmlNodePtr node2 UNUSED) {
+xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNUSED,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
if (ctxt->doc == NULL)
return(-1);
if ((filename == NULL) || (filename[0] == 0))
@@ -1359,8 +1347,8 @@
* Returns 0 or -1 in case of error
*/
static int
-xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node UNUSED,
- xmlNodePtr node2 UNUSED) {
+xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node ATTRIBUTE_UNUSED,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
xmlValidCtxt vctxt;
int res = -1;
@@ -1397,8 +1385,8 @@
* Returns 0 or -1 in case of error
*/
static int
-xmlShellDu(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr tree,
- xmlNodePtr node2 UNUSED) {
+xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xmlNodePtr tree,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
xmlNodePtr node;
int indent = 0,i;
@@ -1473,8 +1461,8 @@
* Returns 0 or -1 in case of error
*/
static int
-xmlShellPwd(xmlShellCtxtPtr ctxt UNUSED, char *buffer, xmlNodePtr node,
- xmlNodePtr node2 UNUSED) {
+xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node,
+ xmlNodePtr node2 ATTRIBUTE_UNUSED) {
xmlNodePtr cur, tmp, next;
char buf[500];
char sep;
diff --git a/error.c b/error.c
index cf1c1a5..a0124d4 100644
--- a/error.c
+++ b/error.c
@@ -18,11 +18,6 @@
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
/************************************************************************
* *
* Handling of out of context errors *
@@ -38,7 +33,7 @@
* Default handler for out of context error messages.
*/
static void
-xmlGenericErrorDefaultFunc(void *ctx UNUSED, const char *msg, ...) {
+xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_list args;
if (xmlGenericErrorContext == NULL)
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index 71ab184..934dc7c 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -121,6 +121,15 @@
#endif
#endif
+#ifdef __GNUC__
+#include <ansidecl.h>
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/parserInternals.c b/parserInternals.c
index 0f6dfcc..e0cdf31 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -48,18 +48,6 @@
#include <libxml/xmlIO.h>
#include <libxml/uri.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
void xmlUpgradeOldNs(xmlDocPtr doc);
/************************************************************************
@@ -1545,7 +1533,7 @@
*/
int
-xmlCopyChar(int len UNUSED, xmlChar *out, int val) {
+xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
/* the len parameter is ignored */
if (val >= 0x80) {
return(xmlCopyCharMultiByte (out, val));
@@ -2597,8 +2585,8 @@
* must deallocate it !
*/
xmlChar *
-xmlDecodeEntities(xmlParserCtxtPtr ctxt UNUSED, int len UNUSED, int what UNUSED,
- xmlChar end UNUSED, xmlChar end2 UNUSED, xmlChar end3 UNUSED) {
+xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED, int what ATTRIBUTE_UNUSED,
+ xmlChar end ATTRIBUTE_UNUSED, xmlChar end2 ATTRIBUTE_UNUSED, xmlChar end3 ATTRIBUTE_UNUSED) {
#if 0
xmlChar *buffer = NULL;
unsigned int buffer_size = 0;
@@ -2731,7 +2719,7 @@
*/
xmlChar *
-xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt UNUSED) {
+xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
#if 0
xmlChar buf[XML_MAX_NAMELEN + 5];
int len = 0, l;
@@ -2800,7 +2788,7 @@
*/
xmlChar *
-xmlNamespaceParseQName(xmlParserCtxtPtr ctxt UNUSED, xmlChar **prefix UNUSED) {
+xmlNamespaceParseQName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlChar **prefix ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
@@ -2842,7 +2830,7 @@
*/
xmlChar *
-xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt UNUSED) {
+xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -2877,7 +2865,7 @@
* Returns the string parser or NULL.
*/
xmlChar *
-xmlParseQuotedString(xmlParserCtxtPtr ctxt UNUSED) {
+xmlParseQuotedString(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -2975,7 +2963,7 @@
*/
void
-xmlParseNamespace(xmlParserCtxtPtr ctxt UNUSED) {
+xmlParseNamespace(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3102,7 +3090,7 @@
*/
xmlChar *
-xmlScanName(xmlParserCtxtPtr ctxt UNUSED) {
+xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3175,7 +3163,7 @@
* http://www.w3.org/TR/REC-xml#entproc
*/
void
-xmlParserHandleReference(xmlParserCtxtPtr ctxt UNUSED) {
+xmlParserHandleReference(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3421,7 +3409,7 @@
*/
void
-xmlHandleEntity(xmlParserCtxtPtr ctxt UNUSED, xmlEntityPtr entity UNUSED) {
+xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlEntityPtr entity ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3474,8 +3462,8 @@
* Returns NULL this functionnality had been removed
*/
xmlNsPtr
-xmlNewGlobalNs(xmlDocPtr doc UNUSED, const xmlChar *href UNUSED,
- const xmlChar *prefix UNUSED) {
+xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED,
+ const xmlChar *prefix ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3536,7 +3524,7 @@
* DEPRECATED
*/
void
-xmlUpgradeOldNs(xmlDocPtr doc UNUSED) {
+xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
diff --git a/testHTML.c b/testHTML.c
index dcea309..ba33aaa 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -43,18 +43,6 @@
#include <libxml/debugXML.h>
#include <libxml/xmlerror.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
#ifdef LIBXML_DEBUG_ENABLED
static int debug = 0;
#endif
@@ -113,7 +101,7 @@
* Returns 1 if true
*/
static int
-isStandaloneDebug(void *ctx UNUSED)
+isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.isStandalone()\n");
return(0);
@@ -128,7 +116,7 @@
* Returns 1 if true
*/
static int
-hasInternalSubsetDebug(void *ctx UNUSED)
+hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.hasInternalSubset()\n");
return(0);
@@ -143,7 +131,7 @@
* Returns 1 if true
*/
static int
-hasExternalSubsetDebug(void *ctx UNUSED)
+hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.hasExternalSubset()\n");
return(0);
@@ -156,7 +144,7 @@
* Does this document has an internal subset
*/
static void
-internalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
+internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID)
{
fprintf(stdout, "SAX.internalSubset(%s,", name);
@@ -185,7 +173,7 @@
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
static xmlParserInputPtr
-resolveEntityDebug(void *ctx UNUSED, const xmlChar *publicId, const xmlChar *systemId)
+resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
@@ -217,7 +205,7 @@
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
static xmlEntityPtr
-getEntityDebug(void *ctx UNUSED, const xmlChar *name)
+getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getEntity(%s)\n", name);
return(NULL);
@@ -233,7 +221,7 @@
* Returns the xmlParserInputPtr
*/
static xmlEntityPtr
-getParameterEntityDebug(void *ctx UNUSED, const xmlChar *name)
+getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
return(NULL);
@@ -252,7 +240,7 @@
* An entity definition has been parsed
*/
static void
-entityDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
+entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
{
fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@@ -268,9 +256,9 @@
* An attribute definition has been parsed
*/
static void
-attributeDeclDebug(void *ctx UNUSED, const xmlChar *elem, const xmlChar *name,
+attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *elem, const xmlChar *name,
int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree UNUSED)
+ xmlEnumerationPtr tree ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
elem, name, type, def, defaultValue);
@@ -286,8 +274,8 @@
* An element definition has been parsed
*/
static void
-elementDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
- xmlElementContentPtr content UNUSED)
+elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
+ xmlElementContentPtr content ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
@@ -303,7 +291,7 @@
* What to do when a notation declaration has been parsed.
*/
static void
-notationDeclDebug(void *ctx UNUSED, const xmlChar *name,
+notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId)
{
fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
@@ -321,7 +309,7 @@
* What to do when an unparsed entity declaration is parsed
*/
static void
-unparsedEntityDeclDebug(void *ctx UNUSED, const xmlChar *name,
+unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId,
const xmlChar *notationName)
{
@@ -339,7 +327,7 @@
* Everything is available on the context, so this is useless in our case.
*/
static void
-setDocumentLocatorDebug(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
+setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.setDocumentLocator()\n");
}
@@ -351,7 +339,7 @@
* called when the document start being processed.
*/
static void
-startDocumentDebug(void *ctx UNUSED)
+startDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.startDocument()\n");
}
@@ -363,7 +351,7 @@
* called when the document end has been detected.
*/
static void
-endDocumentDebug(void *ctx UNUSED)
+endDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.endDocument()\n");
}
@@ -376,7 +364,7 @@
* called when an opening tag has been processed.
*/
static void
-startElementDebug(void *ctx UNUSED, const xmlChar *name, const xmlChar **atts)
+startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
{
int i;
@@ -410,7 +398,7 @@
* called when the end of an element has been detected.
*/
static void
-endElementDebug(void *ctx UNUSED, const xmlChar *name)
+endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
}
@@ -425,7 +413,7 @@
* Question: how much at a time ???
*/
static void
-charactersDebug(void *ctx UNUSED, const xmlChar *ch, int len)
+charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
{
unsigned char output[40];
int inlen = len, outlen = 30;
@@ -446,7 +434,7 @@
* Question: how much at a time ???
*/
static void
-cdataDebug(void *ctx UNUSED, const xmlChar *ch, int len)
+cdataDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
{
unsigned char output[40];
int inlen = len, outlen = 30;
@@ -465,7 +453,7 @@
* called when an entity reference is detected.
*/
static void
-referenceDebug(void *ctx UNUSED, const xmlChar *name)
+referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.reference(%s)\n", name);
}
@@ -481,7 +469,7 @@
* Question: how much at a time ???
*/
static void
-ignorableWhitespaceDebug(void *ctx UNUSED, const xmlChar *ch, int len)
+ignorableWhitespaceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -503,7 +491,7 @@
* A processing instruction has been parsed.
*/
static void
-processingInstructionDebug(void *ctx UNUSED, const xmlChar *target,
+processingInstructionDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *target,
const xmlChar *data)
{
fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
@@ -518,7 +506,7 @@
* A comment has been parsed.
*/
static void
-commentDebug(void *ctx UNUSED, const xmlChar *value)
+commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
{
fprintf(stdout, "SAX.comment(%s)\n", value);
}
@@ -533,7 +521,7 @@
* extra parameters.
*/
static void
-warningDebug(void *ctx UNUSED, const char *msg, ...)
+warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -553,7 +541,7 @@
* extra parameters.
*/
static void
-errorDebug(void *ctx UNUSED, const char *msg, ...)
+errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -573,7 +561,7 @@
* extra parameters.
*/
static void
-fatalErrorDebug(void *ctx UNUSED, const char *msg, ...)
+fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
diff --git a/testSAX.c b/testSAX.c
index 51def37..8afafca 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -44,18 +44,6 @@
#include <libxml/debugXML.h>
#include <libxml/xmlmemory.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
static int debug = 0;
static int copy = 0;
static int recovery = 0;
@@ -110,7 +98,7 @@
* Returns 1 if true
*/
static int
-isStandaloneDebug(void *ctx UNUSED)
+isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.isStandalone()\n");
return(0);
@@ -125,7 +113,7 @@
* Returns 1 if true
*/
static int
-hasInternalSubsetDebug(void *ctx UNUSED)
+hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.hasInternalSubset()\n");
return(0);
@@ -140,7 +128,7 @@
* Returns 1 if true
*/
static int
-hasExternalSubsetDebug(void *ctx UNUSED)
+hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.hasExternalSubset()\n");
return(0);
@@ -153,7 +141,7 @@
* Does this document has an internal subset
*/
static void
-internalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
+internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID)
{
fprintf(stdout, "SAX.internalSubset(%s,", name);
@@ -174,7 +162,7 @@
* Does this document has an external subset
*/
static void
-externalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
+externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID)
{
fprintf(stdout, "SAX.externalSubset(%s,", name);
@@ -203,7 +191,7 @@
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
static xmlParserInputPtr
-resolveEntityDebug(void *ctx UNUSED, const xmlChar *publicId, const xmlChar *systemId)
+resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
@@ -235,7 +223,7 @@
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
static xmlEntityPtr
-getEntityDebug(void *ctx UNUSED, const xmlChar *name)
+getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getEntity(%s)\n", name);
return(NULL);
@@ -251,7 +239,7 @@
* Returns the xmlParserInputPtr
*/
static xmlEntityPtr
-getParameterEntityDebug(void *ctx UNUSED, const xmlChar *name)
+getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
return(NULL);
@@ -270,7 +258,7 @@
* An entity definition has been parsed
*/
static void
-entityDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
+entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
{
fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@@ -286,9 +274,9 @@
* An attribute definition has been parsed
*/
static void
-attributeDeclDebug(void *ctx UNUSED, const xmlChar *elem, const xmlChar *name,
+attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *elem, const xmlChar *name,
int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree UNUSED)
+ xmlEnumerationPtr tree ATTRIBUTE_UNUSED)
{
if (defaultValue == NULL)
fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n",
@@ -308,8 +296,8 @@
* An element definition has been parsed
*/
static void
-elementDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
- xmlElementContentPtr content UNUSED)
+elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
+ xmlElementContentPtr content ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
@@ -325,7 +313,7 @@
* What to do when a notation declaration has been parsed.
*/
static void
-notationDeclDebug(void *ctx UNUSED, const xmlChar *name,
+notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId)
{
fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
@@ -343,7 +331,7 @@
* What to do when an unparsed entity declaration is parsed
*/
static void
-unparsedEntityDeclDebug(void *ctx UNUSED, const xmlChar *name,
+unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId,
const xmlChar *notationName)
{
@@ -361,7 +349,7 @@
* Everything is available on the context, so this is useless in our case.
*/
static void
-setDocumentLocatorDebug(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
+setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.setDocumentLocator()\n");
}
@@ -373,7 +361,7 @@
* called when the document start being processed.
*/
static void
-startDocumentDebug(void *ctx UNUSED)
+startDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.startDocument()\n");
}
@@ -385,7 +373,7 @@
* called when the document end has been detected.
*/
static void
-endDocumentDebug(void *ctx UNUSED)
+endDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
{
fprintf(stdout, "SAX.endDocument()\n");
}
@@ -398,7 +386,7 @@
* called when an opening tag has been processed.
*/
static void
-startElementDebug(void *ctx UNUSED, const xmlChar *name, const xmlChar **atts)
+startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
{
int i;
@@ -421,7 +409,7 @@
* called when the end of an element has been detected.
*/
static void
-endElementDebug(void *ctx UNUSED, const xmlChar *name)
+endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
}
@@ -436,7 +424,7 @@
* Question: how much at a time ???
*/
static void
-charactersDebug(void *ctx UNUSED, const xmlChar *ch, int len)
+charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -456,7 +444,7 @@
* called when an entity reference is detected.
*/
static void
-referenceDebug(void *ctx UNUSED, const xmlChar *name)
+referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.reference(%s)\n", name);
}
@@ -472,7 +460,7 @@
* Question: how much at a time ???
*/
static void
-ignorableWhitespaceDebug(void *ctx UNUSED, const xmlChar *ch, int len)
+ignorableWhitespaceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -493,7 +481,7 @@
* A processing instruction has been parsed.
*/
static void
-processingInstructionDebug(void *ctx UNUSED, const xmlChar *target,
+processingInstructionDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *target,
const xmlChar *data)
{
fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
@@ -509,7 +497,7 @@
* called when a pcdata block has been parsed
*/
static void
-cdataBlockDebug(void *ctx UNUSED, const xmlChar *value, int len)
+cdataBlockDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value, int len)
{
fprintf(stdout, "SAX.pcdata(%.20s, %d)\n",
(char *) value, len);
@@ -523,7 +511,7 @@
* A comment has been parsed.
*/
static void
-commentDebug(void *ctx UNUSED, const xmlChar *value)
+commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
{
fprintf(stdout, "SAX.comment(%s)\n", value);
}
@@ -538,7 +526,7 @@
* extra parameters.
*/
static void
-warningDebug(void *ctx UNUSED, const char *msg, ...)
+warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -558,7 +546,7 @@
* extra parameters.
*/
static void
-errorDebug(void *ctx UNUSED, const char *msg, ...)
+errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -578,7 +566,7 @@
* extra parameters.
*/
static void
-fatalErrorDebug(void *ctx UNUSED, const char *msg, ...)
+fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
diff --git a/tree.c b/tree.c
index c68d773..12cc9a4 100644
--- a/tree.c
+++ b/tree.c
@@ -37,18 +37,6 @@
#include <libxml/valid.h>
#include <libxml/xmlerror.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
/************************************************************************
@@ -3620,7 +3608,7 @@
* namespace if defined
*/
xmlNsPtr *
-xmlGetNsList(xmlDocPtr doc UNUSED, xmlNodePtr node) {
+xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node) {
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
int nbns = 0;
@@ -5441,7 +5429,7 @@
*/
static void
xmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
- const char *encoding UNUSED) {
+ const char *encoding ATTRIBUTE_UNUSED) {
xmlChar *value;
if (cur == NULL) {
@@ -5798,7 +5786,7 @@
void
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
int * doc_txt_len, const char * txt_encoding,
- int format UNUSED) {
+ int format ATTRIBUTE_UNUSED) {
int dummy = 0;
xmlCharEncoding doc_charset;
diff --git a/valid.c b/valid.c
index 3ae61e2..6633c98 100644
--- a/valid.c
+++ b/valid.c
@@ -28,18 +28,6 @@
#include <libxml/xmlerror.h>
#include <libxml/list.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
/*
* Generic function for accessing stacks in the Validity Context
*/
@@ -862,7 +850,7 @@
*/
static void
xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list,
- const xmlChar* name UNUSED) {
+ const xmlChar* name ATTRIBUTE_UNUSED) {
attr->nexth = *list;
*list = attr;
}
@@ -1319,7 +1307,7 @@
* Returns NULL if not, othervise the entity
*/
xmlNotationPtr
-xmlAddNotationDecl(xmlValidCtxtPtr ctxt UNUSED, xmlDtdPtr dtd,
+xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *PublicID, const xmlChar *SystemID) {
xmlNotationPtr ret;
@@ -1793,7 +1781,7 @@
* Returns NULL if not, othervise the new xmlRefPtr
*/
xmlRefPtr
-xmlAddRef(xmlValidCtxtPtr ctxt UNUSED, xmlDocPtr doc, const xmlChar *value,
+xmlAddRef(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc, const xmlChar *value,
xmlAttrPtr attr) {
xmlRefPtr ret;
xmlRefTablePtr table;
@@ -2394,8 +2382,8 @@
*/
int
-xmlValidateNotationDecl(xmlValidCtxtPtr ctxt UNUSED, xmlDocPtr doc UNUSED,
- xmlNotationPtr nota UNUSED) {
+xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATTRIBUTE_UNUSED,
+ xmlNotationPtr nota ATTRIBUTE_UNUSED) {
int ret = 1;
return(ret);
@@ -2633,7 +2621,7 @@
static void
xmlValidateAttributeIdCallback(xmlAttributePtr attr, int *count,
- const xmlChar* name UNUSED) {
+ const xmlChar* name ATTRIBUTE_UNUSED) {
if (attr->atype == XML_ATTRIBUTE_ID) (*count)++;
}
@@ -3911,7 +3899,7 @@
static void
xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt,
- const xmlChar *name UNUSED) {
+ const xmlChar *name ATTRIBUTE_UNUSED) {
if (cur == NULL)
return;
switch (cur->atype) {
diff --git a/xmlIO.c b/xmlIO.c
index 5e72400..8aa0173 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -120,18 +120,6 @@
/************************************************************************
* *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
-/************************************************************************
- * *
* Standard I/O for file accesses *
* *
************************************************************************/
@@ -226,7 +214,7 @@
* Returns 1 if matches, 0 otherwise
*/
static int
-xmlFileMatch (const char *filename UNUSED) {
+xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
return(1);
}
@@ -369,7 +357,7 @@
* Returns 1 if matches, 0 otherwise
*/
static int
-xmlGzfileMatch (const char *filename UNUSED) {
+xmlGzfileMatch (const char *filename ATTRIBUTE_UNUSED) {
return(1);
}
diff --git a/xmlmemory.c b/xmlmemory.c
index dd695da..1cbeca2 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -33,18 +33,6 @@
#include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h>
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
void xmlMallocBreakpoint(void);
void * xmlMemMalloc(int size);
void * xmlMallocLoc(int size, const char * file, int line);
diff --git a/xmlversion.h.in b/xmlversion.h.in
index 71ab184..934dc7c 100644
--- a/xmlversion.h.in
+++ b/xmlversion.h.in
@@ -121,6 +121,15 @@
#endif
#endif
+#ifdef __GNUC__
+#include <ansidecl.h>
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/xpointer.c b/xpointer.c
index cfd3ee4..06165ae 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -15,18 +15,6 @@
#include "config.h"
#endif
-/************************************************************************
- * *
- * When running GCC in vaacum cleaner mode *
- * *
- ************************************************************************/
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
/**
* TODO: better handling of error cases, the full expression should
* be parsed beforehand instead of a progressive evaluation