Commit 17f2ca69 authored by Milo Yip's avatar Milo Yip

Try to fix clang and gcc warnings problems

parent 74c8dcfd
...@@ -30,6 +30,7 @@ RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant ...@@ -30,6 +30,7 @@ RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(padded) RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(switch-enum)
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
...@@ -724,9 +725,7 @@ public: ...@@ -724,9 +725,7 @@ public:
else else
return data_.n.u64 == rhs.data_.n.u64; return data_.n.u64 == rhs.data_.n.u64;
case kNullType: default:
case kFalseType:
case kTrueType:
return true; return true;
} }
} }
...@@ -2106,10 +2105,7 @@ GenericValue<Encoding,Allocator>::GenericValue(const GenericValue<Encoding,Sourc ...@@ -2106,10 +2105,7 @@ GenericValue<Encoding,Allocator>::GenericValue(const GenericValue<Encoding,Sourc
SetStringRaw(StringRef(rhs.GetString(), rhs.GetStringLength()), allocator); SetStringRaw(StringRef(rhs.GetString(), rhs.GetStringLength()), allocator);
} }
break; break;
case kNullType: default:
case kFalseType:
case kTrueType:
case kNumberType:
flags_ = rhs.flags_; flags_ = rhs.flags_;
data_ = *reinterpret_cast<const Data*>(&rhs.data_); data_ = *reinterpret_cast<const Data*>(&rhs.data_);
break; break;
......
...@@ -42,6 +42,7 @@ RAPIDJSON_DIAG_OFF(4702) // unreachable code ...@@ -42,6 +42,7 @@ RAPIDJSON_DIAG_OFF(4702) // unreachable code
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(padded) RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(switch-enum)
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
...@@ -1417,9 +1418,7 @@ private: ...@@ -1417,9 +1418,7 @@ private:
} }
} }
case IterativeParsingStartState: default:
case IterativeParsingFinishState:
case IterativeParsingValueState:
// This branch is for IterativeParsingValueState actually. // This branch is for IterativeParsingValueState actually.
// Use `default:` rather than // Use `default:` rather than
// `case IterativeParsingValueState:` is for code coverage. // `case IterativeParsingValueState:` is for code coverage.
...@@ -1456,13 +1455,7 @@ private: ...@@ -1456,13 +1455,7 @@ private:
case IterativeParsingMemberKeyState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissColon, is.Tell()); return; case IterativeParsingMemberKeyState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissColon, is.Tell()); return;
case IterativeParsingMemberValueState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); return; case IterativeParsingMemberValueState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); return;
case IterativeParsingElementState: RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); return; case IterativeParsingElementState: RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); return;
case IterativeParsingErrorState: default: RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); return;
case IterativeParsingKeyValueDelimiterState:
case IterativeParsingObjectFinishState:
case IterativeParsingArrayInitialState:
case IterativeParsingElementDelimiterState:
case IterativeParsingArrayFinishState:
case IterativeParsingValueState: RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); return;
} }
} }
......
...@@ -19,8 +19,10 @@ ...@@ -19,8 +19,10 @@
#ifndef __STDC_CONSTANT_MACROS #ifndef __STDC_CONSTANT_MACROS
#ifdef __clang__ #ifdef __clang__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#if __has_warning("-Wreserved-id-macro")
#pragma GCC diagnostic ignored "-Wreserved-id-macro" #pragma GCC diagnostic ignored "-Wreserved-id-macro"
#endif #endif
#endif
# define __STDC_CONSTANT_MACROS 1 // required by C++ standard # define __STDC_CONSTANT_MACROS 1 // required by C++ standard
......
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