After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737937 - Visual Studio 14 CTP defines snprintf()
Visual Studio 14 CTP defines snprintf()
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Windows
: Normal blocker
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-05 18:04 UTC by Francis Dupont
Modified: 2014-10-13 07:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
win32config.h patch (364 bytes, application/octet-stream)
2014-10-05 18:04 UTC, Francis Dupont
Details

Description Francis Dupont 2014-10-05 18:04:36 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.
Comment 1 Francis Dupont 2014-10-05 18:07:06 UTC
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.
Comment 2 Daniel Veillard 2014-10-13 07:19:15 UTC
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