Fix remaining -pedantic warnings.

Wgnu-zero-variadic-macro-arguments is fixed by:

 - A previous googletest roll fixing the warning in gmock.
 - Adding a dummy argument to AddTraceEvent so that the __VA_ARGS__ is
never empty in TraceEvent.h and doesn't require __VA_ARGS__ token
pasting with a comma.
 - Extracting the first parameter in DAWN_INSTANTIATE_TEST with some
preprocessor tricks instead of singling it out, to avoid __VA_ARGS__
token pasting with a comma.

Wmicrosoft-enum-value is fixed by a previous spirv-cross roll that fixes
the warning upstream.

Bug: dawn:394
Change-Id: Icfe037ae9549087e9d62b6f42f91958addbb53ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21483
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2020-05-13 08:01:55 +00:00
committed by Commit Bot service account
parent f4df7916ca
commit 60bb88d23c
3 changed files with 129 additions and 125 deletions

View File

@@ -358,17 +358,20 @@ DawnTestWithParams<Params>::DawnTestWithParams() : DawnTestBase(this->GetParam()
using DawnTest = DawnTestWithParams<>;
// Helpers to get the first element of a __VA_ARGS__ without triggering empty __VA_ARGS__ warnings.
#define DAWN_INTERNAL_PP_GET_HEAD(firstParam, ...) firstParam
#define DAWN_PP_GET_HEAD(...) DAWN_INTERNAL_PP_GET_HEAD(__VA_ARGS__, dummyArg)
// Instantiate the test once for each backend provided after the first argument. Use it like this:
// DAWN_INSTANTIATE_TEST(MyTestFixture, MetalBackend, OpenGLBackend)
#define DAWN_INSTANTIATE_TEST(testName, firstParam, ...) \
const decltype(firstParam) testName##params[] = {firstParam, ##__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P( \
, testName, \
testing::ValuesIn(::detail::FilterBackends( \
testName##params, sizeof(testName##params) / sizeof(firstParam))), \
#define DAWN_INSTANTIATE_TEST(testName, ...) \
const decltype(DAWN_PP_GET_HEAD(__VA_ARGS__)) testName##params[] = {__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P( \
, testName, \
testing::ValuesIn(::detail::FilterBackends( \
testName##params, sizeof(testName##params) / sizeof(testName##params[0]))), \
testing::PrintToStringParamName())
namespace detail {
// Helper functions used for DAWN_INSTANTIATE_TEST
bool IsBackendAvailable(wgpu::BackendType type);