[xml] minor declaration fixes for xpath2.c and xmlregexp.c in 2.6.17



Compiling 32-bit on HP-UX 11.11 with the HP ANSI C compiler gives:

cc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../include -I../../include -I./include -D_REENTRANT -g -Wp,-H30000 -c xpath2.c cc: "xpath2.c", line 67: warning 562: Redeclaration of "usage" with a different storage class specifier: "usage" will have internal linkage.

which seems to stem from the forward declaration of usage being static, but the actual definition not:

static void usage(const char *name);

...

void
usage(const char *name) {
    assert(name);

    fprintf(stderr, "Usage: %s <xml-file> <xpath-expr> <value>\n", name);
}

This:

$ diff -c xpath2.c.orig xpath2.c
*** xpath2.c.orig       Wed Mar  9 11:10:24 2005
--- xpath2.c    Wed Mar  9 11:10:30 2005
***************
*** 63,69 ****
   *
   * Prints usage information.
   */
! void
  usage(const char *name) {
      assert(name);

--- 63,69 ----
   *
   * Prints usage information.
   */
! static void
  usage(const char *name) {
      assert(name);

cleans that up nicely.

There are also some warnings about sendfile and sendpath, but I believe those are issues with the HP-UX include files and not the libxml2 source. It also seems to happen with HP-UX 11.23 so I will probably try to track it down a bit further - might be a matter of which #define's are set.

FWIW compilations on both HP-UX 11.11 and 11.23 (both using the HP ANSI compilers for that OS rev) complain about:

11.11:

cc -DHAVE_CONFIG_H -I. -I. -I. -I./include -I./include -D_REENTRANT -g -Wp,-H30000 -c xmlregexp.c -Wp,-M.deps/xmlregexp.TPlo +Z -DPIC -o .libs/xmlregexp.o
cc: "xmlregexp.c", line 3350: warning 604: Pointers are not assignment-compatible.
cc: "xmlregexp.c", line 3350: warning 563: Argument #5 is not the correct type.


11.23:

cc -DHAVE_CONFIG_H -I. -I. -I. -I./include -I./include -D_REENTRANT -g -Wp,-H30000 -c xmlregexp.c -DPIC -o .libs/xmlregexp.o Warning 942: "xmlregexp.c", line 3350 # Types 'unsigned char **' and 'const unsigned char **' are not assignment-compatible.
        xmlRegExecErrInfo(exec, &string, &nb, &nbneg, &values[0], &terminal);
                                                      ^

Where the code is:

#ifdef DEBUG_ERR
static void testerr(xmlRegExecCtxtPtr exec) {
    const xmlChar *string;
    const xmlChar *values[5];
    int nb = 5;
    int nbneg;
    int terminal;
    xmlRegExecErrInfo(exec, &string, &nb, &nbneg, &values[0], &terminal);
}
#endif


and xmlRegExecErrInfo is declared as:

int
xmlRegExecErrInfo(xmlRegExecCtxtPtr exec, const xmlChar **string,
                  int *nbval, int *nbneg, xmlChar **values, int *terminal) {


I'm guessing that since values is not assigned before calling xmlRegExecErrInfo it is indeed expecting the call to make a change to the values in values[0] and so the fix would be to drop the const:

$ diff -c ./xmlregexp.c.orig ./xmlregexp.c
*** ./xmlregexp.c.orig  Wed Mar  9 11:23:58 2005
--- ./xmlregexp.c       Wed Mar  9 11:24:05 2005
***************
*** 3343,3349 ****
  #ifdef DEBUG_ERR
  static void testerr(xmlRegExecCtxtPtr exec) {
      const xmlChar *string;
!     const xmlChar *values[5];
      int nb = 5;
      int nbneg;
      int terminal;
--- 3343,3349 ----
  #ifdef DEBUG_ERR
  static void testerr(xmlRegExecCtxtPtr exec) {
      const xmlChar *string;
!     xmlChar *values[5];
      int nb = 5;
      int nbneg;
      int terminal;

but that was just a guess and could easily be wrong.

That takes care of 11.11 compilation - I didn't yet try a run. There are some other things on 11.23 IPF (aka Itanium aka IA64) that probably belong under separate cover. They likely relate to there being no shl_load call for HP-UX IPF binaries - dlopen et al being the calls used. Dlopen et al are also available on later HP-UX PA-RISC releases, so it may be a matter of tweaking some configure stuff.

rick jones



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]