external/epoxy: Fix -Wint-conversion

...with recent Clang 16 trunk since
<7068aa9841>
"Strengthen -Wint-conversion to default to an error", causing

> workdir/UnpackedTarball/epoxy/src/gl_generated_dispatch.c:114547:77: error: incompatible integer to pointer conversion passing 'uintptr_t' (aka 'unsigned long') to parameter of type 'GLhandleARB' (aka 'void *') [-Wint-conversion]
> GEN_THUNKS(glAttachObjectARB, (GLhandleARB containerObj, GLhandleARB obj), ((uintptr_t)containerObj, (uintptr_t)obj))
>                                                                             ^~~~~~~~~~~~~~~~~~~~~~~
> workdir/UnpackedTarball/epoxy/src/dispatch_common.h:150:40: note: expanded from macro 'GEN_THUNKS'
>     GEN_GLOBAL_REWRITE_PTR(name, args, passthrough)                  \
>                                        ^~~~~~~~~~~
> workdir/UnpackedTarball/epoxy/src/dispatch_common.h:95:14: note: expanded from macro 'GEN_GLOBAL_REWRITE_PTR'
>         name passthrough;                                        \
>              ^~~~~~~~~~~

etc.

That only hit on macOS because of the different

> #ifdef __APPLE__
> typedef void *GLhandleARB;
> #else
> typedef unsigned int GLhandleARB;
> #endif

in OpenGL's glext.h, which
<0cfb0a044b>
"Fix most GLhandleARB warnings on OS X with a big comment in our code" had tried
to address by adding "a cast to uintptr_t to shut up the compiler" in its
src/gen_dispatch.py (but without stating what compiler diagnostics exactly were
supposed to be silenced by that cast that now started to cause the above issues
with Clang 16 trunk).

It turns out that at least my macOS build with Clang 16 trunk builds fine
without that cast, so just drop it for good.  (And patching epoxy's
src/gen_dispatch.py means that UnpackedTarball_epoxy needs to switch from
gb_UnpackedTarball_set_pre_action to gb_UnpackedTarball_set_post_action.)

Change-Id: I2c87bca2cc5510d17098028d4532989f48e349a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138407
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2022-08-17 09:11:07 +02:00
parent 5db76fd0ec
commit b2760b7d2a
2 changed files with 28 additions and 1 deletions

View file

@ -16,7 +16,7 @@ $(call gb_UnpackedTarball_get_target,epoxy) :| $(call gb_ExternalExecutable_get_
epoxy_PYTHON := $(call gb_ExternalExecutable_get_command,python)
# previous versions of epoxy bundled the output, but now it has to be generated
$(eval $(call gb_UnpackedTarball_set_pre_action,epoxy,\
$(eval $(call gb_UnpackedTarball_set_post_action,epoxy,\
$(epoxy_PYTHON) ./src/gen_dispatch.py --srcdir src --includedir include/epoxy registry/gl.xml && \
$(epoxy_PYTHON) ./src/gen_dispatch.py --srcdir src --includedir include/epoxy registry/glx.xml && \
$(epoxy_PYTHON) ./src/gen_dispatch.py --srcdir src --includedir include/epoxy registry/egl.xml && \
@ -33,6 +33,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,epoxy, \
external/epoxy/epoxy.noegl.by.default.patch \
external/epoxy/clang-cl.patch \
external/epoxy/epoxy.android.patch \
external/epoxy/Wint-conversion.patch \
))
# vim: set noet sw=4 ts=4:

26
external/epoxy/Wint-conversion.patch vendored Normal file
View file

@ -0,0 +1,26 @@
--- src/gen_dispatch.py
+++ src/gen_dispatch.py
@@ -123,20 +123,16 @@
#
# We retain those aliases. In the x86_64 ABI, the first 6
# args are stored in 64-bit registers, so the calls end up
- # being the same despite the different types. We just need to
- # add a cast to uintptr_t to shut up the compiler.
+ # being the same despite the different types.
if arg_type == 'GLhandleARB':
assert len(self.args) < 6
- arg_list_name = '(uintptr_t)' + arg_name
- else:
- arg_list_name = arg_name
self.args.append((arg_type, arg_name))
if self.args_decl == 'void':
- self.args_list = arg_list_name
+ self.args_list = arg_name
self.args_decl = arg_type + ' ' + arg_name
else:
- self.args_list += ', ' + arg_list_name
+ self.args_list += ', ' + arg_name
self.args_decl += ', ' + arg_type + ' ' + arg_name
def add_provider(self, condition, loader, condition_name):