Commit e2cd486e authored by Milo Yip's avatar Milo Yip

Fixes -Wswitch-default warnings

parent 469333af
......@@ -64,7 +64,7 @@ solution "test"
defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "gmake"
buildoptions "-msse4.2 -Werror -Wall -Wextra"
buildoptions "-msse4.2 -Werror -Wall -Wextra -Wswitch-default"
project "gtest"
kind "StaticLib"
......@@ -154,7 +154,7 @@ solution "example"
defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "gmake"
buildoptions "-Werror -Wall -Wextra -Weffc++"
buildoptions "-Werror -Wall -Wextra -Weffc++ -Wswitch-default"
project "condense"
kind "ConsoleApp"
......
......@@ -319,6 +319,9 @@ public:
case kCopyStringFlag:
Allocator::Free(const_cast<Ch*>(data_.s.str));
break;
default:
break; // Do nothing for other types.
}
}
}
......@@ -794,6 +797,9 @@ int z = a[0u].GetInt(); // This works too.
else if (IsUint64()) handler.Uint64(data_.n.u64);
else handler.Double(data_.n.d);
break;
default:
RAPIDJSON_ASSERT(false);
}
return *this;
}
......
......@@ -158,10 +158,11 @@ private:
case 0x01: type_ = kUTF32LE; break;
case 0x05: type_ = kUTF16LE; break;
case 0x0F: type_ = kUTF8; break;
default: break; // Use type defined by user.
}
}
// RUntime check whether the size of character type is sufficient. It only perform checks with assertion.
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
switch (type_) {
case kUTF8:
// Do nothing
......@@ -174,6 +175,8 @@ private:
case kUTF32BE:
RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
break;
default:
RAPIDJSON_ASSERT(false); // Invalid type
}
}
......@@ -216,6 +219,8 @@ public:
case kUTF8:
// Do nothing
break;
default:
RAPIDJSON_ASSERT(false); // Invalid UTFType
}
static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment