Fix gcc warning

This commit is contained in:
Zihan Chen
2020-12-29 01:47:16 -08:00
parent cea0a05d88
commit 72c71560a6
3 changed files with 39 additions and 30 deletions
+4
View File
@@ -1691,6 +1691,8 @@ Locale
return wcscmp(s1.Buffer(), s2.Buffer()); return wcscmp(s1.Buffer(), s2.Buffer());
case Normalization::IgnoreCase: case Normalization::IgnoreCase:
return wcscasecmp(s1.Buffer(), s2.Buffer()); return wcscasecmp(s1.Buffer(), s2.Buffer());
default:
return 0;
} }
#endif #endif
} }
@@ -1832,6 +1834,7 @@ Locale
case Normalization::IgnoreCase: case Normalization::IgnoreCase:
return wcsncasecmp(text.Buffer(), find.Buffer(), find.Length()) == 0; return wcsncasecmp(text.Buffer(), find.Buffer(), find.Length()) == 0;
} }
return false;
#endif #endif
} }
@@ -1852,6 +1855,7 @@ Locale
case Normalization::IgnoreCase: case Normalization::IgnoreCase:
return wcsncasecmp(text.Buffer() + text.Length() - find.Length(), find.Buffer(), find.Length()) == 0; return wcsncasecmp(text.Buffer() + text.Length() - find.Length(), find.Buffer(), find.Length()) == 0;
} }
return false;
#endif #endif
} }
} }
+7 -2
View File
@@ -144,9 +144,12 @@ DescriptableObject
{ {
} }
#if defined(VCZH_GCC) && defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wexceptions" #pragma clang diagnostic ignored "-Wexceptions"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wterminate"
#endif #endif
DescriptableObject::~DescriptableObject() DescriptableObject::~DescriptableObject()
{ {
@@ -179,8 +182,10 @@ DescriptableObject
} }
#endif #endif
} }
#if defined(VCZH_GCC) && defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
+28 -28
View File
@@ -1832,18 +1832,18 @@ ValueType
template<typename U = T> template<typename U = T>
static CompareResult ComparePrimitiveInternal(const U& a, const U& b, double) static CompareResult ComparePrimitiveInternal(const U& a, const U& b, double)
{ {
#if defined(__GNUC__) #if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdynamic-class-memaccess"
#elif defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdynamic-class-memaccess" #pragma clang diagnostic ignored "-Wdynamic-class-memaccess"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif #endif
auto result = memcmp(&a, &b, sizeof(U)); auto result = memcmp(&a, &b, sizeof(U));
#if defined(__GNUC__) #if defined(__clang__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
if (result < 0) return IBoxedValue::Smaller; if (result < 0) return IBoxedValue::Smaller;
if (result > 0) return IBoxedValue::Greater; if (result > 0) return IBoxedValue::Greater;
@@ -3774,9 +3774,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::FunctionType> struct TypeFlagTester<TDerived, TypeFlags::FunctionType>
{ {
template<typename T> template<typename T>
static void* Inherit(const Func<T>* source){} static void* Inherit(const Func<T>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::FunctionType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::FunctionType:TypeFlags::NonGenericType;
}; };
@@ -3785,9 +3785,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::EnumerableType> struct TypeFlagTester<TDerived, TypeFlags::EnumerableType>
{ {
template<typename T> template<typename T>
static void* Inherit(const collections::LazyList<T>* source){} static void* Inherit(const collections::LazyList<T>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::EnumerableType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::EnumerableType:TypeFlags::NonGenericType;
}; };
@@ -3796,9 +3796,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::ReadonlyListType> struct TypeFlagTester<TDerived, TypeFlags::ReadonlyListType>
{ {
template<typename T> template<typename T>
static void* Inherit(const collections::IEnumerable<T>* source){} static void* Inherit(const collections::IEnumerable<T>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ReadonlyListType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ReadonlyListType:TypeFlags::NonGenericType;
}; };
@@ -3807,9 +3807,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::ListType> struct TypeFlagTester<TDerived, TypeFlags::ListType>
{ {
template<typename T> template<typename T>
static void* Inherit(collections::IEnumerable<T>* source){} static void* Inherit(collections::IEnumerable<T>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ListType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ListType:TypeFlags::NonGenericType;
}; };
@@ -3818,9 +3818,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::ObservableListType> struct TypeFlagTester<TDerived, TypeFlags::ObservableListType>
{ {
template<typename T> template<typename T>
static void* Inherit(collections::ObservableList<T>* source) {} static void* Inherit(collections::ObservableList<T>* source) { return {}; }
static char Inherit(void* source) {} static char Inherit(void* source) { return {}; }
static char Inherit(const void* source) {} static char Inherit(const void* source) { return {}; }
static const TypeFlags Result = sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer)) == sizeof(void*) ? TypeFlags::ObservableListType : TypeFlags::NonGenericType; static const TypeFlags Result = sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer)) == sizeof(void*) ? TypeFlags::ObservableListType : TypeFlags::NonGenericType;
}; };
@@ -3829,9 +3829,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::ReadonlyDictionaryType> struct TypeFlagTester<TDerived, TypeFlags::ReadonlyDictionaryType>
{ {
template<typename K, typename V> template<typename K, typename V>
static void* Inherit(const collections::Dictionary<K, V>* source){} static void* Inherit(const collections::Dictionary<K, V>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ReadonlyDictionaryType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ReadonlyDictionaryType:TypeFlags::NonGenericType;
}; };
@@ -3840,9 +3840,9 @@ TypeFlagTester
struct TypeFlagTester<TDerived, TypeFlags::DictionaryType> struct TypeFlagTester<TDerived, TypeFlags::DictionaryType>
{ {
template<typename K, typename V> template<typename K, typename V>
static void* Inherit(collections::Dictionary<K, V>* source){} static void* Inherit(collections::Dictionary<K, V>* source){ return {}; }
static char Inherit(void* source){} static char Inherit(void* source){ return {}; }
static char Inherit(const void* source){} static char Inherit(const void* source){ return {}; }
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::DictionaryType:TypeFlags::NonGenericType; static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::DictionaryType:TypeFlags::NonGenericType;
}; };