From a1d6da46247de12c107e4b9be6944c870652891d Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 29 Nov 2018 17:07:20 +0100 Subject: [PATCH] Silence compiler warning Silence compiler warnings about methods with return value and potentially not returning anything. This happens with gcc8 and the `-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -std=c++11` flags passed to it by default on openSUSE. --- src/modules/data/HashFunction.cpp | 1 + src/modules/graphics/vertex.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/modules/data/HashFunction.cpp b/src/modules/data/HashFunction.cpp index 87a05f864..13a5d14e9 100644 --- a/src/modules/data/HashFunction.cpp +++ b/src/modules/data/HashFunction.cpp @@ -608,6 +608,7 @@ HashFunction *HashFunction::getHashFunction(Function function) return nullptr; // No default for compiler warnings } + return nullptr; } bool HashFunction::getConstant(const char *in, Function &out) diff --git a/src/modules/graphics/vertex.cpp b/src/modules/graphics/vertex.cpp index df62aae58..b6be658c2 100644 --- a/src/modules/graphics/vertex.cpp +++ b/src/modules/graphics/vertex.cpp @@ -64,6 +64,7 @@ size_t getFormatStride(CommonFormat format) case CommonFormat::XYf_STPf_RGBAub: return sizeof(XYf_STPf_RGBAub); } + return 0; } uint32 getFormatFlags(CommonFormat format) @@ -88,6 +89,7 @@ uint32 getFormatFlags(CommonFormat format) case CommonFormat::XYf_STPf_RGBAub: return ATTRIBFLAG_POS | ATTRIBFLAG_TEXCOORD | ATTRIBFLAG_COLOR; } + return 0; } int getFormatPositionComponents(CommonFormat format) @@ -109,6 +111,7 @@ int getFormatPositionComponents(CommonFormat format) case CommonFormat::XYZf: return 3; } + return 0; } size_t getIndexDataSize(IndexDataType type) @@ -157,6 +160,7 @@ int getIndexCount(TriangleIndexMode mode, int vertexCount) case TriangleIndexMode::QUADS: return vertexCount * 6 / 4; } + return 0; } template