Silence C++20 volatile increment deprecation warnings

...as seen with path set 2 of <https://gerrit.libreoffice.org/c/core/+/155121/2>
"Bump baseline to C++20",

> In file included from /home/tdf/lode/jenkins/workspace/android_arm/vcl/source/app/watchdog.cxx:19:
> In file included from /home/tdf/lode/jenkins/workspace/android_arm/vcl/inc/opengl/zone.hxx:16:
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:59:39: error: increment of object of volatile-qualified type 'CrashZone::AtomicCounter' (aka 'volatile unsigned int') is deprecated [-Werror,-Wdeprecated-volatile]
>     static void enter() { gnEnterCount++; }
>                                       ^
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:60:39: error: increment of object of volatile-qualified type 'CrashZone::AtomicCounter' (aka 'volatile unsigned int') is deprecated [-Werror,-Wdeprecated-volatile]
>     static void leave() { gnLeaveCount++; }
>                                       ^
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:59:39: error: increment of object of volatile-qualified type 'CrashZone::AtomicCounter' (aka 'volatile unsigned int') is deprecated [-Werror,-Wdeprecated-volatile]
>     static void enter() { gnEnterCount++; }
>                                       ^
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:54:19: note: in instantiation of member function 'CrashZone<SkiaZone>::enter' requested here
>     CrashZone() { enter(); }
>                   ^
> /home/tdf/lode/jenkins/workspace/android_arm/vcl/inc/skia/zone.hxx:23:5: note: in instantiation of member function 'CrashZone<SkiaZone>::CrashZone' requested here
>     SkiaZone() { assert(comphelper::SolarMutex::get()->IsCurrentThread()); }
>     ^
> In file included from /home/tdf/lode/jenkins/workspace/android_arm/vcl/source/app/watchdog.cxx:19:
> In file included from /home/tdf/lode/jenkins/workspace/android_arm/vcl/inc/opengl/zone.hxx:16:
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:60:39: error: increment of object of volatile-qualified type 'CrashZone::AtomicCounter' (aka 'volatile unsigned int') is deprecated [-Werror,-Wdeprecated-volatile]
>     static void leave() { gnLeaveCount++; }
>                                       ^
> /home/tdf/lode/jenkins/workspace/android_arm/include/comphelper/crashzone.hxx:55:20: note: in instantiation of member function 'CrashZone<SkiaZone>::leave' requested here
>     ~CrashZone() { leave(); }
>                    ^
> /home/tdf/lode/jenkins/workspace/android_arm/vcl/inc/skia/zone.hxx:23:5: note: in instantiation of member function 'CrashZone<SkiaZone>::~CrashZone' requested here
>     SkiaZone() { assert(comphelper::SolarMutex::get()->IsCurrentThread()); }
>     ^

(<https://ci.libreoffice.org/job/gerrit_android_arm/31168/>)

Change-Id: Ia63c54ed5bde6678ef6b544c1edad9600534ff05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155264
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2023-08-02 17:33:27 +02:00
parent f080ef9daf
commit aaba06d2fc

View file

@ -55,9 +55,16 @@ public:
~CrashZone() { leave(); }
static bool isInZone() { return gnEnterCount != gnLeaveCount; }
static const AtomicCounter& enterCount() { return gnEnterCount; }
#if defined ARM32 && !defined __ARM_PCS_VFP && defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-volatile"
#endif
// prefer creating instances to manually calling enter()/leave()
static void enter() { gnEnterCount++; }
static void leave() { gnLeaveCount++; }
#if defined ARM32 && !defined __ARM_PCS_VFP && defined __clang__
#pragma clang diagnostic pop
#endif
// these should be implemented for each specific zone if needed
// static void hardDisable();
// static const CrashWatchdogTimingsValues& getCrashWatchdogTimingsValues();