terminalstatic / go-xsd-validate

Xsd validation for go based on libxml2
MIT License
72 stars 18 forks source link

Deprecation and incompatible pointer type warning on new libxml2 versions #19

Closed WGH- closed 4 months ago

WGH- commented 6 months ago
# github.com/terminalstatic/go-xsd-validate
./libxml2.go: In function ‘cleanup’:
./libxml2.go:116:5: warning: ‘xmlSchemaCleanupTypes’ is deprecated [-Wdeprecated-declarations]
  116 |     xmlSchemaCleanupTypes();
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from ./libxml2.go:9:
/usr/include/libxml2/libxml/xmlschemastypes.h:37:17: note: declared here
   37 |                 xmlSchemaCleanupTypes           (void);
      |                 ^~~~~~~~~~~~~~~~~~~~~
./libxml2.go: In function ‘parseSchema’:
./libxml2.go:186:5: warning: ‘xmlLineNumbersDefault’ is deprecated [-Wdeprecated-declarations]
  186 |     xmlLineNumbersDefault(1);
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/libxml2/libxml/tree.h:17,
                 from /usr/include/libxml2/libxml/schemasInternals.h:24,
                 from /usr/include/libxml2/libxml/xmlschemastypes.h:19:
/usr/include/libxml2/libxml/parser.h:967:17: note: declared here
  967 |                 xmlLineNumbersDefault   (int val);
      |                 ^~~~~~~~~~~~~~~~~~~~~
./libxml2.go: In function ‘cParseDoc’:
./libxml2.go:247:5: warning: ‘xmlLineNumbersDefault’ is deprecated [-Wdeprecated-declarations]
  247 |     xmlLineNumbersDefault(1);
      |     ^~~~~~~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/parser.h:967:17: note: declared here
  967 |                 xmlLineNumbersDefault   (int val);
      |                 ^~~~~~~~~~~~~~~~~~~~~
./libxml2.go: In function ‘cValidate’:
./libxml2.go:300:5: warning: ‘xmlLineNumbersDefault’ is deprecated [-Wdeprecated-declarations]
  300 |     xmlLineNumbersDefault(1);
      |     ^~~~~~~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/parser.h:967:17: note: declared here
  967 |                 xmlLineNumbersDefault   (int val);
      |                 ^~~~~~~~~~~~~~~~~~~~~
./libxml2.go:328:59: warning: passing argument 2 of ‘xmlSchemaSetValidStructuredErrors’ from incompatible pointer type [-Wincompatible-pointer-types]
  328 |             xmlSchemaSetValidStructuredErrors(schemaCtxt, simpleStructErrorCallback,
      |                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                           |
      |                                                           void (*)(void *, xmlError *) {aka void (*)(void *, struct _xmlError *)}
In file included from /usr/include/libxml2/libxml/xmlschemastypes.h:20:
/usr/include/libxml2/libxml/xmlschemas.h:185:65: note: expected ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void *, const struct _xmlError *)’} but argument is of type ‘void (*)(void *, xmlError *)’ {aka ‘void (*)(void *, struct _xmlError *)’}
  185 |                                          xmlStructuredErrorFunc serror,
      |                                          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
./libxml2.go: In function ‘cValidateBuf’:
./libxml2.go:353:5: warning: ‘xmlLineNumbersDefault’ is deprecated [-Wdeprecated-declarations]
  353 |     xmlLineNumbersDefault(1);
      |     ^~~~~~~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/parser.h:967:17: note: declared here
  967 |                 xmlLineNumbersDefault   (int val);
      |                 ^~~~~~~~~~~~~~~~~~~~~

These changes seem to appear in 2.12.0.

I'll submit a PR shortly.