Browse Source

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.
Michael Vetter 6 years ago
parent
commit
a1d6da4624
2 changed files with 5 additions and 0 deletions
  1. 1 0
      src/modules/data/HashFunction.cpp
  2. 4 0
      src/modules/graphics/vertex.cpp

+ 1 - 0
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)

+ 4 - 0
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 <typename T>