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 751410 - compile warning in timsort.h passing sizeof through %lu
compile warning in timsort.h passing sizeof through %lu
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-23 20:21 UTC by Scott Graham
Modified: 2016-10-12 11:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix -- use PRIuS instead (969 bytes, patch)
2015-06-23 20:21 UTC, Scott Graham
none Details | Review
perhaps simpler fix (735 bytes, patch)
2015-06-23 21:23 UTC, Scott Graham
none Details | Review

Description Scott Graham 2015-06-23 20:21:16 UTC
Created attachment 305959 [details] [review]
Proposed fix -- use PRIuS instead

Triggers on Windows x64 clang builds:

FAILED: ninja -t msvc -e environment.x64 -- "..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl" -m64 /nologo /showIncludes /FC @obj\third_party\libxml\src\libxml.xpath.obj.rsp /c ..\..\third_party\libxml\src\xpath.c /Foobj\third_party\libxml\src\libxml.xpath.obj /Fdobj\third_party\libxml\libxml.c.pdb 
In file included from ..\..\third_party\libxml\src\xpath.c:462:
..\..\third_party\libxml\src/timsort.h(326,90) :  error: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Werror,-Wformat]
      fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", sizeof(SORT_TYPE) * new_size);
                                                                             ~~~         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                             %llu
1 error generated.
ninja: build stopped: subcommand failed.
Comment 1 Scott Graham 2015-06-23 20:28:16 UTC
(Would print the wrong thing at runtime as-is. But maybe it's unreachable in libxml's usage anyway since it exit(1)s after that.)
Comment 2 Scott Graham 2015-06-23 21:22:43 UTC
It seems PRIuS isn't widely available.

Maybe using %llu and then (unsigned long long)(sizeof(SORT_TYPE) * new_size) would be simpler.
Comment 3 Scott Graham 2015-06-23 21:23:26 UTC
Created attachment 305962 [details] [review]
perhaps simpler fix
Comment 4 Nick Wellnhofer 2016-10-12 11:46:47 UTC
Fixed with the following commit:

https://git.gnome.org/browse/libxml2/commit/?id=c2545cbb6d9a87e3e0bce167eabcb8f3c9153edc