From 69746f5ab29f3c2813bf56ccd928009914d1c8c7 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sat, 7 May 2016 16:45:58 +0200 Subject: [PATCH] Address all "unused parameter" warnings --- expat/examples/elements.c | 7 ++ expat/examples/outline.c | 7 ++ expat/lib/internal.h | 8 ++ expat/lib/xmlparse.c | 6 +- expat/lib/xmlrole.c | 220 +++++++++++++++++++------------------- expat/lib/xmltok.c | 30 +++--- expat/lib/xmltok_impl.c | 10 +- expat/tests/minicheck.c | 3 +- expat/tests/runtests.c | 107 +++++++++--------- expat/xmlwf/codepage.c | 5 +- expat/xmlwf/xmlfile.c | 5 +- expat/xmlwf/xmlwf.c | 39 +++---- 12 files changed, 237 insertions(+), 210 deletions(-) diff --git a/expat/examples/elements.c b/expat/examples/elements.c index bc04b6b1..0ca1abd9 100644 --- a/expat/examples/elements.c +++ b/expat/examples/elements.c @@ -27,6 +27,8 @@ startElement(void *userData, const char *name, const char **atts) { int i; int *depthPtr = (int *)userData; + (void)atts; + for (i = 0; i < *depthPtr; i++) putchar('\t'); puts(name); @@ -37,6 +39,8 @@ static void XMLCALL endElement(void *userData, const char *name) { int *depthPtr = (int *)userData; + (void)name; + *depthPtr -= 1; } @@ -47,6 +51,9 @@ main(int argc, char *argv[]) XML_Parser parser = XML_ParserCreate(NULL); int done; int depth = 0; + (void)argc; + (void)argv; + XML_SetUserData(parser, &depth); XML_SetElementHandler(parser, startElement, endElement); do { diff --git a/expat/examples/outline.c b/expat/examples/outline.c index 3a3c8385..d9b09176 100644 --- a/expat/examples/outline.c +++ b/expat/examples/outline.c @@ -49,6 +49,7 @@ static void XMLCALL start(void *data, const char *el, const char **attr) { int i; + (void)data; for (i = 0; i < Depth; i++) printf(" "); @@ -66,6 +67,9 @@ start(void *data, const char *el, const char **attr) static void XMLCALL end(void *data, const char *el) { + (void)data; + (void)el; + Depth--; } @@ -73,6 +77,9 @@ int main(int argc, char *argv[]) { XML_Parser p = XML_ParserCreate(NULL); + (void)argc; + (void)argv; + if (! p) { fprintf(stderr, "Couldn't allocate memory for parser\n"); exit(-1); diff --git a/expat/lib/internal.h b/expat/lib/internal.h index dd545483..8eb71900 100644 --- a/expat/lib/internal.h +++ b/expat/lib/internal.h @@ -71,3 +71,11 @@ #define inline #endif #endif + +#ifndef UNUSED_P +# ifdef __GNUC__ +# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) +# else +# define UNUSED_P(p) UNUSED_ ## p +# endif +#endif diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index c0e8f6e2..7586b240 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -4960,9 +4960,9 @@ internalEntityProcessor(XML_Parser parser, static enum XML_Error PTRCALL errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) + const char *UNUSED_P(s), + const char *UNUSED_P(end), + const char **UNUSED_P(nextPtr)) { return errorCode; } diff --git a/expat/lib/xmlrole.c b/expat/lib/xmlrole.c index f6e66ab6..4e79ffdf 100644 --- a/expat/lib/xmlrole.c +++ b/expat/lib/xmlrole.c @@ -195,9 +195,9 @@ prolog1(PROLOG_STATE *state, static int PTRCALL prolog2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -216,9 +216,9 @@ prolog2(PROLOG_STATE *state, static int PTRCALL doctype0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -264,9 +264,9 @@ doctype1(PROLOG_STATE *state, static int PTRCALL doctype2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -281,9 +281,9 @@ doctype2(PROLOG_STATE *state, static int PTRCALL doctype3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -298,9 +298,9 @@ doctype3(PROLOG_STATE *state, static int PTRCALL doctype4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -318,9 +318,9 @@ doctype4(PROLOG_STATE *state, static int PTRCALL doctype5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -437,9 +437,9 @@ externalSubset1(PROLOG_STATE *state, static int PTRCALL entity0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -457,9 +457,9 @@ entity0(PROLOG_STATE *state, static int PTRCALL entity1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -502,9 +502,9 @@ entity2(PROLOG_STATE *state, static int PTRCALL entity3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -519,9 +519,9 @@ entity3(PROLOG_STATE *state, static int PTRCALL entity4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -559,9 +559,9 @@ entity5(PROLOG_STATE *state, static int PTRCALL entity6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -605,9 +605,9 @@ entity7(PROLOG_STATE *state, static int PTRCALL entity8(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -622,9 +622,9 @@ entity8(PROLOG_STATE *state, static int PTRCALL entity9(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -639,9 +639,9 @@ entity9(PROLOG_STATE *state, static int PTRCALL entity10(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -656,9 +656,9 @@ entity10(PROLOG_STATE *state, static int PTRCALL notation0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -697,9 +697,9 @@ notation1(PROLOG_STATE *state, static int PTRCALL notation2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -714,9 +714,9 @@ notation2(PROLOG_STATE *state, static int PTRCALL notation3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -732,9 +732,9 @@ notation3(PROLOG_STATE *state, static int PTRCALL notation4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -753,9 +753,9 @@ notation4(PROLOG_STATE *state, static int PTRCALL attlist0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -771,9 +771,9 @@ attlist0(PROLOG_STATE *state, static int PTRCALL attlist1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -833,9 +833,9 @@ attlist2(PROLOG_STATE *state, static int PTRCALL attlist3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -852,9 +852,9 @@ attlist3(PROLOG_STATE *state, static int PTRCALL attlist4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -872,9 +872,9 @@ attlist4(PROLOG_STATE *state, static int PTRCALL attlist5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -889,9 +889,9 @@ attlist5(PROLOG_STATE *state, static int PTRCALL attlist6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -906,9 +906,9 @@ attlist6(PROLOG_STATE *state, static int PTRCALL attlist7(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -967,9 +967,9 @@ attlist8(PROLOG_STATE *state, static int PTRCALL attlist9(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -984,9 +984,9 @@ attlist9(PROLOG_STATE *state, static int PTRCALL element0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1072,9 +1072,9 @@ element2(PROLOG_STATE *state, static int PTRCALL element3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1097,9 +1097,9 @@ element3(PROLOG_STATE *state, static int PTRCALL element4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1115,9 +1115,9 @@ element4(PROLOG_STATE *state, static int PTRCALL element5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1136,9 +1136,9 @@ element5(PROLOG_STATE *state, static int PTRCALL element6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1166,9 +1166,9 @@ element6(PROLOG_STATE *state, static int PTRCALL element7(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1240,9 +1240,9 @@ condSect0(PROLOG_STATE *state, static int PTRCALL condSect1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1258,9 +1258,9 @@ condSect1(PROLOG_STATE *state, static int PTRCALL condSect2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1277,9 +1277,9 @@ condSect2(PROLOG_STATE *state, static int PTRCALL declClose(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1292,11 +1292,11 @@ declClose(PROLOG_STATE *state, } static int PTRCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) +error(PROLOG_STATE *UNUSED_P(state), + int UNUSED_P(tok), + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { return XML_ROLE_NONE; } diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c index 814fe92c..9a8e3adb 100644 --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -122,19 +122,19 @@ ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) static int PTRFASTCALL -isNever(const ENCODING *enc, const char *p) +isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p)) { return 0; } static int PTRFASTCALL -utf8_isName2(const ENCODING *enc, const char *p) +utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isName3(const ENCODING *enc, const char *p) +utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); } @@ -142,13 +142,13 @@ utf8_isName3(const ENCODING *enc, const char *p) #define utf8_isName4 isNever static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) +utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) +utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); } @@ -156,19 +156,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p) #define utf8_isNmstrt4 isNever static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) +utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID2((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) +utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID3((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) +utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID4((const unsigned char *)p); } @@ -330,7 +330,7 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ }; static void PTRCALL -utf8_toUtf8(const ENCODING *enc, +utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { @@ -437,7 +437,7 @@ static const struct normal_encoding internal_utf8_encoding = { }; static void PTRCALL -latin1_toUtf8(const ENCODING *enc, +latin1_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { @@ -462,7 +462,7 @@ latin1_toUtf8(const ENCODING *enc, } static void PTRCALL -latin1_toUtf16(const ENCODING *enc, +latin1_toUtf16(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { @@ -495,7 +495,7 @@ static const struct normal_encoding latin1_encoding = { }; static void PTRCALL -ascii_toUtf8(const ENCODING *enc, +ascii_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { @@ -548,7 +548,7 @@ unicode_byte_type(char hi, char lo) #define DEFINE_UTF16_TO_UTF8(E) \ static void PTRCALL \ -E ## toUtf8(const ENCODING *enc, \ +E ## toUtf8(const ENCODING *UNUSED_P(enc), \ const char **fromP, const char *fromLim, \ char **toP, const char *toLim) \ { \ @@ -611,7 +611,7 @@ E ## toUtf8(const ENCODING *enc, \ #define DEFINE_UTF16_TO_UTF16(E) \ static void PTRCALL \ -E ## toUtf16(const ENCODING *enc, \ +E ## toUtf16(const ENCODING *UNUSED_P(enc), \ const char **fromP, const char *fromLim, \ unsigned short **toP, const unsigned short *toLim) \ { \ @@ -949,7 +949,7 @@ streqci(const char *s1, const char *s2) } static void PTRCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, +initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, POSITION *pos) { normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); diff --git a/expat/lib/xmltok_impl.c b/expat/lib/xmltok_impl.c index 9c2895b8..bddec76f 100644 --- a/expat/lib/xmltok_impl.c +++ b/expat/lib/xmltok_impl.c @@ -175,7 +175,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, +PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, int *tokPtr) { int upper = 0; @@ -282,7 +282,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, +PREFIX(scanCdataSection)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, const char **nextTokPtr) { static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A, @@ -1521,7 +1521,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, } static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) +PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) { int result = 0; /* skip &# */ @@ -1565,7 +1565,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) } static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, +PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end) { switch ((end - ptr)/MINBPC(enc)) { @@ -1683,7 +1683,7 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) } static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, +PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1, const char *end1, const char *ptr2) { for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { diff --git a/expat/tests/minicheck.c b/expat/tests/minicheck.c index f745b509..5a1f5ed0 100644 --- a/expat/tests/minicheck.c +++ b/expat/tests/minicheck.c @@ -10,6 +10,7 @@ #include #include +#include "internal.h" /* for UNUSED_P only */ #include "minicheck.h" Suite * @@ -156,7 +157,7 @@ srunner_run_all(SRunner *runner, int verbosity) } void -_fail_unless(int condition, const char *file, int line, const char *msg) +_fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(line), const char *msg) { /* Always print the error message so it isn't lost. In this case, we have a failure, so there's no reason to be quiet about what diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index a8a6cc26..45adfa5a 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -16,6 +16,7 @@ #include "expat.h" #include "chardata.h" +#include "internal.h" /* for UNUSED_P only */ #include "minicheck.h" #if defined(__amigaos__) && defined(__USE_INLINE__) @@ -110,63 +111,63 @@ _expect_failure(const char *text, enum XML_Error errorCode, const char *errorMes */ static void XMLCALL -dummy_start_doctype_handler(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) +dummy_start_doctype_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(doctypeName), + const XML_Char *UNUSED_P(sysid), + const XML_Char *UNUSED_P(pubid), + int UNUSED_P(has_internal_subset)) {} static void XMLCALL -dummy_end_doctype_handler(void *userData) +dummy_end_doctype_handler(void *UNUSED_P(userData)) {} static void XMLCALL -dummy_entity_decl_handler(void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) +dummy_entity_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(entityName), + int UNUSED_P(is_parameter_entity), + const XML_Char *UNUSED_P(value), + int UNUSED_P(value_length), + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId), + const XML_Char *UNUSED_P(notationName)) {} static void XMLCALL -dummy_notation_decl_handler(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) +dummy_notation_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(notationName), + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) {} static void XMLCALL -dummy_element_decl_handler(void *userData, - const XML_Char *name, - XML_Content *model) +dummy_element_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(name), + XML_Content *UNUSED_P(model)) {} static void XMLCALL -dummy_attlist_decl_handler(void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired) +dummy_attlist_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(elname), + const XML_Char *UNUSED_P(attname), + const XML_Char *UNUSED_P(att_type), + const XML_Char *UNUSED_P(dflt), + int UNUSED_P(isrequired)) {} static void XMLCALL -dummy_comment_handler(void *userData, const XML_Char *data) +dummy_comment_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(data)) {} static void XMLCALL -dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data) +dummy_pi_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), const XML_Char *UNUSED_P(data)) {} static void XMLCALL -dummy_start_element(void *userData, - const XML_Char *name, const XML_Char **atts) +dummy_start_element(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) {} @@ -231,7 +232,7 @@ accumulate_characters(void *userData, const XML_Char *s, int len) } static void XMLCALL -accumulate_attribute(void *userData, const XML_Char *name, +accumulate_attribute(void *userData, const XML_Char *UNUSED_P(name), const XML_Char **atts) { CharData *storage = (CharData *)userData; @@ -465,7 +466,7 @@ END_TEST static void XMLCALL start_element_event_handler2(void *userData, const XML_Char *name, - const XML_Char **attr) + const XML_Char **UNUSED_P(attr)) { CharData *storage = (CharData *) userData; char buffer[100]; @@ -700,8 +701,8 @@ testhelper_is_whitespace_normalized(void) } static void XMLCALL -check_attr_contains_normalized_whitespace(void *userData, - const XML_Char *name, +check_attr_contains_normalized_whitespace(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(name), const XML_Char **atts) { int i; @@ -761,7 +762,7 @@ END_TEST /* Regression test for SF bug #584832. */ static int XMLCALL -UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info) +UnknownEncodingHandler(void *UNUSED_P(data),const XML_Char *encoding,XML_Encoding *info) { if (strcmp(encoding,"unsupported-encoding") == 0) { int i; @@ -792,9 +793,9 @@ END_TEST static int XMLCALL external_entity_loader_set_encoding(XML_Parser parser, const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) { /* This text says it's an unsupported encoding, but it's really UTF-8, which we tell Expat using XML_SetEncoding(). @@ -872,9 +873,9 @@ END_TEST static int XMLCALL external_entity_loader(XML_Parser parser, const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) { char *text = (char *)XML_GetUserData(parser); XML_Parser extparser; @@ -1033,8 +1034,8 @@ static const char *long_character_data_text = static XML_Bool resumable = XML_FALSE; static void -clearing_aborting_character_handler(void *userData, - const XML_Char *s, int len) +clearing_aborting_character_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(s), int UNUSED_P(len)) { XML_StopParser(parser, resumable); XML_SetCharacterDataHandler(parser, NULL); @@ -1332,8 +1333,8 @@ END_TEST /* Regression test for SF bug #620343. */ static void XMLCALL -start_element_fail(void *userData, - const XML_Char *name, const XML_Char **atts) +start_element_fail(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) { /* We should never get here. */ fail("should never reach start_element_fail()"); @@ -1341,8 +1342,8 @@ start_element_fail(void *userData, static void XMLCALL start_ns_clearing_start_element(void *userData, - const XML_Char *prefix, - const XML_Char *uri) + const XML_Char *UNUSED_P(prefix), + const XML_Char *UNUSED_P(uri)) { XML_SetStartElementHandler((XML_Parser) userData, NULL); } @@ -1367,9 +1368,9 @@ END_TEST static int XMLCALL external_entity_handler(XML_Parser parser, const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) { intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser); const char *text; diff --git a/expat/xmlwf/codepage.c b/expat/xmlwf/codepage.c index 57e48ff2..91bd15e9 100644 --- a/expat/xmlwf/codepage.c +++ b/expat/xmlwf/codepage.c @@ -3,6 +3,7 @@ */ #include "codepage.h" +#include "internal.h" /* for UNUSED_P only */ #if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) #define STRICT 1 @@ -54,13 +55,13 @@ codepageConvert(int cp, const char *p) #else /* not WIN32 */ int -codepageMap(int cp, int *map) +codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) { return 0; } int -codepageConvert(int cp, const char *p) +codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) { return -1; } diff --git a/expat/xmlwf/xmlfile.c b/expat/xmlwf/xmlfile.c index 86880f2c..010036d9 100644 --- a/expat/xmlwf/xmlfile.c +++ b/expat/xmlwf/xmlfile.c @@ -21,6 +21,7 @@ #endif /* ndef COMPILING_FOR_WINDOWS */ #include "expat.h" +#include "internal.h" /* for UNUSED_P only */ #include "xmlfile.h" #include "xmltchar.h" #include "filemap.h" @@ -132,7 +133,7 @@ externalEntityRefFilemap(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *UNUSED_P(publicId)) { int result; XML_Char *s; @@ -200,7 +201,7 @@ externalEntityRefStream(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *UNUSED_P(publicId)) { XML_Char *s; const XML_Char *filename; diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c index c4090b0e..360acb50 100644 --- a/expat/xmlwf/xmlwf.c +++ b/expat/xmlwf/xmlwf.c @@ -9,6 +9,7 @@ #include "expat.h" #include "codepage.h" +#include "internal.h" /* for UNUSED_P only */ #include "xmlfile.h" #include "xmltchar.h" @@ -248,49 +249,49 @@ processingInstruction(void *userData, const XML_Char *target, #endif /* not W3C14N */ static void XMLCALL -defaultCharacterData(void *userData, const XML_Char *s, int len) +defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len)) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL -defaultStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) +defaultStartElement(void *userData, const XML_Char *UNUSED_P(name), + const XML_Char **UNUSED_P(atts)) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL -defaultEndElement(void *userData, const XML_Char *name) +defaultEndElement(void *userData, const XML_Char *UNUSED_P(name)) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL -defaultProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) +defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target), + const XML_Char *UNUSED_P(data)) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL -nopCharacterData(void *userData, const XML_Char *s, int len) +nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len)) { } static void XMLCALL -nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) +nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) { } static void XMLCALL -nopEndElement(void *userData, const XML_Char *name) +nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name)) { } static void XMLCALL -nopProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) +nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), + const XML_Char *UNUSED_P(data)) { } @@ -434,9 +435,9 @@ metaCharacterData(void *userData, const XML_Char *s, int len) static void XMLCALL metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) + const XML_Char *UNUSED_P(sysid), + const XML_Char *UNUSED_P(pubid), + int UNUSED_P(has_internal_subset)) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); @@ -458,7 +459,7 @@ metaEndDoctypeDecl(void *userData) static void XMLCALL metaNotationDecl(void *userData, const XML_Char *notationName, - const XML_Char *base, + const XML_Char *UNUSED_P(base), const XML_Char *systemId, const XML_Char *publicId) { @@ -480,10 +481,10 @@ metaNotationDecl(void *userData, static void XMLCALL metaEntityDecl(void *userData, const XML_Char *entityName, - int is_param, + int UNUSED_P(is_param), const XML_Char *value, int value_length, - const XML_Char *base, + const XML_Char *UNUSED_P(base), const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName) @@ -558,7 +559,7 @@ unknownEncodingConvert(void *data, const char *p) } static int XMLCALL -unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) +unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info) { int cp; static const XML_Char prefixL[] = T("windows-"); @@ -594,7 +595,7 @@ unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) } static int XMLCALL -notStandalone(void *userData) +notStandalone(void *UNUSED_P(userData)) { return 0; }