GNOME Bugzilla – Bug 737937
Visual Studio 14 CTP defines snprintf()
Last modified: 2014-10-13 07:19:15 UTC
Created attachment 287773 [details] win32config.h patch Visual Studio 14 CTP (the VS which comes with Windows 10) defines snprintf(). It could be seen as a good idea as snprintf() is part of the C99 standard but unfortunately libxml2 as many packages defines snprintf as _snprintf, the function to use for any previous versions of the Visual Studio runtime. More, to avoid hiding/shadowing snprintf() declaration in stdio.h is protected by an "#ifdef snprintf" followed by an "#error", so compilation fails. Cf. http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx But the fix is easy: the corresponding C/C++ compiler defines _MSC_VER to 1900 so it is enough to guard the snprintf define against it, cf. the attached patch for win32config.h (from 2.9.1 "latest" tarball). BTW I checked only libxml2 because I only needed it but IMHO there could be other occurrences of the same issue in other packages managed by you.
I put the CVS for the version because bugzilla doesn't propose recent versions but my report is about the 2.9.1 "latest" version. Of course it should apply to older (and still supported) versions too.
Okay, looks fine and applied without troubles so it's now commited: https://git.gnome.org/browse/libxml2/commit/?id=12fd65434037d50429587792ed2e7e98f2fb739b I also chased similar redefined in libxslt and patch those too https://git.gnome.org/browse/libxslt/commit/?id=73e08bf7c36a9145d38f51d37e66529b873c011a thanks ! Daniel