office-gobmx/opencl
Stephan Bergmann 33d922ea07 -Werror=volatile in OpenCLZone
Recent GCC 10 trunk in C++20 mode reports issues like

> include/opencl/OpenCLZone.hxx:27:9: error: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Werror=volatile]
>    27 |         gnEnterCount++;
>       |         ^~~~~~~~~~~~

But unlike in the case of ec17c8ec52
"-Werror=volatile in OpenGLZone",

* it looks like there are no multi-threading issues here, and the counters are
  just accessed (via OpenCLZone::isInZone) from the VCLExceptionSignal_impl
  signal handler in addition to being modified (via OpenCLZone RAII objects)
  from mainline code; and

* from the usage pattern of gnEnterCount and gnLeaveCount it appears that they
  can be combined into a single counter.
  (f41eb66302 "opencl: OpenCLZone, detect CL
  device change and disable CL on crash" presumably modelled OpenCLZone naively
  after OpenGLZone, without simplifying it where possible.)  One minor advantage
  of having two monotonically increasing counters is that when they overflow,
  the implementation of isInZone (comparing them for equality) still gives
  ~useful results (assuming that a false "match" of non-overflown gnEnterCount
  against overflown gnLeaveCount is highly unlikely).  But instances of
  OpenCLZone RAII objects are presumably never nested very deeply (if at all),
  so that the newly added "TODO: overflow" comment (which would even cause UB if
  std::sig_atomic_t is signed) is probably of no practical concern.

Change-Id: I92e1f2c46ca996a0a86bacabcda2accba5eb6298
Reviewed-on: https://gerrit.libreoffice.org/79106
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-18 20:28:29 +02:00
..
inc
opencltest
source -Werror=volatile in OpenCLZone 2019-09-18 20:28:29 +02:00
Executable_opencltest.mk
IwyuFilter_opencl.yaml
Library_opencl.mk
Makefile
Module_opencl.mk
README

OpenCL-related code that is not specific to any particular
functionality OpenCL is used for. (Like formula group calculation in
Calc.)

Not compiled on platforms where OpenCL is not available (iOS and
Android). On other platforms OpenCL is optional at run-time, but not
at build time.