pyuno/source/module/pyuno.cxx          |    7 +++++++
 pyuno/source/module/pyuno_module.cxx   |    7 +++++++
 pyuno/source/module/pyuno_struct.cxx   |    7 +++++++
 solenv/gbuild/platform/com_GCC_defs.mk |    7 -------
 4 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit d02310ba14a4c400eef4821c99287c797d376714
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Wed Sep 18 17:42:59 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Sep 19 07:35:49 2024 +0200

    Remaining GCC -Wcast-function-type issues
    
    As Clang supports that warning now too, lots of occurrences have meanwhile 
been
    cleaned up for good (0c29c417ef3f0b749042e5a461abae9c36cf655b "Avoid
    -Werror,-Wcast-function-type-mismatch", 
1344e6261a1d856c71eca1e0cc29215a586bf335
    "Avoid -Werror,-Wcast-function-type-mismatch",
    85a2bb9f52a0d834b02681344ce56e0b091e1abd "Avoid
    -Werror,-Wcast-function-type-mismatch", etc.), so
    ce99754e9b5b954be4360f39356ed7198b298265 "Globally disable 
-Wcast-function-type
    new with upcoming GCC 8" in solenv/gbuild/platform/com_GCC_defs.mk should no
    longer be necessary.
    
    One remaining issue I encountered was 
dae7304df68493afcf6e9c9e490d65ea20d8211f
    "Silence Clang 19 trunk -Werror,-Wcast-function-type-mismatch", where GCC 
needs
    a different way for silencing the warnings in pyuno/source/module/ than had 
been
    used there for Clang.
    
    Change-Id: I5d0404b957d798114051209c31e022a898cf91f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173623
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index af35283e6139..56836aed7498 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1529,6 +1529,10 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject 
*that, int op )
     return result;
 }
 
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+#endif
 static PyMethodDef PyUNOMethods[] =
 {
 #if defined __clang__
@@ -1545,6 +1549,9 @@ static PyMethodDef PyUNOMethods[] =
 #endif
     {nullptr,         nullptr,                                        0,       
     nullptr}
 };
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
 
 static PyNumberMethods PyUNONumberMethods[] =
 {
diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index 1fc2e8bf00a2..216f4f5a663a 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -907,6 +907,10 @@ static PyObject *sal_debug(
 
 }
 
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+#endif
 struct PyMethodDef PyUNOModule_methods [] =
 {
     {"private_initTestEnvironment", initTestEnvironment, METH_VARARGS, 
nullptr},
@@ -942,6 +946,9 @@ struct PyMethodDef PyUNOModule_methods [] =
     {"sal_debug", sal_debug, METH_VARARGS, nullptr},
     {nullptr, nullptr, 0, nullptr}
 };
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
 
 }
 
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index 6f4dd47a4b35..e1592eac929d 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -281,6 +281,10 @@ static PyObject* PyUNOStruct_cmp( PyObject *self, PyObject 
*that, int op )
     return result;
 }
 
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+#endif
 static PyMethodDef PyUNOStructMethods[] =
 {
 #if defined __clang__
@@ -297,6 +301,9 @@ static PyMethodDef PyUNOStructMethods[] =
 #endif
     {nullptr,         nullptr,                                              0, 
           nullptr}
 };
+#if defined __GNUC__ && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
 
 static PyTypeObject PyUNOStructType =
 {
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk 
b/solenv/gbuild/platform/com_GCC_defs.mk
index 29a1942faa7b..528e45630b25 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -146,13 +146,6 @@ gb_CXXFLAGS_COMMON += \
     -Wunused-const-variable=1
 endif
 
-# GCC 8 -Wcast-function-type (included in -Wextra) unhelpfully even warns on 
reinterpret_cast
-# between incompatible function types:
-ifeq ($(shell expr '$(GCC_VERSION)' '>=' 800),1)
-gb_CXXFLAGS_COMMON += \
-    -Wno-cast-function-type
-endif
-
 # If CC or CXX already include -fvisibility=hidden, don't duplicate it
 ifeq (,$(filter -fvisibility=hidden,$(CC)))
 gb_VISIBILITY_FLAGS := -fvisibility=hidden

Reply via email to