Closed
Bug 1256559
Opened 9 years ago
Closed 9 years ago
intl/locale/windows/nsWin32Locale.cpp(736): warning C4477: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'size_t'
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: gps, Assigned: smontagu)
References
Details
Attachments
(1 file, 3 obsolete files)
Seeing multiple compiler warnings turned into errors when running Visual Studio 2015 Update 1 in automation.
22:58:57 INFO - nsWin32Locale.cpp
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): error C2220: warning treated as error - no 'object' file generated
22:58:57 INFO - Warning: C4477 in c:\builds\moz2_slave\try-w64-d-00000000000000000000\build\src\intl\locale\windows\nsWin32Locale.cpp: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): warning C4477: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): note: consider using '%zd' in the format string
22:58:57 INFO - Warning: C4477 in c:\builds\moz2_slave\try-w64-d-00000000000000000000\build\src\intl\locale\windows\nsWin32Locale.cpp: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 2 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): warning C4477: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 2 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(736): note: consider using '%zd' in the format string
22:58:57 INFO - Warning: C4477 in c:\builds\moz2_slave\try-w64-d-00000000000000000000\build\src\intl\locale\windows\nsWin32Locale.cpp: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(740): warning C4477: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'size_t'
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(740): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/intl/locale/windows/nsWin32Locale.cpp(740): note: consider using '%zd' in the format string
22:58:57 INFO - c:/builds/moz2_slave/try-w64-d-00000000000000000000/build/src/config/rules.mk:930: recipe for target 'nsWin32Locale.obj' failed
Reporter | ||
Comment 1•9 years ago
|
||
As part of unblocking building with VS2015u1 in automation, I'm mass
disabling compiler warnings that are turned into errors. This is not
the preferred mechanism to fix compilation warnings. So hopefully
this patch never lands because someone insists on fixing the underlying
problem instead. But if it does land, hopefully the workaround is
only temporary.
Review commit: https://reviewboard.mozilla.org/r/39999/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/39999/
Attachment #8730560 -
Flags: review?(smontagu)
Assignee | ||
Comment 2•9 years ago
|
||
Comment on attachment 8730560 [details]
MozReview Request: Bug 1256559 - Disable C4477 to unblock compilation on VS2015; r?smontagu
https://reviewboard.mozilla.org/r/39999/#review36775
Attachment #8730560 -
Flags: review?(smontagu) → review+
Assignee | ||
Comment 3•9 years ago
|
||
I can't easily compile on Windows, but shouldn't this be enough to prevent the warning?
Attachment #8730945 -
Flags: review?(gps)
Reporter | ||
Comment 4•9 years ago
|
||
Comment on attachment 8730945 [details] [diff] [review]
Remove the warning by using %zd like the man said
Review of attachment 8730945 [details] [diff] [review]:
-----------------------------------------------------------------
I haven't touched C++ in a very, very long time. So I'm not appropriate to review this.
But I can push this patch to Try and let you know if it works.
Reporter | ||
Comment 5•9 years ago
|
||
Reporter | ||
Comment 6•9 years ago
|
||
Comment on attachment 8730945 [details] [diff] [review]
Remove the warning by using %zd like the man said
Review of attachment 8730945 [details] [diff] [review]:
-----------------------------------------------------------------
https://treeherder.mozilla.org/logviewer.html#?job_id=18126620&repo=try says this patch failed to clear the warning.
Attachment #8730945 -
Flags: review?(gps) → review-
Assignee | ||
Comment 7•9 years ago
|
||
But it does remove two warnings, so this version should clear the third one.
Assignee: nobody → smontagu
Attachment #8730945 -
Attachment is obsolete: true
Attachment #8731073 -
Flags: feedback?(gps)
Reporter | ||
Comment 8•9 years ago
|
||
Reporter | ||
Comment 9•9 years ago
|
||
Comment on attachment 8731073 [details] [diff] [review]
Remove the warning by using %zd like the man said ,v.2
Review of attachment 8731073 [details] [diff] [review]:
-----------------------------------------------------------------
This seems to have eliminated the warnings!
I'll drop my review requests. Please get review and land this ASAP to unblock VS2015.
Thank you for insisting on the proper fix.
Attachment #8731073 -
Flags: feedback?(gps) → feedback+
Reporter | ||
Updated•9 years ago
|
Attachment #8730560 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Attachment #8731073 -
Flags: review?(jfkthame)
Comment 10•9 years ago
|
||
Comment on attachment 8731073 [details] [diff] [review]
Remove the warning by using %zd like the man said ,v.2
Review of attachment 8731073 [details] [diff] [review]:
-----------------------------------------------------------------
Does this work on VS2013? AFAICT, it probably won't...
https://connect.microsoft.com/VisualStudio/feedback/details/806338/vc-printf-and-scanf-should-support-z
So are we totally dropping VS2013 support at this point? If not, we need an alternative solution. (Given where this is being used, I'd think that just casting the size_t to an unsigned int and printing it with %u would be fine.)
Reporter | ||
Comment 11•9 years ago
|
||
I'm not sure when we're dropping VS2013. But I know people are anxious to do that so we can adopt more modern C++ features.
Code will need to work with both VS2013 and VS2015 for the interim. Or you can disable the warning.
Comment 12•9 years ago
|
||
This should avoid the warnings, while remaining compatible with older VS releases (lacking %z). The numbers involved here will never be large enough to exceed a plain 'unsigned' value.
Attachment #8732815 -
Flags: review?(smontagu)
Attachment #8732815 -
Flags: review?(smontagu) → review+
Comment 13•9 years ago
|
||
Updated•9 years ago
|
Attachment #8731073 -
Attachment is obsolete: true
Attachment #8731073 -
Flags: review?(jfkthame)
Comment 14•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•