[webkit-changes] [WebKit/WebKit] 076b5a: [ANGLE] Fix -Wsign-compare warnings on watchOS

Commit Queue noreply at github.com
Sun Jan 29 21:33:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 076b5adb1937cf7b5f7ea2ac7b6629e0792a493b
      https://github.com/WebKit/WebKit/commit/076b5adb1937cf7b5f7ea2ac7b6629e0792a493b
  Author: David Kilzer <ddkilzer at apple.com>
  Date:   2023-01-29 (Sun, 29 Jan 2023)

  Changed paths:
    M Source/ThirdParty/ANGLE/Configurations/Base.xcconfig
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/FrameBufferMtl.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm

  Log Message:
  -----------
  [ANGLE] Fix -Wsign-compare warnings on watchOS
https://bugs.webkit.org/show_bug.cgi?id=250684
<rdar://104301662>

Reviewed by Kimmo Kinnunen.

On watchOS, 'GLintptr' and 'ptrdiff_t' are defined as signed
types, so they must be converted to an unsigned value to compare
them to std::numeric_limits<uint32_t>::max().

In general, this code treats signed variables as containers for
unsigned values, so checking for negative values isn't important
in this context.  Instead overflow only needs to be checked
before casting if the signed type is larger than uint32_t.

* Source/ThirdParty/ANGLE/Configurations/Base.xcconfig:
(WK_FIXME_WARNING_CFLAGS): Remove -Wno-sign-compare.

* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/FrameBufferMtl.mm:
(rx::FramebufferMtl::readPixelsToPBO const):
- Only check for overflow if the size of
  `packPixelsParams.offset` (ptrdiff_t) is larger than the size
  of uint32_t.
- Use static_cast<std::make_unsigned_t<>>() when checking for
  overflow of `packPixelsParams.offset`.

* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:
(rx::VertexArrayMtl::convertVertexBufferGPU):
- Extract `binding.getOffset()` into a local variable.
- Only check for overflow if the size of `bindingOffset`
  (GLintptr) is larger than the size of uint32_t.
- Use static_cast<std::make_unsigned_t<>>() when checking for
  overflow of `bindingOffset`.
- Add an overflow check for `vertexConversion->offset` since
  it's a size_t value, and switch to std::min() from MIN().

Canonical link: https://commits.webkit.org/259542@main




More information about the webkit-changes mailing list