diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-12-04 12:01:30 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-04 19:29:51 +0000 |
commit | 1ef80942b3b2414c862eb1e9ae301442b447c089 (patch) | |
tree | 27eb42492497d3516a008d1f038ce044d2c16c94 /src | |
parent | 364c4c87c1321625ae961d8f2cf315096ccfd462 (diff) |
turn on extended Clang warnings on Windows too
Plus some small rearrangements of the various warning lists.
Change-Id: Ied58f940341d69ddab971a529fd01b1e96b65641
Reviewed-on: https://skia-review.googlesource.com/67720
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrXferProcessor.h | 11 | ||||
-rw-r--r-- | src/gpu/effects/GrCoverageSetOpXP.h | 11 | ||||
-rw-r--r-- | src/gpu/effects/GrCustomXfermode.cpp | 11 | ||||
-rw-r--r-- | src/gpu/effects/GrDisableColorXP.h | 11 | ||||
-rw-r--r-- | src/gpu/effects/GrPorterDuffXferProcessor.h | 11 | ||||
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 10 | ||||
-rw-r--r-- | src/ports/SkFontMgr_win_dw.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkImageEncoder_WIC.cpp | 3 | ||||
-rw-r--r-- | src/ports/SkOSFile_win.cpp | 3 | ||||
-rw-r--r-- | src/ports/SkScalerContext_win_dw.h | 2 | ||||
-rw-r--r-- | src/utils/win/SkDWriteFontFileStream.h | 2 | ||||
-rw-r--r-- | src/utils/win/SkIStream.cpp | 20 | ||||
-rw-r--r-- | src/utils/win/SkTScopedComPtr.h | 1 | ||||
-rw-r--r-- | src/utils/win/SkWGL_win.cpp | 4 | ||||
-rw-r--r-- | src/xps/SkXPSDevice.h | 2 | ||||
-rw-r--r-- | src/xps/SkXPSDocument.h | 2 |
16 files changed, 72 insertions, 34 deletions
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h index 90b0de95df..5ede1ae828 100644 --- a/src/gpu/GrXferProcessor.h +++ b/src/gpu/GrXferProcessor.h @@ -244,10 +244,14 @@ private: // since these objects have no need for destructors. However, GCC and clang throw a warning when a // class has virtual functions and a non-virtual destructor. We suppress that warning here and // for the subclasses. -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif class GrXPFactory { public: typedef GrXferProcessor::DstProxy DstProxy; @@ -316,9 +320,12 @@ private: const GrCaps&, GrPixelConfigIsClamped) const = 0; }; -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic pop #endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif GR_MAKE_BITFIELD_CLASS_OPS(GrXPFactory::AnalysisProperties); diff --git a/src/gpu/effects/GrCoverageSetOpXP.h b/src/gpu/effects/GrCoverageSetOpXP.h index 72d1b01280..cf91848944 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.h +++ b/src/gpu/effects/GrCoverageSetOpXP.h @@ -13,10 +13,14 @@ #include "SkRegion.h" // See the comment above GrXPFactory's definition about this warning suppression. -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif /** * This xfer processor directly blends the the src coverage with the dst using a set operator. It is @@ -51,8 +55,11 @@ private: typedef GrXPFactory INHERITED; }; -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic pop #endif +#if defined(__clang__) +#pragma clang diagnostic pop #endif +#endif diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 98bda3e5e6..bdeda9467c 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -200,10 +200,14 @@ void CustomXP::onGetBlendInfo(BlendInfo* blendInfo) const { /////////////////////////////////////////////////////////////////////////////// // See the comment above GrXPFactory's definition about this warning suppression. -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif class CustomXPFactory : public GrXPFactory { public: constexpr CustomXPFactory(SkBlendMode mode) @@ -228,9 +232,12 @@ private: typedef GrXPFactory INHERITED; }; -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic pop #endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor( const GrProcessorAnalysisColor&, diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h index f1ac32bb4f..0c4f5cf2bb 100644 --- a/src/gpu/effects/GrDisableColorXP.h +++ b/src/gpu/effects/GrDisableColorXP.h @@ -13,10 +13,14 @@ #include "SkRefCnt.h" // See the comment above GrXPFactory's definition about this warning suppression. -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif class GrDisableColorXPFactory : public GrXPFactory { public: static const GrXPFactory* Get(); @@ -42,9 +46,12 @@ private: typedef GrXPFactory INHERITED; }; -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic pop #endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif inline const GrXPFactory* GrDisableColorXPFactory::Get() { // If this is constructed as static constexpr by cl.exe (2015 SP2) the vtable is null. diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h index 37cd6899da..74ae1533bf 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.h +++ b/src/gpu/effects/GrPorterDuffXferProcessor.h @@ -13,10 +13,14 @@ #include "SkBlendMode.h" // See the comment above GrXPFactory's definition about this warning suppression. -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif class GrPorterDuffXPFactory : public GrXPFactory { public: static const GrXPFactory* Get(SkBlendMode blendMode); @@ -62,8 +66,11 @@ private: friend class GrPorterDuffTest; // for TestGetXPOutputTypes() typedef GrXPFactory INHERITED; }; -#if defined(__GNUC__) || defined(__clang) +#if defined(__GNUC__) #pragma GCC diagnostic pop #endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif #endif diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 9094d7e2a4..ef17ca8af5 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -539,7 +539,7 @@ public: SkScalerContext_GDI(sk_sp<LogFontTypeface>, const SkScalerContextEffects&, const SkDescriptor* desc); - virtual ~SkScalerContext_GDI(); + ~SkScalerContext_GDI() override; // Returns true if the constructor was able to complete all of its // initializations (which may include calling GDI). @@ -821,7 +821,8 @@ uint16_t SkScalerContext_GDI::generateCharToGlyph(SkUnichar utf32) { static const int numWCHAR = 2; static const int maxItems = 2; // MSDN states that this can be nullptr, but some things don't work then. - SCRIPT_CONTROL sc = { 0 }; + SCRIPT_CONTROL sc; + memset(&sc, 0, sizeof(sc)); // Add extra item to SCRIPT_ITEM to work around a bug (now documented). // https://bugzilla.mozilla.org/show_bug.cgi?id=366643 SCRIPT_ITEM si[maxItems + 1]; @@ -1920,7 +1921,7 @@ SkStreamAsset* LogFontTypeface::onOpenStream(int* ttcIndex) const { SkMemoryStream* stream = nullptr; DWORD tables[2] = {kTTCTag, 0}; - for (int i = 0; i < SK_ARRAY_COUNT(tables); i++) { + for (size_t i = 0; i < SK_ARRAY_COUNT(tables); i++) { DWORD bufferSize = GetFontData(hdc, tables[i], 0, nullptr, 0); if (bufferSize == GDI_ERROR) { call_ensure_accessible(lf); @@ -1976,7 +1977,8 @@ static uint16_t nonBmpCharToGlyph(HDC hdc, SCRIPT_CACHE* scriptCache, const WCHA static const int numWCHAR = 2; static const int maxItems = 2; // MSDN states that this can be nullptr, but some things don't work then. - SCRIPT_CONTROL scriptControl = { 0 }; + SCRIPT_CONTROL scriptControl; + memset(&scriptControl, 0, sizeof(scriptControl)); // Add extra item to SCRIPT_ITEM to work around a bug (now documented). // https://bugzilla.mozilla.org/show_bug.cgi?id=366643 SCRIPT_ITEM si[maxItems + 1]; diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp index c2d9fefdc5..54de313c3b 100644 --- a/src/ports/SkFontMgr_win_dw.cpp +++ b/src/ports/SkFontMgr_win_dw.cpp @@ -911,7 +911,7 @@ sk_sp<SkTypeface> SkFontMgr_DirectWrite::onMakeFromStreamIndex(std::unique_ptr<S SkTScopedComPtr<IDWriteFontFace> fontFace; HRN(font->CreateFontFace(&fontFace)); - UINT32 faceIndex = fontFace->GetIndex(); + int faceIndex = fontFace->GetIndex(); if (faceIndex == ttcIndex) { return sk_sp<SkTypeface>(DWriteFontTypeface::Create(fFactory.get(), fontFace.get(), font.get(), fontFamily.get(), diff --git a/src/ports/SkImageEncoder_WIC.cpp b/src/ports/SkImageEncoder_WIC.cpp index dc5160413f..2e1dc8c833 100644 --- a/src/ports/SkImageEncoder_WIC.cpp +++ b/src/ports/SkImageEncoder_WIC.cpp @@ -156,7 +156,8 @@ bool SkEncodeImageWithWIC(SkWStream* stream, const SkPixmap& pixmap, } if (SUCCEEDED(hr)) { - PROPBAG2 name = { 0 }; + PROPBAG2 name; + memset(&name, 0, sizeof(name)); name.dwType = PROPBAG2_TYPE_DATA; name.vt = VT_R4; name.pstrName = const_cast<LPOLESTR>(L"ImageQuality"); diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp index 7e194cf287..50ca264d19 100644 --- a/src/ports/SkOSFile_win.cpp +++ b/src/ports/SkOSFile_win.cpp @@ -132,7 +132,8 @@ size_t sk_qread(FILE* file, void* buffer, size_t count, size_t offset) { return SIZE_MAX; } - OVERLAPPED overlapped = {0}; + OVERLAPPED overlapped; + memset(&overlapped, 0, sizeof(overlapped)); ULARGE_INTEGER winOffset; winOffset.QuadPart = offset; overlapped.Offset = winOffset.LowPart; diff --git a/src/ports/SkScalerContext_win_dw.h b/src/ports/SkScalerContext_win_dw.h index 9b0f244417..6d09855884 100644 --- a/src/ports/SkScalerContext_win_dw.h +++ b/src/ports/SkScalerContext_win_dw.h @@ -24,7 +24,7 @@ public: SkScalerContext_DW(sk_sp<DWriteFontTypeface>, const SkScalerContextEffects&, const SkDescriptor*); - virtual ~SkScalerContext_DW(); + ~SkScalerContext_DW() override; protected: unsigned generateGlyphCount() override; diff --git a/src/utils/win/SkDWriteFontFileStream.h b/src/utils/win/SkDWriteFontFileStream.h index 680b3ab8a8..bdc66c79b9 100644 --- a/src/utils/win/SkDWriteFontFileStream.h +++ b/src/utils/win/SkDWriteFontFileStream.h @@ -23,7 +23,7 @@ class SkDWriteFontFileStream : public SkStreamMemory { public: explicit SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream); - virtual ~SkDWriteFontFileStream(); + ~SkDWriteFontFileStream() override; size_t read(void* buffer, size_t size) override; bool isAtEnd() const override; diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp index 560a947fcf..161206fc08 100644 --- a/src/utils/win/SkIStream.cpp +++ b/src/utils/win/SkIStream.cpp @@ -153,22 +153,20 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove if (!this->fSkStream->rewind()) { hr = E_FAIL; } else { - size_t skipped = this->fSkStream->skip( - static_cast<size_t>(liDistanceToMove.QuadPart) - ); + size_t skip = static_cast<size_t>(liDistanceToMove.QuadPart); + size_t skipped = this->fSkStream->skip(skip); this->fLocation.QuadPart = skipped; - if (skipped != liDistanceToMove.QuadPart) { + if (skipped != skip) { hr = E_FAIL; } } break; } case STREAM_SEEK_CUR: { - size_t skipped = this->fSkStream->skip( - static_cast<size_t>(liDistanceToMove.QuadPart) - ); + size_t skip = static_cast<size_t>(liDistanceToMove.QuadPart); + size_t skipped = this->fSkStream->skip(skip); this->fLocation.QuadPart += skipped; - if (skipped != liDistanceToMove.QuadPart) { + if (skipped != skip) { hr = E_FAIL; } break; @@ -179,9 +177,9 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove } else { // FIXME: Should not depend on getLength. // See https://code.google.com/p/skia/issues/detail?id=1570 - LONGLONG skip = this->fSkStream->getLength() - + liDistanceToMove.QuadPart; - size_t skipped = this->fSkStream->skip(static_cast<size_t>(skip)); + size_t skip = static_cast<size_t>(this->fSkStream->getLength() + + liDistanceToMove.QuadPart); + size_t skipped = this->fSkStream->skip(skip); this->fLocation.QuadPart = skipped; if (skipped != skip) { hr = E_FAIL; diff --git a/src/utils/win/SkTScopedComPtr.h b/src/utils/win/SkTScopedComPtr.h index f44740ff44..8b12c07e5a 100644 --- a/src/utils/win/SkTScopedComPtr.h +++ b/src/utils/win/SkTScopedComPtr.h @@ -17,6 +17,7 @@ class SkBlockComRef : public T { private: virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; virtual ULONG STDMETHODCALLTYPE Release(void) = 0; + virtual ~SkBlockComRef() {} }; template<typename T> T* SkRefComPtr(T* ptr) { diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp index 016b61b2bf..0c1752a06a 100644 --- a/src/utils/win/SkWGL_win.cpp +++ b/src/utils/win/SkWGL_win.cpp @@ -381,7 +381,7 @@ static HGLRC create_gl_context(HDC dc, const SkWGLExtensions& extensions, SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT, 0, }; - for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) { + for (size_t v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) { coreProfileAttribs[1] = kCoreGLVersions[2 * v]; coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1]; glrc = extensions.createContextAttribs(dc, shareContext, coreProfileAttribs); @@ -423,7 +423,7 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor, int pixelFormatsToTry[] = { -1, -1 }; get_pixel_formats_to_try(dc, extensions, true, msaaSampleCount, deepColor, pixelFormatsToTry); - for (int f = 0; + for (size_t f = 0; !set && -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry); ++f) { PIXELFORMATDESCRIPTOR pfd; diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h index 7aa60a0830..a5ee07634c 100644 --- a/src/xps/SkXPSDevice.h +++ b/src/xps/SkXPSDevice.h @@ -39,7 +39,7 @@ class SkXPSDevice : public SkClipStackDevice { public: SK_API SkXPSDevice(SkISize); - SK_API virtual ~SkXPSDevice(); + SK_API ~SkXPSDevice() override; bool beginPortfolio(SkWStream* outputStream, IXpsOMObjectFactory*); /** diff --git a/src/xps/SkXPSDocument.h b/src/xps/SkXPSDocument.h index cccfc1f777..f436db1c42 100644 --- a/src/xps/SkXPSDocument.h +++ b/src/xps/SkXPSDocument.h @@ -21,7 +21,7 @@ class SkXPSDocument final : public SkDocument { public: SkXPSDocument(SkWStream*, SkScalar dpi, SkTScopedComPtr<IXpsOMObjectFactory>); - virtual ~SkXPSDocument(); + ~SkXPSDocument() override; protected: SkCanvas* onBeginPage(SkScalar w, SkScalar h) override; |