vcl/inc/skia/utils.hxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 440230f1802ce03f83aa92d1b56806e068ce4800
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Jan 30 17:53:23 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Jan 30 18:50:46 2023 +0000

    Silence two GCC warnings in Skia include files
    
    Since 9c9a711ac5d8f32ac318d0e4ecab7b3a26bc2150 "Update skia to m111", 
various
    versions of GCC produce
    
    > In file included from 
workdir/UnpackedTarball/skia/include/gpu/GrRecordingContext.h:13,
    >                  from 
workdir/UnpackedTarball/skia/include/gpu/GrDirectContext.h:11,
    >                  from 
workdir/UnpackedTarball/skia/tools/sk_app/WindowContext.h:14,
    >                  from vcl/inc/skia/utils.hxx:35,
    >                  from vcl/skia/SkiaHelper.cxx:34:
    > workdir/UnpackedTarball/skia/include/private/base/SkTArray.h:520:33: 
error: ‘cfi’ attribute directive ignored [-Werror=attributes]
    >   520 |     static T* TCast(void* buffer) {
    >       |                                 ^
    > workdir/UnpackedTarball/skia/include/private/base/SkTArray.h: In 
constructor ‘SkSTArray<N, T, MEM_MOVE>::SkSTArray(std::initializer_list<_Up>)’:
    > workdir/UnpackedTarball/skia/include/private/base/SkTArray.h:654:40: 
error: declaration of ‘data’ shadows a member of ‘SkSTArray<N, T, MEM_MOVE>’ 
[-Werror=shadow]
    >   654 |     SkSTArray(std::initializer_list<T> data) : 
SkSTArray(data.begin(), SkToInt(data.size())) {}
    >       |               ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
    > workdir/UnpackedTarball/skia/include/private/base/SkTArray.h:684:22: 
note: shadowed declaration is here
    >   684 |     using INHERITED::data;
    >       |                      ^~~~
    
    The -Werror=attributes is because GCC __attribute__((no_sanitize("...")))
    accepts the same values as -fsanitize, but GCC doesn't support Clang's
    -fsanitize=cfi.
    
    The -Werror=shadow is because GCC is somewhat picky about uses of a name 
for a
    variable when that name is also brought in by a using declaration from a
    dependent base, as it /could/ be brought in as a variable (and not just as a
    function, in which case there would normally be no such shadowing warning):
    
    > $ cat test.cc
    > template<typename> struct SkTArray { void data(); };
    > template<typename T> struct SkSTArray: SkTArray<T> {
    >     SkSTArray(int data) { (void) data; }
    >     using SkTArray<T>::data;
    > };
    > $ g++ -Wshadow -fsyntax-only test.cc
    > test.cc: In constructor ‘SkSTArray<T>::SkSTArray(int)’:
    > test.cc:3:19: warning: declaration of ‘data’ shadows a member of 
‘SkSTArray<T>’ [-Wshadow]
    >     3 |     SkSTArray(int data) { (void) data; }
    >       |               ~~~~^~~~
    > test.cc:4:24: note: shadowed declaration is here
    >     4 |     using SkTArray<T>::data;
    >       |                        ^~~~
    
    It feels more natural to silence these warnings at the site including the
    relevant Skia include files, rather than as a patch to external/skia, as, at
    least theoretically, we should also be able to build against a system's Skia
    include files.
    
    Change-Id: I0860b6a84e61da656038da8c77f3947d97ad8cf5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146364
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx
index 355718e8bfa1..3c19192e1c3a 100644
--- a/vcl/inc/skia/utils.hxx
+++ b/vcl/inc/skia/utils.hxx
@@ -32,7 +32,15 @@
 #include <premac.h>
 #include <SkRegion.h>
 #include <SkSurface.h>
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
 #include <tools/sk_app/WindowContext.h>
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
 #include <postmac.h>
 
 #include <string_view>

Reply via email to