Bug 250684 - [ANGLE] Fix -Wsign-compare warnings on watchOS
Summary: [ANGLE] Fix -Wsign-compare warnings on watchOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-01-16 09:33 PST by David Kilzer (:ddkilzer)
Modified: 2023-01-29 21:33 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2023-01-16 09:33:36 PST
Fix -Wsign-compare warnings on watchOS.

On watchOS, 'GLintptr' is defined as 'long', so comparing to 'std::numeric_limits<uint32_t>::max()' results in a signed/unsigned comparison:

/Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:1095:57: error: comparison of integers of different signs: 'GLintptr' (aka 'long') and 'std::numeric_limits<unsigned int>::type' (aka 'unsigned int') [-Werror,-Wsign-compare]
    ANGLE_CHECK_GL_MATH(contextMtl, binding.getOffset() <= std::numeric_limits<uint32_t>::max());
                                    ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:10:
In file included from src/libANGLE/renderer/metal/VertexArrayMtl.h:13:
In file included from src/libANGLE/renderer/VertexArrayImpl.h:12:
src/common/angleutils.h:470:26: note: expanded from macro 'ANGLE_CHECK_GL_MATH'
    ANGLE_CHECK(context, result, "Integer overflow.", GL_INVALID_OPERATION)
                         ^~~~~~
In file included from /Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:10:
In file included from src/libANGLE/renderer/metal/VertexArrayMtl.h:13:
In file included from src/libANGLE/renderer/VertexArrayImpl.h:13:
In file included from src/libANGLE/Buffer.h:16:
In file included from src/libANGLE/Debug.h:16:
src/libANGLE/Error.h:153:30: note: expanded from macro 'ANGLE_CHECK'
        if (ANGLE_UNLIKELY(!(EXPR)))                                                  \
                             ^~~~
In file included from /Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:10:
In file included from src/libANGLE/renderer/metal/VertexArrayMtl.h:13:
In file included from src/libANGLE/renderer/VertexArrayImpl.h:12:
In file included from src/common/angleutils.h:12:
src/common/platform.h:123:55: note: expanded from macro 'ANGLE_UNLIKELY'
#        define ANGLE_UNLIKELY(x) __builtin_expect(!!(x), 0)
                                                      ^
Comment 1 Radar WebKit Bug Importer 2023-01-16 09:33:53 PST
<rdar://problem/104301662>
Comment 2 David Kilzer (:ddkilzer) 2023-01-16 09:57:25 PST
Pull request: https://github.com/WebKit/WebKit/pull/8699
Comment 3 David Kilzer (:ddkilzer) 2023-01-16 10:06:18 PST
Another issue:

/Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/FrameBufferMtl.mm:1658:57: error: comparison of integers of different signs: 'const ptrdiff_t' (aka 'const long') and 'std::numeric_limits<unsigned int>::type' (aka 'unsigned int') [-Werror,-Wsign-compare]
    ANGLE_MTL_CHECK(contextMtl, packPixelsParams.offset <= std::numeric_limits<uint32_t>::max(),
                                ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/FrameBufferMtl.mm:11:
In file included from src/libANGLE/renderer/metal/ContextMtl.h:19:
In file included from src/libANGLE/renderer/metal/ProvokingVertexHelper.h:16:
In file included from src/libANGLE/renderer/metal/DisplayMtl.h:16:
In file included from src/libANGLE/renderer/metal/mtl_command_buffer.h:27:
src/libANGLE/renderer/metal/mtl_common.h:564:30: note: expanded from macro 'ANGLE_MTL_CHECK'
        if (ANGLE_UNLIKELY(!(test)))                                                           \
                             ^~~~
In file included from /Volumes/Data/worker/watchOS-9-Build-EWS/build/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/FrameBufferMtl.mm:10:
In file included from src/libANGLE/angletypes.h:13:
In file included from src/common/FixedVector.h:13:
In file included from src/common/debug.h:22:
In file included from src/common/angleutils.h:12:
src/common/platform.h:123:55: note: expanded from macro 'ANGLE_UNLIKELY'
#        define ANGLE_UNLIKELY(x) __builtin_expect(!!(x), 0)
                                                      ^
Comment 4 EWS 2023-01-29 21:33:24 PST
Committed 259542@main (076b5adb1937): <https://commits.webkit.org/259542@main>

Reviewed commits have been landed. Closing PR #8699 and removing active labels.