From d6cdf71273a82e1674f340a7fe65330fa1bfdf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 27 Jun 2017 20:52:37 -0700 Subject: [PATCH] GCC7 fallthrough. --- src/shader_dx9bc.cpp | 24 +++++----- src/shader_dxbc.cpp | 12 ++--- src/vertexdecl.cpp | 108 +++++++++++++++++++++---------------------- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/shader_dx9bc.cpp b/src/shader_dx9bc.cpp index b3f7c43ba..a136b9249 100644 --- a/src/shader_dx9bc.cpp +++ b/src/shader_dx9bc.cpp @@ -443,12 +443,12 @@ namespace bgfx switch (_instruction.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++], _err); - case 5: size += read(_reader, _instruction.operand[currOp++], _err); - case 4: size += read(_reader, _instruction.operand[currOp++], _err); - case 3: size += read(_reader, _instruction.operand[currOp++], _err); - case 2: size += read(_reader, _instruction.operand[currOp++], _err); - case 1: size += read(_reader, _instruction.operand[currOp++], _err); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: if (!valuesBeforeOpcode && 0 < info.numValues) @@ -482,12 +482,12 @@ namespace bgfx uint32_t currOp = 0; switch (_instruction.numOperands) { - case 6: size += write(_writer, _instruction.operand[currOp++], _err); - case 5: size += write(_writer, _instruction.operand[currOp++], _err); - case 4: size += write(_writer, _instruction.operand[currOp++], _err); - case 3: size += write(_writer, _instruction.operand[currOp++], _err); - case 2: size += write(_writer, _instruction.operand[currOp++], _err); - case 1: size += write(_writer, _instruction.operand[currOp++], _err); + case 6: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: break; } diff --git a/src/shader_dxbc.cpp b/src/shader_dxbc.cpp index f0a76bd01..908fd11d6 100644 --- a/src/shader_dxbc.cpp +++ b/src/shader_dxbc.cpp @@ -1279,12 +1279,12 @@ namespace bgfx _instruction.numOperands = info.numOperands; switch (info.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++], _err); - case 5: size += read(_reader, _instruction.operand[currOp++], _err); - case 4: size += read(_reader, _instruction.operand[currOp++], _err); - case 3: size += read(_reader, _instruction.operand[currOp++], _err); - case 2: size += read(_reader, _instruction.operand[currOp++], _err); - case 1: size += read(_reader, _instruction.operand[currOp++], _err); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: if (0 < info.numValues) { diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index a8d8ae420..9497ec0be 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -393,9 +393,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); - case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); - case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); + default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); } } @@ -403,9 +403,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++ * 255.0f); - case 3: *packed++ = uint8_t(*_input++ * 255.0f); - case 2: *packed++ = uint8_t(*_input++ * 255.0f); + default: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++ * 255.0f); } } @@ -414,9 +414,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++); - case 3: *packed++ = uint8_t(*_input++); - case 2: *packed++ = uint8_t(*_input++); + default: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++); } } @@ -432,9 +432,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); - case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); } } @@ -442,9 +442,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++ * 1023.0f); - case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); } } @@ -453,9 +453,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++); - case 2: packed <<= 10; packed |= uint32_t(*_input++); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++); } } @@ -472,9 +472,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++ * 32767.0f); - case 3: *packed++ = int16_t(*_input++ * 32767.0f); - case 2: *packed++ = int16_t(*_input++ * 32767.0f); + default: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++ * 32767.0f); } } @@ -482,9 +482,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); - case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); - case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); + default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); } } @@ -493,9 +493,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++); - case 3: *packed++ = int16_t(*_input++); - case 2: *packed++ = int16_t(*_input++); + default: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++); } } @@ -507,9 +507,9 @@ namespace bgfx uint16_t* packed = (uint16_t*)data; switch (num) { - default: *packed++ = bx::halfFromFloat(*_input++); - case 3: *packed++ = bx::halfFromFloat(*_input++); - case 2: *packed++ = bx::halfFromFloat(*_input++); + default: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; case 1: *packed++ = bx::halfFromFloat(*_input++); } } @@ -548,9 +548,9 @@ namespace bgfx { switch (num) { - default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; - case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; - case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; + default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; + case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; + case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; case 1: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; } } @@ -558,9 +558,9 @@ namespace bgfx { switch (num) { - default: *_output++ = float(*packed++)*1.0f/255.0f; - case 3: *_output++ = float(*packed++)*1.0f/255.0f; - case 2: *_output++ = float(*packed++)*1.0f/255.0f; + default: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; + case 3: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; + case 2: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; case 1: *_output++ = float(*packed++)*1.0f/255.0f; } } @@ -574,9 +574,9 @@ namespace bgfx { switch (num) { - default: - case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; - case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; + default: BX_FALLTHROUGH; + case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH; + case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH; case 1: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; } } @@ -584,9 +584,9 @@ namespace bgfx { switch (num) { - default: - case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; - case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; + default: BX_FALLTHROUGH; + case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH; + case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH; case 1: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; } } @@ -600,9 +600,9 @@ namespace bgfx { switch (num) { - default: *_output++ = float(*packed++)*1.0f/32767.0f; - case 3: *_output++ = float(*packed++)*1.0f/32767.0f; - case 2: *_output++ = float(*packed++)*1.0f/32767.0f; + default: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; + case 3: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; + case 2: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; case 1: *_output++ = float(*packed++)*1.0f/32767.0f; } } @@ -610,9 +610,9 @@ namespace bgfx { switch (num) { - default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; - case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; - case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; + default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; + case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; + case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; case 1: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; } } @@ -624,9 +624,9 @@ namespace bgfx uint16_t* packed = (uint16_t*)data; switch (num) { - default: *_output++ = bx::halfToFloat(*packed++); - case 3: *_output++ = bx::halfToFloat(*packed++); - case 2: *_output++ = bx::halfToFloat(*packed++); + default: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; + case 3: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; + case 2: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; case 1: *_output++ = bx::halfToFloat(*packed++); } } @@ -640,9 +640,9 @@ namespace bgfx switch (num) { - case 1: *_output++ = 0.0f; - case 2: *_output++ = 0.0f; - case 3: *_output++ = 0.0f; + case 1: *_output++ = 0.0f; BX_FALLTHROUGH; + case 2: *_output++ = 0.0f; BX_FALLTHROUGH; + case 3: *_output++ = 0.0f; BX_FALLTHROUGH; default: break; } }