Bug 1766371 - Fix class-varargs warnings in Windows builds. r=nika,mjf

dom/bindings/BindingUtils.cpp(202,62): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
                         static_cast<unsigned>(errorNumber), funcNameStr.get(),
                                                             ^
dom/bindings/BindingUtils.cpp(203,26): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
                         ifaceName.get());
                         ^
dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c(582,15): error: passing object of class type 'nr_transport_addr' (aka 'struct nr_transport_addr_') through variadic function [-Werror,-Wclass-varargs]
              component->stream->turn_servers[j].turn_server.addr);
              ^
toolkit/xre/dllservices/tests/gtest/TestUntrustedModules.cpp(44,45): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
        wprintf(L"%s is not registered.\n", aNames[i].get());
                                            ^
toolkit/xre/dllservices/tests/gtest/TestUntrustedModules.cpp(49,30): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
        wprintf(L"%s:%4d\n", aNames[i].get(), *entry);
                             ^
toolkit/xre/dllservices/tests/gtest/TestUntrustedModules.cpp(248,30): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
      wprintf(L"JSON: %s\n", json.get());
                             ^
xpcom/io/nsLocalFileWin.cpp(1647,20): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
                   NS_ConvertASCIItoUTF16(nsDependentCString(aField)).get());
                   ^

Differential Revision: https://phabricator.services.mozilla.com/D144665
This commit is contained in:
Mike Hommey 2022-05-03 21:48:22 +00:00
Родитель a12040d47d
Коммит a3e1d0e570
5 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -78,7 +78,7 @@ check_and_add_warning(
add_warning("-Wno-invalid-offsetof", cxx_compiler)
# catches objects passed by value to variadic functions.
check_and_add_warning("-Wclass-varargs", when=not_clang_cl)
check_and_add_warning("-Wclass-varargs")
# catches empty if/switch/for initialization statements that have no effect
check_and_add_warning("-Wempty-init-stmt", cxx_compiler)

Просмотреть файл

@ -199,8 +199,9 @@ static bool ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
const ErrNum errorNumber = MSG_METHOD_THIS_DOES_NOT_IMPLEMENT_INTERFACE;
MOZ_RELEASE_ASSERT(GetErrorArgCount(errorNumber) == 2);
JS_ReportErrorNumberUC(aCx, GetErrorMessage, nullptr,
static_cast<unsigned>(errorNumber), funcNameStr.get(),
ifaceName.get());
static_cast<unsigned>(errorNumber),
static_cast<const char16_t*>(funcNameStr.get()),
static_cast<const char16_t*>(ifaceName.get()));
return false;
}

Просмотреть файл

@ -579,7 +579,7 @@ static int nr_ice_component_initialize_tcp(struct nr_ice_ctx_ *ctx,nr_ice_compon
r_log(LOG_ICE, LOG_DEBUG,
"ICE-STREAM(%s): Creating socket for address %s (turn server %s)",
component->stream->label, addr.as_string,
component->stream->turn_servers[j].turn_server.addr);
component->stream->turn_servers[j].turn_server.addr.as_string);
/* Create a local socket */
if((r=nr_socket_factory_create_socket(ctx->socket_factory,&addr,&local_sock))){

Просмотреть файл

@ -41,12 +41,12 @@ class ModuleLoadCounter final {
for (size_t i = 0; i < N; ++i) {
auto entry = mCounters.Lookup(aNames[i]);
if (!entry) {
wprintf(L"%s is not registered.\n", aNames[i].get());
wprintf(L"%s is not registered.\n", static_cast<const wchar_t*>(aNames[i].get()));
result = false;
} else if (*entry != aCounts[i]) {
// We can return false, but let's print out all unmet modules
// which may be helpful to investigate test failures.
wprintf(L"%s:%4d\n", aNames[i].get(), *entry);
wprintf(L"%s:%4d\n", static_cast<const wchar_t*>(aNames[i].get()), *entry);
result = false;
}
}
@ -245,7 +245,7 @@ class UntrustedModulesFixture : public TelemetryTestFixture {
EXPECT_TRUE(matchResult.isBoolean() && matchResult.toBoolean());
if (!matchResult.isBoolean() || !matchResult.toBoolean()) {
// If match failed, print out the actual JSON kindly.
wprintf(L"JSON: %s\n", json.get());
wprintf(L"JSON: %s\n", static_cast<const wchar_t*>(json.get()));
wprintf(L"RE: %s\n", aPattern);
}
}

Просмотреть файл

@ -1661,10 +1661,9 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult) {
if (queryResult && translate) {
for (int32_t i = 0; i < 2; ++i) {
wchar_t subBlock[MAX_PATH];
_snwprintf(subBlock, MAX_PATH, L"\\StringFileInfo\\%04x%04x\\%s",
_snwprintf(subBlock, MAX_PATH, L"\\StringFileInfo\\%04x%04x\\%S",
(i == 0 ? translate[0].wLanguage : ::GetUserDefaultLangID()),
translate[0].wCodePage,
NS_ConvertASCIItoUTF16(nsDependentCString(aField)).get());
translate[0].wCodePage, aField);
subBlock[MAX_PATH - 1] = 0;
LPVOID value = nullptr;
UINT size;