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