external/epoxy/UnpackedTarball_epoxy.mk |    3 ++-
 external/epoxy/Wint-conversion.patch    |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit b2760b7d2a3fa74f5cb4d477d44d9cef33c5065c
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Aug 17 09:11:07 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Aug 18 11:37:00 2022 +0200

    external/epoxy: Fix -Wint-conversion
    
    ...with recent Clang 16 trunk since
    
<https://github.com/llvm/llvm-project/commit/7068aa98412ade19a34b7ed126f4669f581b2311>
    "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
    
<https://github.com/anholt/libepoxy/commit/0cfb0a044bc43245409c020e2ca34091c96283d4>
    "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 <sberg...@redhat.com>

diff --git a/external/epoxy/UnpackedTarball_epoxy.mk 
b/external/epoxy/UnpackedTarball_epoxy.mk
index 4cbc41f5d4c9..f0f1c71da227 100644
--- a/external/epoxy/UnpackedTarball_epoxy.mk
+++ b/external/epoxy/UnpackedTarball_epoxy.mk
@@ -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:
diff --git a/external/epoxy/Wint-conversion.patch 
b/external/epoxy/Wint-conversion.patch
new file mode 100644
index 000000000000..b638dfad806f
--- /dev/null
+++ b/external/epoxy/Wint-conversion.patch
@@ -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):

Reply via email to