From 936d105589da409260c6310dc0a3a95b111602e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 27 Jun 2017 20:26:31 -0700 Subject: [PATCH] Fixed some GCC7 warnings. --- examples/20-nanovg/nanovg.cpp | 12 ++++++------ examples/27-terrain/terrain.cpp | 2 +- scripts/shaderc.lua | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/20-nanovg/nanovg.cpp b/examples/20-nanovg/nanovg.cpp index 1e22828d6..19d504fb6 100644 --- a/examples/20-nanovg/nanovg.cpp +++ b/examples/20-nanovg/nanovg.cpp @@ -73,12 +73,12 @@ static char* cpToUTF8(int cp, char* str) str[n] = '\0'; switch (n) { - case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; - case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; - case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; - case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; - case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; - case 1: str[0] = char(cp); + case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; BX_FALLTHROUGH; + case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; BX_FALLTHROUGH; + case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; BX_FALLTHROUGH; + case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; BX_FALLTHROUGH; + case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; BX_FALLTHROUGH; + case 1: str[0] = char(cp); BX_FALLTHROUGH; } return str; } diff --git a/examples/27-terrain/terrain.cpp b/examples/27-terrain/terrain.cpp index bd90cd022..398fc1c6d 100644 --- a/examples/27-terrain/terrain.cpp +++ b/examples/27-terrain/terrain.cpp @@ -319,7 +319,7 @@ public: float brushAttn = m_brush.m_size - bx::fsqrt(a2 + b2); // Raise/Lower and scale by brush power. - height += (bx::fclamp(brushAttn * m_brush.m_power, 0.0, m_brush.m_power) * m_brush.m_raise) + height += 0.0f < bx::fclamp(brushAttn*m_brush.m_power, 0.0f, m_brush.m_power) && m_brush.m_raise ? 1.0f : -1.0f ; diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index 18d9988c3..d61ace02c 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -213,6 +213,11 @@ project "fcpp" "/wd4706", -- warning C4706: assignment within conditional expression } + configuration { "not vs*" } + buildoptions { + "-Wno-implicit-fallthrough", + } + configuration {} project "shaderc"