clang: Enable -Weverything, fix all warnings
This change fixes the following warnings:
```
-Wc++98-compat-extra-semi
-Wc++98-compat-local-type-template-args
-Wc++98-compat-pedantic
-Wc++98-compat
-Wcomma
-Wdeprecated-copy-dtor
-Wexit-time-destructors
-Wextra-semi-stmt
-Wextra-semi
-Wfloat-conversion
-Wfloat-equal
-Wformat-nonliteral
-Wglobal-constructors
-Winconsistent-missing-destructor-override
-Wnon-virtual-dtor
-Wold-style-cast
-Wpadded
-Wreturn-std-move-in-c++11
-Wshadow-field-in-constructor
-Wshadow-uncaptured-local
-Wshift-sign-overflow
-Wsign-conversion
-Wundef
-Wunreachable-code-return
-Wused-but-marked-unused
-Wweak-vtables
-Wzero-as-null-pointer-constant
```
This commit is contained in:
@@ -26,7 +26,7 @@ namespace dap {
|
||||
// template type T.
|
||||
template <typename T>
|
||||
struct BasicTypeInfo : public TypeInfo {
|
||||
BasicTypeInfo(const std::string& name) : name_(name) {}
|
||||
constexpr BasicTypeInfo(std::string&& name) : name_(std::move(name)) {}
|
||||
|
||||
// TypeInfo compliance
|
||||
inline std::string name() const { return name_; }
|
||||
@@ -88,6 +88,15 @@ struct TypeOf<null> {
|
||||
static const TypeInfo* type();
|
||||
};
|
||||
|
||||
// TypeOf for template types requires dynamic generation of type information,
|
||||
// triggering the clang -Wexit-time-destructors warning.
|
||||
// TODO(bclayton): See if there's a way to avoid this, without requiring manual
|
||||
// instantiation of each type.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||
#endif // __clang__
|
||||
|
||||
template <typename T>
|
||||
struct TypeOf<array<T>> {
|
||||
static inline const TypeInfo* type() {
|
||||
@@ -114,6 +123,10 @@ struct TypeOf<optional<T>> {
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
// DAP_OFFSETOF() macro is a generalization of the offsetof() macro defined in
|
||||
// <cstddef>. It evaluates to the offset of the given field, with fewer
|
||||
// restrictions than offsetof(). We cast the address '32' and subtract it again,
|
||||
|
||||
Reference in New Issue
Block a user