Make everything compile cleanly with -Wpedantic.

This makes SPIRV_WARN_EVERYTHING compile cleanly.
This commit is contained in:
Andrew Woloszyn 2016-03-18 14:13:16 -04:00
parent e04b935599
commit 4c657bfa8f
31 changed files with 170 additions and 169 deletions

View File

@ -263,10 +263,10 @@ enum Entrypoints {
UAbs = 201,
UAbs_diff = 202,
UMul_hi = 203,
UMad_hi = 204,
UMad_hi = 204
};
}; // end namespace OpenCL20
} // end namespace OpenCL20

View File

@ -29,17 +29,17 @@
#if defined(SPIRV_LINUX) || defined(SPIRV_MAC)
namespace libspirv {
clr::reset::operator const char*() { return "\e[0m"; }
clr::reset::operator const char*() { return "\x1b[0m"; }
clr::grey::operator const char*() { return "\e[1;30m"; }
clr::grey::operator const char*() { return "\x1b[1;30m"; }
clr::red::operator const char*() { return "\e[31m"; }
clr::red::operator const char*() { return "\x1b[31m"; }
clr::green::operator const char*() { return "\e[32m"; }
clr::green::operator const char*() { return "\x1b[32m"; }
clr::yellow::operator const char*() { return "\e[33m"; }
clr::yellow::operator const char*() { return "\x1b[33m"; }
clr::blue::operator const char*() { return "\e[34m"; }
clr::blue::operator const char*() { return "\x1b[34m"; }
} // namespace libspirv
#elif defined(SPIRV_WINDOWS)

View File

@ -82,7 +82,7 @@ INSTANTIATE_TEST_CASE_P(
// A very long string, encoded after an initial word.
// SPIR-V limits strings to 65535 characters.
{std::string(65535, 'a'), {1}},
}));
}),);
// clang-format on
} // anonymous namespace

View File

@ -463,7 +463,7 @@ INSTANTIATE_TEST_CASE_P(
"Module has incomplete header: only 3 words instead of 5"},
{kHeaderForBound1, 4,
"Module has incomplete header: only 4 words instead of 5"},
}));
}),);
// A binary parser diagnostic test case where a vector of words is
// provided. We'll use this to express cases that can't be created
@ -696,7 +696,7 @@ INSTANTIATE_TEST_CASE_P(
MakeInstruction(SpvOpConstant, {1, 2, 42}),
}),
"Type Id 1 is not a scalar numeric type"},
}));
}),);
// A binary parser diagnostic case generated from an assembly text input.
struct AssemblyDiagnosticCase {
@ -766,6 +766,6 @@ INSTANTIATE_TEST_CASE_P(
"Invalid image operand: 511 has invalid mask component 256"},
{"OpSelectionMerge %1 !7",
"Invalid selection control operand: 7 has invalid mask component 4"},
}));
}),);
} // anonymous namespace

View File

@ -58,7 +58,7 @@ INSTANTIATE_TEST_CASE_P(
"OpName %1 \"\\\"foo\nbar\\\"\"\n", // escaped quote
"OpName %1 \"\\\\foo\nbar\\\\\"\n", // escaped backslash
"OpName %1 \"\xE4\xBA\xB2\"\n", // UTF-8
}));
}),);
// clang-format on
using RoundTripSpecialCaseLiteralsTest = spvtest::TextToBinaryTestBase<
@ -78,7 +78,7 @@ INSTANTIATE_TEST_CASE_P(
{"OpName %1 \"\\foo\"\n", "OpName %1 \"foo\"\n"}, // Escape f
{"OpName %1 \"\\\nfoo\"\n", "OpName %1 \"\nfoo\"\n"}, // Escape newline
{"OpName %1 \"\\\xE4\xBA\xB2\"\n", "OpName %1 \"\xE4\xBA\xB2\"\n"}, // Escape utf-8
}));
}),);
// clang-format on
} // anonymous namespace

View File

@ -203,7 +203,7 @@ INSTANTIATE_TEST_CASE_P(
"%2 = OpTypeVector %1 4",
spvtest::MakeInstruction(SpvOpConstant, {2, 3, 999}),
"Type Id 2 is not a scalar numeric type"},
}));
}),);
INSTANTIATE_TEST_CASE_P(
InvalidIdsCheckedDuringLiteralCaseParsing, BinaryToTextFail,
@ -219,7 +219,7 @@ INSTANTIATE_TEST_CASE_P(
{"%1 = OpTypeFloat 32\n%2 = OpConstant %1 1.5",
spvtest::MakeInstruction(SpvOpSwitch, {2, 3, 4, 5}),
"Invalid OpSwitch: selector id 2 is not a scalar integer"},
}));
}),);
TEST_F(TextToBinaryTest, OneInstruction) {
const std::string input = "OpSource OpenCL_C 12\n";
@ -244,7 +244,7 @@ using RoundTripInstructionsTest =
TEST_P(RoundTripInstructionsTest, Sample) {
EXPECT_THAT(EncodeAndDecodeSuccessfully(GetParam()), Eq(GetParam()));
};
}
// clang-format off
INSTANTIATE_TEST_CASE_P(
@ -259,7 +259,7 @@ INSTANTIATE_TEST_CASE_P(
"OpStore %1 %2 Volatile|Aligned 16\n",
"OpStore %1 %2 Volatile|Nontemporal\n",
"OpStore %1 %2 Volatile|Aligned|Nontemporal 32\n",
}));
}),);
// clang-format on
INSTANTIATE_TEST_CASE_P(
@ -275,7 +275,7 @@ INSTANTIATE_TEST_CASE_P(
"OpDecorate %1 FPFastMathMode NotNaN|NotInf\n",
"OpDecorate %1 FPFastMathMode NSZ|AllowRecip\n",
"OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|Fast\n",
}));
}),);
INSTANTIATE_TEST_CASE_P(LoopControlMasks, RoundTripInstructionsTest,
::testing::ValuesIn(std::vector<std::string>{
@ -283,7 +283,7 @@ INSTANTIATE_TEST_CASE_P(LoopControlMasks, RoundTripInstructionsTest,
"OpLoopMerge %1 %2 Unroll\n",
"OpLoopMerge %1 %2 DontUnroll\n",
"OpLoopMerge %1 %2 Unroll|DontUnroll\n",
}));
}),);
INSTANTIATE_TEST_CASE_P(SelectionControlMasks, RoundTripInstructionsTest,
::testing::ValuesIn(std::vector<std::string>{
@ -291,7 +291,7 @@ INSTANTIATE_TEST_CASE_P(SelectionControlMasks, RoundTripInstructionsTest,
"OpSelectionMerge %1 Flatten\n",
"OpSelectionMerge %1 DontFlatten\n",
"OpSelectionMerge %1 Flatten|DontFlatten\n",
}));
}),);
// clang-format off
INSTANTIATE_TEST_CASE_P(
@ -304,7 +304,7 @@ INSTANTIATE_TEST_CASE_P(
"%2 = OpFunction %1 Const %3\n",
"%2 = OpFunction %1 Inline|Pure|Const %3\n",
"%2 = OpFunction %1 DontInline|Const %3\n",
}));
}),);
// clang-format on
// clang-format off
@ -327,7 +327,8 @@ INSTANTIATE_TEST_CASE_P(
"%2 = OpImageFetch %1 %3 %4 Sample|MinLod %5 %6\n",
"%2 = OpImageFetch %1 %3 %4"
" Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample|MinLod"
" %5 %6 %7 %8 %9 %10 %11 %12 %13\n"}));
" %5 %6 %7 %8 %9 %10 %11 %12 %13\n"
}),);
// clang-format on
using MaskSorting = TextToBinaryTest;
@ -473,6 +474,6 @@ INSTANTIATE_TEST_CASE_P(GeneratorStrings, GeneratorStringTest,
"Khronos Glslang Reference Front End; 1"},
{9, 18, "Unknown(9); 18"},
{65535, 32767, "Unknown(65535); 32767"},
}));
}),);
} // anonymous namespace

View File

@ -198,7 +198,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(Native_sin, native_sin),
CASE1(Native_sqrt, native_sqrt),
CASE1(Native_tan, native_tan), // enum value 94
})));
})),);
// OpenCL.std: 2.1 Integer instructions
INSTANTIATE_TEST_CASE_P(
@ -238,7 +238,7 @@ INSTANTIATE_TEST_CASE_P(
CASE2(UAbs_diff, u_abs_diff),
CASE2(UMul_hi, u_mul_hi),
CASE3(UMad_hi, u_mad_hi), // enum value 204
})));
})),);
// OpenCL.std: 2.3 Common instrucitons
INSTANTIATE_TEST_CASE_P(
@ -253,7 +253,7 @@ INSTANTIATE_TEST_CASE_P(
CASE2(Step, step),
CASE3(Smoothstep, smoothstep),
CASE1(Sign, sign), // enum value 103
})));
})),);
// OpenCL.std: 2.4 Geometric instructions
INSTANTIATE_TEST_CASE_P(
@ -266,7 +266,7 @@ INSTANTIATE_TEST_CASE_P(
CASE2(Fast_distance, fast_distance),
CASE1(Fast_length, fast_length),
CASE1(Fast_normalize, fast_normalize), // enum value 110
})));
})),);
// OpenCL.std: 2.5 Relational instructions
INSTANTIATE_TEST_CASE_P(
@ -274,7 +274,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(std::vector<InstructionCase>({
CASE3(Bitselect, bitselect), // enum value 186
CASE3(Select, select), // enum value 187
})));
})),);
// OpenCL.std: 2.6 Vector data load and store instructions
INSTANTIATE_TEST_CASE_P(
@ -314,7 +314,7 @@ INSTANTIATE_TEST_CASE_P(
CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTZ),
CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTP),
CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTN),
})));
})),);
// OpenCL.std: 2.7 Miscellaneous vector instructions
INSTANTIATE_TEST_CASE_P(
@ -322,7 +322,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(std::vector<InstructionCase>({
CASE2(Shuffle, shuffle),
CASE3(Shuffle2, shuffle2),
})));
})),);
// OpenCL.std: 2.8 Miscellaneous instructions
@ -346,14 +346,14 @@ INSTANTIATE_TEST_CASE_P(
{4, 5, 6, 7, 8, 9, 10, 11, 12, 13}},
{PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14",
{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}},
})));
})),);
#undef PREFIX
INSTANTIATE_TEST_CASE_P(
OpenCLMiscPrefetch, ExtInstOpenCLStdRoundTripTest,
::testing::ValuesIn(std::vector<InstructionCase>({
CASE2(Prefetch, prefetch),
})));
})),);
// OpenCL.std: 2.9.1 Image encoding
// No new instructions defined in this section.

View File

@ -205,6 +205,6 @@ INSTANTIATE_TEST_CASE_P(
{"NMin", "%5 %5", 79, 7, {5, 5}},
{"NMax", "%5 %5", 80, 7, {5, 5}},
{"NClamp", "%5 %5 %5", 81, 8, {5, 5, 5}},
})));
})),);
} // anonymous namespace

View File

@ -56,7 +56,7 @@ INSTANTIATE_TEST_CASE_P(
"Khronos LLVM/SPIR-V Translator"},
{SPV_GENERATOR_KHRONOS_ASSEMBLER, "Khronos SPIR-V Tools Assembler"},
{SPV_GENERATOR_KHRONOS_GLSLANG, "Khronos Glslang Reference Front End"},
}));
}),);
INSTANTIATE_TEST_CASE_P(
Unregistered, GeneratorMagicNumberTest,
@ -64,5 +64,5 @@ INSTANTIATE_TEST_CASE_P(
// Currently value 6 and beyond are unregiestered.
{spv_generator_t(9), "Unknown"},
{spv_generator_t(9999), "Unknown"},
}));
}),);
} // anonymous namespace

View File

@ -140,7 +140,7 @@ INSTANTIATE_TEST_CASE_P(
{float(ldexp(1.0, -127) / 2.0 + (ldexp(1.0, -127) / 4.0f)),
"0x1.8p-128"},
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float32NanTests, HexFloatTest,
@ -158,7 +158,7 @@ INSTANTIATE_TEST_CASE_P(
{uint32_t(0x7f800c00), "0x1.0018p+128"}, // +nan
{uint32_t(0x7F80F000), "0x1.01ep+128"}, // +nan
{uint32_t(0x7FFFFFFF), "0x1.fffffep+128"}, // +nan
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float64Tests, HexDoubleTest,
@ -231,7 +231,7 @@ INSTANTIATE_TEST_CASE_P(
{ldexp(1.0, -1023) / 2.0 + (ldexp(1.0, -1023) / 4.0),
"0x1.8p-1024"},
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float64NanTests, HexDoubleTest,
@ -250,7 +250,7 @@ INSTANTIATE_TEST_CASE_P(
{uint64_t(0x7FF0000000000001LL), "0x1.0000000000001p+1024"}, // -nan
{uint64_t(0x7FF0000300000000LL), "0x1.00003p+1024"}, // -nan
{uint64_t(0x7FFFFFFFFFFFFFFFLL), "0x1.fffffffffffffp+1024"}, // -nan
})));
})),);
TEST(HexFloatStreamTest, OperatorLeftShiftPreservesFloatAndFill) {
std::stringstream s;
@ -295,7 +295,7 @@ INSTANTIATE_TEST_CASE_P(
{"0xFFp+0", 255.f},
{"0x0.8p+0", 0.5f},
{"0x0.4p+0", 0.25f},
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float32DecodeInfTests, DecodeHexFloatTest,
@ -305,7 +305,7 @@ INSTANTIATE_TEST_CASE_P(
{"0x32p+127", uint32_t(0x7F800000)}, // inf
{"0x32p+500", uint32_t(0x7F800000)}, // inf
{"-0x32p+127", uint32_t(0xFF800000)}, // -inf
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float64DecodeTests, DecodeHexDoubleTest,
@ -328,7 +328,7 @@ INSTANTIATE_TEST_CASE_P(
{"0xFFp+0", 255.},
{"0x0.8p+0", 0.5},
{"0x0.4p+0", 0.25},
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float64DecodeInfTests, DecodeHexDoubleTest,
@ -339,7 +339,7 @@ INSTANTIATE_TEST_CASE_P(
{"0x32p+1023", uint64_t(0x7FF0000000000000)}, // inf
{"0x32p+5000", uint64_t(0x7FF0000000000000)}, // inf
{"-0x32p+1023", uint64_t(0xFFF0000000000000)}, // -inf
})));
})),);
TEST(FloatProxy, ValidConversion) {
EXPECT_THAT(FloatProxy<float>(1.f).getAsFloat(), Eq(1.0f));
@ -508,7 +508,7 @@ INSTANTIATE_TEST_CASE_P(
{std::numeric_limits<float>::infinity(), "0x1p+128"},
{-std::numeric_limits<float>::infinity(), "-0x1p+128"},
})));
})),);
INSTANTIATE_TEST_CASE_P(
Float64Tests, FloatProxyDoubleTest,
@ -545,7 +545,7 @@ INSTANTIATE_TEST_CASE_P(
{std::numeric_limits<double>::infinity(), "0x1p+1024"},
{-std::numeric_limits<double>::infinity(), "-0x1p+1024"},
})));
})),);
// double is used so that unbiased_exponent can be used with the output
// of ldexp directly.
@ -807,7 +807,7 @@ INSTANTIATE_TEST_CASE_P(F32ToF16, HexFloatRoundTest,
{static_cast<float>(ldexp(float_fractions({0, 1, 11, 13}), -129)), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity},
{static_cast<float>(ldexp(float_fractions({0, 1, 11, 13}), -131)), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity},
{static_cast<float>(ldexp(float_fractions({0, 1, 11, 13}), -130)), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven},
})));
})),);
// clang-format on
struct UpCastSignificandCase {
@ -851,7 +851,7 @@ INSTANTIATE_TEST_CASE_P(F16toF32, HexFloatRoundUpSignificandTest,
{0x0F00, 0x600000},
{0x0F01, 0x602000},
{0x0FFF, 0x7FE000},
})));
})),);
struct DownCastTest {
float source_float;
@ -928,7 +928,7 @@ INSTANTIATE_TEST_CASE_P(F32ToF16, HexFloatFP32To16Tests,
{-std::numeric_limits<float>::infinity(), negative_infinity, {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, RD::kToNearestEven}},
// Nans are below because we cannot test for equality.
})));
})),);
struct UpCastCase{
uint16_t source_half;
@ -979,7 +979,7 @@ INSTANTIATE_TEST_CASE_P(F16ToF32, HexFloatFP16To32Tests,
// inf
{0x7C00, std::numeric_limits<float>::infinity()},
{0xFC00, -std::numeric_limits<float>::infinity()},
})));
})),);
TEST(HexFloatOperationTests, NanTests) {
using HF = spvutils::HexFloat<spvutils::FloatProxy<float>>;
@ -1085,7 +1085,7 @@ INSTANTIATE_TEST_CASE_P(
// We can't have -1e40 and negate_value == true since
// that represents an original case of "--1e40" which
// is invalid.
}));
}),);
using ParseNormalFloat16Test =
::testing::TestWithParam<FloatParseCase<Float16>>;
@ -1128,7 +1128,7 @@ INSTANTIATE_TEST_CASE_P(
BadFloatParseCase<Float16>("-2.0", true, uint16_t{0}),
BadFloatParseCase<Float16>("+0.0", true, uint16_t{0}),
BadFloatParseCase<Float16>("+2.0", true, uint16_t{0}),
}));
}),);
// A test case for detecting infinities.
template <typename T>
@ -1163,7 +1163,7 @@ INSTANTIATE_TEST_CASE_P(
{"-1e40", false, -FLT_MAX},
{"1e400", false, FLT_MAX},
{"-1e400", false, -FLT_MAX},
})));
})),);
using FloatProxyParseOverflowDoubleTest =
::testing::TestWithParam<OverflowParseCase<double>>;
@ -1190,7 +1190,7 @@ INSTANTIATE_TEST_CASE_P(
{"-1e40", true, -1e40},
{"1e400", false, DBL_MAX},
{"-1e400", false, -DBL_MAX},
})));
})),);
using FloatProxyParseOverflowFloat16Test =
::testing::TestWithParam<OverflowParseCase<uint16_t>>;
@ -1221,7 +1221,7 @@ INSTANTIATE_TEST_CASE_P(
{"-1e38", false, uint16_t{0xfbff}},
{"-1e40", false, uint16_t{0xfbff}},
{"-1e400", false, uint16_t{0xfbff}},
})));
})),);
TEST(FloatProxy, Max) {
EXPECT_THAT(FloatProxy<Float16>::max().getAsFloat().get_value(),

View File

@ -109,6 +109,6 @@ INSTANTIATE_TEST_CASE_P(
{"5", false},
{"32", false},
{"foo", false},
{"a%bar", false}})));
{"a%bar", false}})),);
} // anonymous namespace

View File

@ -65,7 +65,7 @@ INSTANTIATE_TEST_CASE_P(
SpvCapabilityClipDistance,
// Transformfeedback has value 53,
// and is the last capability.
SpvCapabilityTransformFeedback));
SpvCapabilityTransformFeedback),);
TEST(OpcodeRequiresCapability, None) {
spv_opcode_desc_t entry = {nullptr, (SpvOp)0, 0, 0, {}, false, false, {}};
@ -81,7 +81,7 @@ TEST(CapabilityAsMaskMacro, Sample) {
SPV_CAPABILITY_AS_MASK(SpvCapabilityClipDistance));
EXPECT_EQ(uint64_t(1) << 53,
SPV_CAPABILITY_AS_MASK(SpvCapabilityTransformFeedback));
};
}
/// Capabilities required by an Opcode.
struct ExpectedOpCodeCapabilities {
@ -133,6 +133,6 @@ INSTANTIATE_TEST_CASE_P(
ExpectedOpCodeCapabilities{SpvOpFunction, 0},
ExpectedOpCodeCapabilities{SpvOpConvertFToS, 0},
ExpectedOpCodeCapabilities{SpvOpEmitStreamVertex,
mask(SpvCapabilityGeometryStreams)}));
mask(SpvCapabilityGeometryStreams)}),);
} // anonymous namespace

View File

@ -75,7 +75,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(EXECUTION_MODEL, ExecutionModelFragment, Shader),
CASE1(EXECUTION_MODEL, ExecutionModelGLCompute, Shader),
CASE1(EXECUTION_MODEL, ExecutionModelKernel, Kernel),
}));
}),);
// See SPIR-V Section 3.4 Addressing Model
INSTANTIATE_TEST_CASE_P(
@ -84,7 +84,7 @@ INSTANTIATE_TEST_CASE_P(
CASE0(ADDRESSING_MODEL, AddressingModelLogical),
CASE1(ADDRESSING_MODEL, AddressingModelPhysical32, Addresses),
CASE1(ADDRESSING_MODEL, AddressingModelPhysical64, Addresses),
}));
}),);
// See SPIR-V Section 3.5 Memory Model
INSTANTIATE_TEST_CASE_P(MemoryModel, EnumCapabilityTest,
@ -92,7 +92,7 @@ INSTANTIATE_TEST_CASE_P(MemoryModel, EnumCapabilityTest,
CASE1(MEMORY_MODEL, MemoryModelSimple, Shader),
CASE1(MEMORY_MODEL, MemoryModelGLSL450, Shader),
CASE1(MEMORY_MODEL, MemoryModelOpenCL, Kernel),
}));
}),);
// See SPIR-V Section 3.6 Execution Mode
INSTANTIATE_TEST_CASE_P(
@ -130,7 +130,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(EXECUTION_MODE, ExecutionModeOutputTriangleStrip, Geometry),
CASE1(EXECUTION_MODE, ExecutionModeVecTypeHint, Kernel),
CASE1(EXECUTION_MODE, ExecutionModeContractionOff, Kernel),
}));
}),);
// See SPIR-V Section 3.7 Storage Class
INSTANTIATE_TEST_CASE_P(
@ -148,7 +148,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(STORAGE_CLASS, StorageClassPushConstant, Shader),
CASE1(STORAGE_CLASS, StorageClassAtomicCounter, AtomicStorage),
CASE0(STORAGE_CLASS, StorageClassImage),
}));
}),);
// See SPIR-V Section 3.8 Dim
INSTANTIATE_TEST_CASE_P(
@ -159,7 +159,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(DIMENSIONALITY, DimRect, SampledRect),
CASE1(DIMENSIONALITY, DimBuffer, SampledBuffer),
CASE1(DIMENSIONALITY, DimSubpassData, InputAttachment),
}));
}),);
// See SPIR-V Section 3.9 Sampler Addressing Mode
INSTANTIATE_TEST_CASE_P(
@ -172,7 +172,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeat, Kernel),
CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeatMirrored,
Kernel),
}));
}),);
// See SPIR-V Section 3.10 Sampler Filter Mode
INSTANTIATE_TEST_CASE_P(
@ -180,7 +180,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(std::vector<EnumCapabilityCase>{
CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeNearest, Kernel),
CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeLinear, Kernel),
}));
}),);
// clang-format off
// See SPIR-V Section 3.11 Image Format
@ -227,7 +227,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg8ui, StorageImageExtendedFormats),
CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16ui, StorageImageExtendedFormats),
CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8ui, StorageImageExtendedFormats),
}));
}),);
// clang-format on
// See SPIR-V Section 3.12 Image Channel Order
@ -253,7 +253,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGBx, Kernel),
CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGBA, Kernel),
CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersBGRA, Kernel),
}));
}),);
// See SPIR-V Section 3.13 Image Channel Data Type
INSTANTIATE_TEST_CASE_P(
@ -283,7 +283,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt24, Kernel),
CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt101010_2,
Kernel),
}));
}),);
// See SPIR-V Section 3.14 Image Operands
INSTANTIATE_TEST_CASE_P(
@ -298,7 +298,7 @@ INSTANTIATE_TEST_CASE_P(
CASE0(OPTIONAL_IMAGE, ImageOperandsConstOffsetsMask),
CASE0(OPTIONAL_IMAGE, ImageOperandsSampleMask),
CASE1(OPTIONAL_IMAGE, ImageOperandsMinLodMask, MinLod),
}));
}),);
// See SPIR-V Section 3.15 FP Fast Math Mode
INSTANTIATE_TEST_CASE_P(
@ -310,7 +310,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(FP_FAST_MATH_MODE, FPFastMathModeNSZMask, Kernel),
CASE1(FP_FAST_MATH_MODE, FPFastMathModeAllowRecipMask, Kernel),
CASE1(FP_FAST_MATH_MODE, FPFastMathModeFastMask, Kernel),
}));
}),);
// See SPIR-V Section 3.16 FP Rounding Mode
INSTANTIATE_TEST_CASE_P(FPRoundingMode, EnumCapabilityTest,
@ -319,14 +319,14 @@ INSTANTIATE_TEST_CASE_P(FPRoundingMode, EnumCapabilityTest,
CASE1(FP_ROUNDING_MODE, FPRoundingModeRTZ, Kernel),
CASE1(FP_ROUNDING_MODE, FPRoundingModeRTP, Kernel),
CASE1(FP_ROUNDING_MODE, FPRoundingModeRTN, Kernel),
}));
}),);
// See SPIR-V Section 3.17 Linkage Type
INSTANTIATE_TEST_CASE_P(LinkageType, EnumCapabilityTest,
::testing::ValuesIn(std::vector<EnumCapabilityCase>{
CASE1(LINKAGE_TYPE, LinkageTypeExport, Linkage),
CASE1(LINKAGE_TYPE, LinkageTypeImport, Linkage),
}));
}),);
// See SPIR-V Section 3.18 Access Qualifier
INSTANTIATE_TEST_CASE_P(
@ -335,7 +335,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(ACCESS_QUALIFIER, AccessQualifierReadOnly, Kernel),
CASE1(ACCESS_QUALIFIER, AccessQualifierWriteOnly, Kernel),
CASE1(ACCESS_QUALIFIER, AccessQualifierReadWrite, Kernel),
}));
}),);
// See SPIR-V Section 3.19 Function Parameter Attribute
INSTANTIATE_TEST_CASE_P(FunctionParameterAttribute, EnumCapabilityTest,
@ -357,7 +357,7 @@ INSTANTIATE_TEST_CASE_P(FunctionParameterAttribute, EnumCapabilityTest,
CASE1(FUNCTION_PARAMETER_ATTRIBUTE,
FunctionParameterAttributeNoReadWrite,
Kernel),
}));
}),);
// See SPIR-V Section 3.20 Decoration
INSTANTIATE_TEST_CASE_P(
@ -408,7 +408,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(DECORATION, DecorationNoContraction, Shader),
CASE1(DECORATION, DecorationInputAttachmentIndex, InputAttachment),
CASE1(DECORATION, DecorationAlignment, Kernel),
}));
}),);
// See SPIR-V Section 3.21 BuiltIn
INSTANTIATE_TEST_CASE_P(
@ -458,7 +458,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(BUILT_IN, BuiltInSubgroupLocalInvocationId, Kernel),
CASE1(BUILT_IN, BuiltInVertexIndex, Shader),
CASE1(BUILT_IN, BuiltInInstanceIndex, Shader),
}));
}),);
// See SPIR-V Section 3.22 Selection Control
INSTANTIATE_TEST_CASE_P(
@ -467,7 +467,7 @@ INSTANTIATE_TEST_CASE_P(
CASE0(SELECTION_CONTROL, SelectionControlMaskNone),
CASE0(SELECTION_CONTROL, SelectionControlFlattenMask),
CASE0(SELECTION_CONTROL, SelectionControlDontFlattenMask),
}));
}),);
// See SPIR-V Section 3.23 Loop Control
INSTANTIATE_TEST_CASE_P(LoopControl, EnumCapabilityTest,
@ -475,7 +475,7 @@ INSTANTIATE_TEST_CASE_P(LoopControl, EnumCapabilityTest,
CASE0(LOOP_CONTROL, LoopControlMaskNone),
CASE0(LOOP_CONTROL, LoopControlUnrollMask),
CASE0(LOOP_CONTROL, LoopControlDontUnrollMask),
}));
}),);
// See SPIR-V Section 3.24 Function Control
INSTANTIATE_TEST_CASE_P(FunctionControl, EnumCapabilityTest,
@ -486,7 +486,7 @@ INSTANTIATE_TEST_CASE_P(FunctionControl, EnumCapabilityTest,
FunctionControlDontInlineMask),
CASE0(FUNCTION_CONTROL, FunctionControlPureMask),
CASE0(FUNCTION_CONTROL, FunctionControlConstMask),
}));
}),);
// See SPIR-V Section 3.25 Memory Semantics <id>
INSTANTIATE_TEST_CASE_P(
@ -504,7 +504,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(MEMORY_SEMANTICS_ID, MemorySemanticsAtomicCounterMemoryMask,
AtomicStorage), // Bug 15234
CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsImageMemoryMask),
}));
}),);
// See SPIR-V Section 3.26 Memory Access
INSTANTIATE_TEST_CASE_P(
@ -514,7 +514,7 @@ INSTANTIATE_TEST_CASE_P(
CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessVolatileMask),
CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessAlignedMask),
CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessNontemporalMask),
}));
}),);
// See SPIR-V Section 3.27 Scope <id>
INSTANTIATE_TEST_CASE_P(
@ -523,7 +523,7 @@ INSTANTIATE_TEST_CASE_P(
CASE0(SCOPE_ID, ScopeCrossDevice), CASE0(SCOPE_ID, ScopeDevice),
CASE0(SCOPE_ID, ScopeWorkgroup), CASE0(SCOPE_ID, ScopeSubgroup),
CASE0(SCOPE_ID, ScopeInvocation),
}));
}),);
// See SPIR-V Section 3.28 Group Operation
INSTANTIATE_TEST_CASE_P(
@ -532,7 +532,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(GROUP_OPERATION, GroupOperationReduce, Kernel),
CASE1(GROUP_OPERATION, GroupOperationInclusiveScan, Kernel),
CASE1(GROUP_OPERATION, GroupOperationExclusiveScan, Kernel),
}));
}),);
// See SPIR-V Section 3.29 Kernel Enqueue Flags
INSTANTIATE_TEST_CASE_P(
@ -541,7 +541,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsNoWait, Kernel),
CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitKernel, Kernel),
CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitWorkGroup, Kernel),
}));
}),);
// See SPIR-V Section 3.30 Kernel Profiling Info
INSTANTIATE_TEST_CASE_P(KernelProfilingInfo, EnumCapabilityTest,
@ -550,7 +550,7 @@ INSTANTIATE_TEST_CASE_P(KernelProfilingInfo, EnumCapabilityTest,
KernelProfilingInfoMaskNone),
CASE1(KERNEL_PROFILING_INFO,
KernelProfilingInfoCmdExecTimeMask, Kernel),
}));
}),);
// See SPIR-V Section 3.31 Capability
INSTANTIATE_TEST_CASE_P(
@ -614,7 +614,7 @@ INSTANTIATE_TEST_CASE_P(
CASE1(CAPABILITY, CapabilityStorageImageReadWithoutFormat, Shader),
CASE1(CAPABILITY, CapabilityStorageImageWriteWithoutFormat, Shader),
CASE1(CAPABILITY, CapabilityMultiViewport, Geometry),
}));
}),);
#undef CASE0
#undef CASE1

View File

@ -118,7 +118,7 @@ INSTANTIATE_TEST_CASE_P(
SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask,
{SUFFIX1},
{SPV_OPERAND_TYPE_LITERAL_INTEGER, SUFFIX1}},
}));
}),);
#undef SUFFIX0
#undef SUFFIX1
@ -146,7 +146,7 @@ TEST_P(MatchableOperandExpansionTest, MatchableOperandsDontExpand) {
INSTANTIATE_TEST_CASE_P(MatchableOperandExpansion,
MatchableOperandExpansionTest,
::testing::ValuesIn(allOperandTypes()));
::testing::ValuesIn(allOperandTypes()),);
using VariableOperandExpansionTest =
::testing::TestWithParam<spv_operand_type_t>;
@ -166,7 +166,7 @@ TEST_P(VariableOperandExpansionTest, NonMatchableOperandsExpand) {
INSTANTIATE_TEST_CASE_P(NonMatchableOperandExpansion,
VariableOperandExpansionTest,
::testing::ValuesIn(allOperandTypes()));
::testing::ValuesIn(allOperandTypes()),);
TEST(AlternatePatternFollowingImmediate, Empty) {
EXPECT_THAT(spvAlternatePatternFollowingImmediate({}),

View File

@ -34,6 +34,7 @@
using ::testing::Eq;
namespace {
TEST(TextLiteral, GoodI32) {
spv_literal_t l;
@ -130,7 +131,7 @@ INSTANTIATE_TEST_CASE_P(
{"\"\xE4\xBA\xB2\"", "\xE4\xBA\xB2"},
{"\"\\\xE4\xBA\xB2\"", "\xE4\xBA\xB2"},
{"\"this \\\" and this \\\\ and \\\xE4\xBA\xB2\"",
"this \" and this \\ and \xE4\xBA\xB2"}}));
"this \" and this \\ and \xE4\xBA\xB2"}}),);
TEST(TextLiteral, StringTooLong) {
spv_literal_t l;
@ -288,7 +289,7 @@ INSTANTIATE_TEST_CASE_P(
Make_Ok__Unsigned(64, "18446744073709551615", {0xffffffff, 0xffffffff}),
Make_Ok__Signed(64, "-9223372036854775808", {0x00000000, 0x80000000}),
}));
}),);
// clang-format on
using IntegerLeadingMinusTest =
@ -315,7 +316,7 @@ INSTANTIATE_TEST_CASE_P(
Make_Bad_Unsigned(64, "-0"),
Make_Bad_Unsigned(64, "-0x0"),
Make_Bad_Unsigned(64, "-0x1"),
}));
}),);
// clang-format off
INSTANTIATE_TEST_CASE_P(
@ -382,7 +383,7 @@ INSTANTIATE_TEST_CASE_P(
Make_Ok__Signed(64, "0x8000000000000000", {0x00000000, 0x80000000}),
Make_Ok__Unsigned(64, "0x7fffffffffffffff", {0xffffffff, 0x7fffffff}),
Make_Ok__Unsigned(64, "0x8000000000000000", {0x00000000, 0x80000000}),
}));
}),);
// clang-format on
TEST(OverflowIntegerParse, Decimal) {

View File

@ -106,7 +106,7 @@ INSTANTIATE_TEST_CASE_P(
{CASE(NoContraction), {}},
{CASE(InputAttachmentIndex), {102}},
{CASE(Alignment), {16}},
}));
}),);
#undef CASE
TEST_F(OpDecorateSimpleTest, WrongDecoration) {
@ -204,7 +204,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest,
CASE(SubgroupLocalInvocationId),
CASE(VertexIndex),
CASE(InstanceIndex),
}));
}),);
#undef CASE
// clang-format on
@ -227,7 +227,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest,
CASE(NoCapture),
CASE(NoWrite),
CASE(NoReadWrite),
}));
}),);
#undef CASE
// clang-format on
@ -246,7 +246,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest,
CASE(RTZ),
CASE(RTP),
CASE(RTN),
}));
}),);
#undef CASE
// clang-format on
@ -271,7 +271,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest,
CASE(NSZMask, NSZ),
CASE(AllowRecipMask, AllowRecip),
CASE(FastMask, Fast),
}));
}),);
#undef CASE
// clang-format on
@ -329,7 +329,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest,
{ CASE(Export), "foo" },
{ CASE(Import), "some kind of long name with spaces etc." },
// TODO(dneto): utf-8, escaping, quoting cases.
}));
}),);
#undef CASE
// clang-format on
@ -455,7 +455,7 @@ INSTANTIATE_TEST_CASE_P(
{CASE(NoContraction), {}},
{CASE(InputAttachmentIndex), {102}},
{CASE(Alignment), {16}},
}));
}),);
#undef CASE
TEST_F(OpMemberDecorateSimpleTest, WrongDecoration) {

View File

@ -65,7 +65,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(Clamp),
CASE(Repeat),
CASE(RepeatMirrored),
}));
}),);
#undef CASE
// clang-format on
@ -94,7 +94,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(std::vector<EnumCase<SpvSamplerFilterMode>>{
CASE(Nearest),
CASE(Linear),
}));
}),);
#undef CASE
// clang-format on
@ -242,7 +242,7 @@ INSTANTIATE_TEST_CASE_P(
{"OpTypeInt 64 1", "0x7fffffff",
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
MakeInstruction(SpvOpConstant, {1, 2, 0x7fffffffu, 0})})},
}));
}),);
// clang-format on
// A test case for checking OpConstant with invalid literals with a leading minus.
@ -276,7 +276,7 @@ INSTANTIATE_TEST_CASE_P(
{"OpTypeInt 64 0", "-0"},
{"OpTypeInt 64 0", "-0x0"},
{"OpTypeInt 64 0", "-1"},
}));
}),);
// clang-format on
// A test case for invalid floating point literals.
@ -332,7 +332,7 @@ INSTANTIATE_TEST_CASE_P(
{64, "++1"},
{32, "1e400"}, // Overflow is an error for 64-bit floats.
{32, "-1e400"},
}));
}),);
// clang-format on
using OpConstantInvalidTypeTest =
@ -373,7 +373,7 @@ INSTANTIATE_TEST_CASE_P(
// At least one thing that isn't a type at all
"OpNot %a %b"
},
}));
}),);
// clang-format on
using OpSpecConstantValidTest =
@ -442,7 +442,7 @@ INSTANTIATE_TEST_CASE_P(
{"OpTypeInt 64 1", "-42",
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})},
}));
}),);
// clang-format on
using OpSpecConstantInvalidTypeTest =
@ -483,7 +483,7 @@ INSTANTIATE_TEST_CASE_P(
// At least one thing that isn't a type at all
"OpNot %a %b"
},
}));
}),);
// clang-format on
const int64_t kMaxUnsigned48Bit = (int64_t(1) << 48) - 1;
@ -531,7 +531,7 @@ INSTANTIATE_TEST_CASE_P(
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0\n",
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 1.79769e+308\n",
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -1.79769e+308\n",
}));
}),);
INSTANTIATE_TEST_CASE_P(
OpConstantHalfRoundTrip, RoundTripTest,
@ -566,7 +566,7 @@ INSTANTIATE_TEST_CASE_P(
"%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffp+16\n", // -nan
"%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffcp+16\n", // -nan
"%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.004p+16\n", // -nan
}));
}),);
// clang-format off
// (Clang-format really wants to break up these strings across lines.
@ -597,7 +597,7 @@ INSTANTIATE_TEST_CASE_P(
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.0000000000001p+1024\n", // -nan
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.00003p+1024\n", // -nan
"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.fffffffffffffp+1024\n", // -nan
}));
}),);
// clang-format on
INSTANTIATE_TEST_CASE_P(
@ -641,7 +641,7 @@ INSTANTIATE_TEST_CASE_P(
"%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 0\n",
"%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 1.79769e+308\n",
"%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 -1.79769e+308\n",
}));
}),);
// Test OpSpecConstantOp
@ -746,7 +746,7 @@ INSTANTIATE_TEST_CASE_P(
CASE2(InBoundsPtrAccessChain),
CASE3(InBoundsPtrAccessChain),
CASE6(InBoundsPtrAccessChain),
}));
}),);
#undef CASE1
#undef CASE2
#undef CASE3
@ -791,7 +791,7 @@ INSTANTIATE_TEST_CASE_P(
// composite, and then literal indices.
{CASE(CompositeInsert), {0}},
{CASE(CompositeInsert), {4, 3, 99, 1}},
}));
}),);
using OpSpecConstantOpTestWithOneIdThenLiteralNumbers =
spvtest::TextToBinaryTestBase<::testing::TestWithParam<EnumCase<SpvOp>>>;
@ -822,7 +822,7 @@ INSTANTIATE_TEST_CASE_P(
// indices. Let's only test a few.
{CASE(CompositeExtract), {0}},
{CASE(CompositeExtract), {0, 99, 42, 16, 17, 12, 19}},
}));
}),);
// TODO(dneto): OpConstantTrue
// TODO(dneto): OpConstantFalse

View File

@ -59,7 +59,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest,
CASE(MaskNone, "None"),
CASE(FlattenMask, "Flatten"),
CASE(DontFlattenMask, "DontFlatten"),
}));
}),);
#undef CASE
// clang-format on
@ -95,7 +95,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryLoopMerge, OpLoopMergeTest,
CASE(MaskNone, "None"),
CASE(UnrollMask, "Unroll"),
CASE(DontUnrollMask, "DontUnroll"),
}));
}),);
#undef CASE
// clang-format on
@ -249,7 +249,7 @@ INSTANTIATE_TEST_CASE_P(
MakeSwitchTestCase(16, 1, "0x8000", {0xffff8000}, "0x8100",
{0xffff8100}),
MakeSwitchTestCase(16, 0, "0x8000", {0x00008000}, "0x8100", {0x8100}),
})));
})),);
// NB: The words LOW ORDER bits show up first.
INSTANTIATE_TEST_CASE_P(
@ -270,7 +270,7 @@ INSTANTIATE_TEST_CASE_P(
MakeSwitchTestCase(63, 0, "0x500000000", {0, 5}, "12", {12, 0}),
MakeSwitchTestCase(64, 0, "0x600000000", {0, 6}, "12", {12, 0}),
MakeSwitchTestCase(64, 1, "0x700000123", {0x123, 7}, "12", {12, 0}),
})));
})),);
INSTANTIATE_TEST_CASE_P(
OpSwitchRoundTripUnsignedIntegers, RoundTripTest,
@ -286,7 +286,7 @@ INSTANTIATE_TEST_CASE_P(
// Unsigned 64-bit, three non-default cases.
"%1 = OpTypeInt 64 0\n%2 = OpConstant %1 9223372036854775807\n"
"OpSwitch %2 %3 100 %4 102 %5 9000000000000000000 %6\n",
})));
})),);
INSTANTIATE_TEST_CASE_P(
OpSwitchRoundTripSignedIntegers, RoundTripTest,
@ -311,7 +311,7 @@ INSTANTIATE_TEST_CASE_P(
"OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n",
"%1 = OpTypeInt 64 1\n%2 = OpConstant %1 -9223372036854775808\n"
"OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n",
}));
}),);
using OpSwitchInvalidTypeTestCase =
spvtest::TextToBinaryTestBase<::testing::TestWithParam<std::string>>;
@ -354,7 +354,7 @@ INSTANTIATE_TEST_CASE_P(
// At least one thing that isn't a type at all
"OpNot %a %b"
},
}));
}),);
// clang-format on
// TODO(dneto): OpPhi

View File

@ -83,7 +83,7 @@ TEST_P(OpSourceTest, AnyLanguage) {
}
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceTest,
::testing::ValuesIn(kLanguageCases));
::testing::ValuesIn(kLanguageCases),);
TEST_F(OpSourceTest, WrongLanguage) {
EXPECT_THAT(CompileFailure("OpSource xxyyzz 12345"),
@ -96,7 +96,7 @@ TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) {
EXPECT_THAT(
CompiledInstructions(input),
Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1})));
};
}
TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
std::string fake_source = "To be or not to be";
@ -105,7 +105,7 @@ TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
EXPECT_THAT(CompiledInstructions(input),
Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1},
MakeVector(fake_source))));
};
}
// Test OpSourceContinued
@ -124,7 +124,7 @@ TEST_P(OpSourceContinuedTest, AnyExtension) {
// TODO(dneto): utf-8, quoting, escaping
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceContinuedTest,
::testing::ValuesIn(std::vector<const char*>{
"", "foo bar this and that"}));
"", "foo bar this and that"}),);
// Test OpSourceExtension
@ -143,7 +143,7 @@ TEST_P(OpSourceExtensionTest, AnyExtension) {
// TODO(dneto): utf-8, quoting, escaping
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceExtensionTest,
::testing::ValuesIn(std::vector<const char*>{
"", "foo bar this and that"}));
"", "foo bar this and that"}),);
TEST_F(TextToBinaryTest, OpLine) {
EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"),
@ -169,7 +169,7 @@ TEST_P(OpStringTest, AnyString) {
// TODO(dneto): utf-8, quoting, escaping
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpStringTest,
::testing::ValuesIn(std::vector<const char*>{
"", "foo bar this and that"}));
"", "foo bar this and that"}),);
using OpNameTest =
spvtest::TextToBinaryTestBase<::testing::TestWithParam<const char*>>;
@ -185,7 +185,7 @@ TEST_P(OpNameTest, AnyString) {
// TODO(dneto): utf-8, quoting, escaping
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpNameTest,
::testing::ValuesIn(std::vector<const char*>{
"", "foo bar this and that"}));
"", "foo bar this and that"}),);
using OpMemberNameTest =
spvtest::TextToBinaryTestBase<::testing::TestWithParam<const char*>>;
@ -202,7 +202,7 @@ TEST_P(OpMemberNameTest, AnyString) {
// TODO(dneto): utf-8, quoting, escaping
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpMemberNameTest,
::testing::ValuesIn(std::vector<const char*>{
"", "foo bar this and that"}));
"", "foo bar this and that"}),);
// TODO(dneto): Parse failures?

View File

@ -33,7 +33,6 @@
#include "TestFixture.h"
namespace {
using spvtest::MakeInstruction;
using ::testing::Eq;
@ -80,7 +79,7 @@ INSTANTIATE_TEST_CASE_P(
{13, 14, 15, 16, 17, 18, 19, 20, 21}},
{"%l0 %l1 %l2 %l3 %l4 %l5 %l6 %l7 %l8 %l9",
{13, 14, 15, 16, 17, 18, 19, 20, 21, 22}},
}));
}),);
// Test some bad parses of OpEnqueueKernel. For other cases, we're relying
// on the uniformity of the parsing algorithm. The following two tests, ensure

View File

@ -61,7 +61,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryFunctionTest, OpFunctionControlTest,
CASE(DontInlineMask, "DontInline"),
CASE(PureMask, "Pure"),
CASE(ConstMask, "Const"),
}));
}),);
#undef CASE
// clang-format on

View File

@ -58,7 +58,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryGroupOperation, GroupOperationTest,
CASE(Reduce),
CASE(InclusiveScan),
CASE(ExclusiveScan),
}));
}),);
#undef CASE
// clang-format on

View File

@ -75,7 +75,7 @@ INSTANTIATE_TEST_CASE_P(
{" ConstOffsets %5", {MASK(ConstOffsets), 5}},
{" Sample %5", {MASK(Sample), 5}},
{" MinLod %5", {MASK(MinLod), 5}},
}));
}),);
#undef MASK
#define MASK(NAME) static_cast<uint32_t>(SpvImageOperands##NAME##Mask)
INSTANTIATE_TEST_CASE_P(
@ -105,7 +105,7 @@ INSTANTIATE_TEST_CASE_P(
" %5 %6 %7 %8 %9 %10 %11 %12",
{MASK(Bias) | MASK(Lod) | MASK(Grad) | MASK(ConstOffset) |
MASK(Offset) | MASK(ConstOffsets) | MASK(Sample),
5, 6, 7, 8, 9, 10, 11, 12}}}));
5, 6, 7, 8, 9, 10, 11, 12}}}),);
#undef MASK
TEST_F(ImageOperandsTest, WrongOperand) {
@ -197,7 +197,7 @@ INSTANTIATE_TEST_CASE_P(ImageSparseReadImageOperandsAny,
{" ConstOffsets %5", {MASK(ConstOffsets), 5}},
{" Sample %5", {MASK(Sample), 5}},
{" MinLod %5", {MASK(MinLod), 5}},
}));
}),);
#undef MASK
#define MASK(NAME) static_cast<uint32_t>(SpvImageOperands##NAME##Mask)
INSTANTIATE_TEST_CASE_P(
@ -222,7 +222,7 @@ INSTANTIATE_TEST_CASE_P(
5, 6, 7, 8, 9, 10, 11, 12}},
// Don't try the masks reversed, since this is a round trip test,
// and the disassembler will sort them.
}));
}),);
#undef MASK
TEST_F(OpImageSparseReadTest, InvalidTypeOperand) {

View File

@ -62,7 +62,7 @@ INSTANTIATE_TEST_CASE_P(
{SpvMemoryAccessVolatileMask, "Volatile", {}},
{SpvMemoryAccessAlignedMask, "Aligned", {16}},
{SpvMemoryAccessNontemporalMask, "Nontemporal", {}},
}));
}),);
TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) {
const std::string input = "OpStore %ptr %value Volatile|Aligned 16";
@ -101,7 +101,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(PushConstant),
CASE(AtomicCounter),
CASE(Image),
}));
}),);
#undef CASE
// clang-format on

View File

@ -82,7 +82,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryMemoryModel, OpMemoryModelTest,
CASE(Logical,GLSL450),
CASE(Physical32,OpenCL),
CASE(Physical64,OpenCL),
}));
}),);
#undef CASE
// clang-format on
@ -129,7 +129,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest,
{ CASE(Fragment), "FAT32" },
{ CASE(GLCompute), "cubic" },
{ CASE(Kernel), "Sanders" },
}));
}),);
#undef CASE
// clang-format on
@ -190,7 +190,7 @@ INSTANTIATE_TEST_CASE_P(
{CASE(OutputTriangleStrip), {}},
{CASE(VecTypeHint), {96}},
{CASE(ContractionOff), {}},
}));
}),);
#undef CASE
TEST_F(OpExecutionModeTest, WrongMode) {
@ -267,7 +267,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest,
CASE(DerivativeControl),
CASE(InterpolationFunction),
CASE(TransformFeedback),
}));
}),);
#undef CASE
// clang-format on

View File

@ -67,7 +67,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(Rect),
CASE(Buffer),
CASE(SubpassData),
}));
}),);
#undef CASE
// clang-format on
@ -136,7 +136,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(Rg8ui),
CASE(R16ui),
CASE(R8ui),
}));
}),);
#undef CASE
// clang-format on
@ -168,7 +168,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(ReadOnly),
CASE(WriteOnly),
CASE(ReadWrite),
}));
}),);
// clang-format on
#undef CASE
@ -193,7 +193,7 @@ INSTANTIATE_TEST_CASE_P(
CASE(ReadOnly),
CASE(WriteOnly),
CASE(ReadWrite),
}));
}),);
#undef CASE
// clang-format on

View File

@ -96,7 +96,7 @@ INSTANTIATE_TEST_CASE_P(
{SPV_OPERAND_TYPE_FUNCTION_CONTROL, 4, "Pure"},
{SPV_OPERAND_TYPE_FUNCTION_CONTROL, 8, "Const"},
{SPV_OPERAND_TYPE_FUNCTION_CONTROL, 0xd, "Inline|Const|Pure"},
}));
}),);
using BadFPFastMathMaskParseTest = ::testing::TestWithParam<const char*>;
@ -116,7 +116,7 @@ INSTANTIATE_TEST_CASE_P(ParseMask, BadFPFastMathMaskParseTest,
nullptr, "", "NotValidEnum", "|", "NotInf|",
"|NotInf", "NotInf||NotNaN",
"Unroll" // A good word, but for the wrong enum
}));
}),);
TEST_F(TextToBinaryTest, InvalidText) {
ASSERT_EQ(SPV_ERROR_INVALID_TEXT,
@ -220,7 +220,7 @@ INSTANTIATE_TEST_CASE_P(
{"-2.5", 0xc0200000},
{"!0xff800000", 0xff800000}, // -inf
{"!0xff800001", 0xff800001}, // NaN
}));
}),);
using TextToBinaryHalfValueTest = spvtest::TextToBinaryTestBase<
::testing::TestWithParam<std::pair<std::string, uint32_t>>>;
@ -252,7 +252,7 @@ INSTANTIATE_TEST_CASE_P(
{"0x1.8p4", 0x00004e00},
{"0x1.801p4", 0x00004e00},
{"0x1.804p4", 0x00004e01},
}));
}),);
TEST(AssemblyContextParseNarrowSignedIntegers, Sample) {
AssemblyContext context(AutoText(""), nullptr);

View File

@ -37,6 +37,7 @@
namespace {
using std::pair;
using std::make_pair;
using std::stringstream;
@ -52,7 +53,7 @@ using ValidateCapability =
spvtest::ValidateBase<tuple<string, pair<string, vector<string>>>>;
TEST_F(ValidateCapability, Default) {
const char str[] = R"(
const char str[] = R"(
OpCapability Kernel
OpCapability Matrix
OpMemoryModel Logical OpenCL
@ -324,7 +325,7 @@ make_pair(string(kOpenCLMemoryModel) +
make_pair(string(kGLSL450MemoryModel) +
" OpEntryPoint Kernel %func \"shader\"" +
string(kVoidFVoid), KernelDependencies())
)));
)),);
INSTANTIATE_TEST_CASE_P(AddressingAndMemoryModel, ValidateCapability,
Combine(
@ -348,7 +349,7 @@ make_pair(" OpCapability Shader"
" OpMemoryModel Physical64 GLSL450", AddressesDependencies()),
make_pair(" OpCapability Kernel"
" OpMemoryModel Physical64 OpenCL", AddressesDependencies())
)));
)),);
INSTANTIATE_TEST_CASE_P(ExecutionMode, ValidateCapability,
Combine(
@ -486,7 +487,7 @@ make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Kernel %func \"shader\" "
"OpExecutionMode %func ContractionOff" +
string(kVoidFVoid), KernelDependencies())
)));
)),);
INSTANTIATE_TEST_CASE_P(StorageClass, ValidateCapability,
Combine(
@ -532,7 +533,7 @@ make_pair(string(kGLSL450MemoryModel) +
" %intt = OpTypeInt 32 0\n"
" %ptrt = OpTypePointer Image %intt\n"
" %var = OpVariable %ptrt Image\n", AllCapabilities())
)));
)),);
INSTANTIATE_TEST_CASE_P(Dim, ValidateCapability,
Combine(
@ -573,7 +574,7 @@ make_pair(" OpCapability ImageBasic" +
" %voidt = OpTypeVoid"
" %imgt = OpTypeImage %voidt SubpassData 0 0 0 2 Unknown",
vector<string>{"InputAttachment"})
)));
)),);
// NOTE: All Sampler Address Modes require kernel capabilities but the
// OpConstantSampler requires LiteralSampler which depends on Kernel
@ -601,7 +602,7 @@ make_pair(string(kGLSL450MemoryModel) +
" %samplert = OpTypeSampler"
" %sampler = OpConstantSampler %samplert RepeatMirrored 1 Nearest",
vector<string>{"LiteralSampler"})
)));
)),);
//TODO(umar): Sampler Filter Mode
//TODO(umar): Image Format
@ -744,7 +745,7 @@ make_pair(string(kOpenCLMemoryModel) +
make_pair(string(kGLSL450MemoryModel) +
"OpDecorate %intt Alignment 4\n"
"%intt = OpTypeInt 32 1\n", KernelDependencies())
)));
)),);
INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapability,
@ -880,7 +881,7 @@ make_pair(string(kOpenCLMemoryModel) +
make_pair(string(kOpenCLMemoryModel) +
"OpDecorate %intt BuiltIn InstanceIndex\n"
"%intt = OpTypeInt 32 1\n", ShaderDependencies())
)));
)),);
// TODO(umar): Selection Control
// TODO(umar): Loop Control
@ -899,7 +900,7 @@ INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateCapability,
make_pair(string(kOpenCLMemoryModel) +
"%intt = OpTypeInt 32 1\n"
"%vec3 = OpTypeVector %intt 3\n"
"%mat33 = OpTypeMatrix %vec3 3\n", MatrixDependencies()))));
"%mat33 = OpTypeMatrix %vec3 3\n", MatrixDependencies()))),);
// clang-format on
// Creates assembly containing an OpImageFetch instruction using operands for
@ -946,7 +947,7 @@ INSTANTIATE_TEST_CASE_P(
make_pair(ImageOperandsTemplate("Sample|MinLod %izero %fzero"),
vector<string>{"MinLod"}),
make_pair(ImageOperandsTemplate("Lod|Sample %fzero %izero"),
AllCapabilities()))));
AllCapabilities()))),);
// TODO(umar): Instruction capability checks

View File

@ -174,7 +174,7 @@ INSTANTIATE_TEST_CASE_P(InstructionsOrder,
, make_tuple(string("OpLabel") , Equals<36> , All)
, make_tuple(string("OpNop") , Equals<37> , All)
, make_tuple(string("OpReturn") , Equals<38> , All)
)));
)),);
// clang-format on
// Creates a new vector which removes the string if the substr is found in the

View File

@ -41,7 +41,6 @@ using std::pair;
using std::stringstream;
namespace {
using Validate = spvtest::ValidateBase<pair<string, bool>>;
TEST_F(Validate, Default) {
@ -759,7 +758,7 @@ pair<string, bool> cases[] = {
{"OpGetKernelWorkGroupSize", kNoNDrange},
{"OpGetKernelPreferredWorkGroupSizeMultiple", kNoNDrange}};
INSTANTIATE_TEST_CASE_P(KernelArgs, Validate, ::testing::ValuesIn(cases));
INSTANTIATE_TEST_CASE_P(KernelArgs, Validate, ::testing::ValuesIn(cases),);
static const string return_instructions = R"(
OpReturn

View File

@ -138,7 +138,7 @@ INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateStorage,
"Private",
"PushConstant",
"AtomicCounter",
"Image"));
"Image"),);
// clang-format on
TEST_F(ValidateStorage, GenericVariableOutsideFunction) {