GNOME Bugzilla – Bug 68748
xmllint doesn't compile in VC++6
Last modified: 2009-08-15 18:40:50 UTC
The new code added to xmllint.c to add timing information fails when compiled in MS VC++6 with the following errors: Compiling... xmllint.c C:\libxml\libxml2-2.4.13\xmllint.c(176) : error C2061: syntax error : identifier 'begin' C:\libxml\libxml2-2.4.13\xmllint.c(176) : error C2059: syntax error : ';' C:\libxml\libxml2-2.4.13\xmllint.c(176) : error C2059: syntax error : ',' C:\libxml\libxml2-2.4.13\xmllint.c(180) : error C2065: 'begin' : undeclared identifier C:\libxml\libxml2-2.4.13\xmllint.c(180) : warning C4013: 'clock' undefined; assuming extern returning int C:\libxml\libxml2-2.4.13\xmllint.c(188) : error C2065: 'end' : undeclared identifier C:\libxml\libxml2-2.4.13\xmllint.c(189) : error C2065: 'CLOCKS_PER_SEC' : undeclared identifier C:\libxml\libxml2-2.4.13\xmllint.c(192) : fatal error C1189: #error : "endTimer required stdarg functions" Error executing cl.exe. xmllint.exe - 7 error(s), 1 warning(s)
I propose the addition of an include of time.h in the xmllint.c to ensure that some form of time handling is included. My understanding is that under VC++ the gettimeofday function is not present. The above report implies that on the platform in question : HAVE_TIME_H is defined HAVE_GETTIMEOFDAY is undefined I infer from the platform description that _WIN32 and _MSC_VER are both defined, and that __CYGWIN__ is undefined. From this, I believe that the header should have an include of <time.h>. I do not have VC++; this is inference by the above examples.
Created attachment 6411 [details] [review] Proposed fix for time handling with xmllint on VC++6; untested but inferred by previous comments.
There is a second issue in this report; that of the 'endTimer required stdarg functions'. There is, in my local copy of the VC++ headers a stdarg.h and therefore I would have assumed that HAVE_STDARG_H would be defined for the windows version of the compiler (stdarg.h being a standard C header). There may be linkage issues involved in using stdarg for which I am unaware. If there are not, HAVE_STDARG_H should be added to win32config.h. Again, this is inferred, rather than tested.
Created attachment 6412 [details] [review] Patch for win32config.h, adding HAVE_STDARG_H.
Okay, I have applied both patches, they look harmless anyway, thanks Daniel
I hope libxml2-2.4.15 fixes the problem, thanks, Daniel