Closed
Bug 1256027
Opened 8 years ago
Closed 8 years ago
C4477 snwprintf format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'char16ptr_t'
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
FIXED
People
(Reporter: gps, Assigned: Waldo)
References
Details
Attachments
(2 files, 1 obsolete file)
The following warnings in toolkit/xre are currently getting suppressed by Visual Studio 2015. To reproduce them, remove "-Wv:18" from old-configure.in and rebuild. toolkit/xre/nsNativeAppSupportWin.cpp:508 [C4477] '_snwprintf' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'char16ptr_t' toolkit/xre/nsNativeAppSupportWin.cpp:670 [C4477] '_snwprintf' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 2 has type 'char16ptr_t' toolkit/xre/nsWindowsRestart.cpp:292 [C4477] 'wprintf' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'LPVOID'
Reporter | ||
Comment 1•8 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/39947/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/39947/
Attachment #8730495 -
Flags: review?(benjamin)
Reporter | ||
Comment 2•8 years ago
|
||
Comment on attachment 8730495 [details] MozReview Request: Bug 1256027 - Disable C4477 to unblock compilation on VS2015; r?bsmedberg Review request updated; see interdiff: https://reviewboard.mozilla.org/r/39947/diff/1-2/
Reporter | ||
Comment 3•8 years ago
|
||
Comment on attachment 8730495 [details] MozReview Request: Bug 1256027 - Disable C4477 to unblock compilation on VS2015; r?bsmedberg Review request updated; see interdiff: https://reviewboard.mozilla.org/r/39947/diff/2-3/
Reporter | ||
Comment 4•8 years ago
|
||
Comment on attachment 8730495 [details] MozReview Request: Bug 1256027 - Disable C4477 to unblock compilation on VS2015; r?bsmedberg Review request updated; see interdiff: https://reviewboard.mozilla.org/r/39947/diff/3-4/
Reporter | ||
Comment 5•8 years ago
|
||
jimm: This is one of the few compiler warnings bugs blocking VS2015 that hasn't seen any action. Could you please triage it? The preferred resolution is to fix the C++ warning, which I don't think is much effort for someone competent in C++ (which isn't me).
Flags: needinfo?(jmathies)
Assignee | ||
Comment 6•8 years ago
|
||
Untested, but this might work.
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → jwalden+bmo
Status: NEW → ASSIGNED
Comment 7•8 years ago
|
||
Comment on attachment 8734066 [details] [diff] [review] Maybe a patch? Review of attachment 8734066 [details] [diff] [review]: ----------------------------------------------------------------- r=me with changes below. ::: toolkit/xre/nsNativeAppSupportWin.cpp @@ +505,5 @@ > if ( !mClassName ) { > ::_snwprintf(classNameBuffer, > 128, // size of classNameBuffer in PRUnichars > L"%s%s", > + static_cast<const wchar_t*>(NS_ConvertUTF8toUTF16(gAppData->remotingName).get()), wwc(): http://mxr.mozilla.org/mozilla-central/source/xpcom/string/nsString.h#154 ought to do the same thing with less fussiness...but I guess there aren't |const| variants of those functions, bother. ::: toolkit/xre/nsWindowsRestart.cpp @@ +288,5 @@ > MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), > (LPTSTR) &lpMsgBuf, > 0, > nullptr); > + wprintf(L"Error restarting: %s\n", lpMsgBuf ? static_cast<const wchar_t*>(lpMsgBuf) : L"(null)"); I think this change instead wants to change |lpMsgBuf| to a LPTSTR. (Yes, this is wacky, and yes, FormatMessage is a terrible interface for suggesting that you do this, but what are you gonna do?)
Attachment #8734066 -
Flags: review+
Comment 8•8 years ago
|
||
Want to make the change in comment 7 and land this?
Flags: needinfo?(jwalden+bmo)
Reporter | ||
Comment 9•8 years ago
|
||
Waldo's original patch passed Try.
Reporter | ||
Updated•8 years ago
|
Attachment #8730495 -
Attachment is obsolete: true
Attachment #8730495 -
Flags: review?(benjamin)
Reporter | ||
Updated•8 years ago
|
Flags: needinfo?(jmathies)
Reporter | ||
Comment 12•8 years ago
|
||
The version of the patch on inbound still doesn't compile with VS2015. I'm using Waldo's original version of the patch (from comment #6) to test VS2015.
Keywords: leave-open
Comment 13•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c6eaa7367823 https://hg.mozilla.org/mozilla-central/rev/b9520981c35a
Reporter | ||
Comment 14•8 years ago
|
||
End state is Waldo's original patch, which so far has been the only version that compiles on VS2015. Review commit: https://reviewboard.mozilla.org/r/42201/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/42201/
Attachment #8734390 -
Flags: review?(nfroyd)
Updated•8 years ago
|
Attachment #8734390 -
Flags: review?(nfroyd) → review+
Comment 15•8 years ago
|
||
Comment on attachment 8734390 [details] MozReview Request: Bug 1256027 - Coerce VS2015 into compiling without warnings; r?froydnj https://reviewboard.mozilla.org/r/42201/#review38771 Sure.
Comment 17•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/34a8f0433d13
Reporter | ||
Updated•8 years ago
|
Comment 18•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8d59e338a5bd
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jwalden+bmo)
You need to log in
before you can comment on or make changes to this bug.
Description
•