summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-16 17:52:53 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-17 21:01:48 +0200
commit4bbe329ef07bb38c939c6bef53ae4aa9928b9a52 (patch)
treea2c3637e0ec72d25a2e8dce98874562467a36dac
parent45ffeed6674e4f3c5b92f951094d41a0d0ec8002 (diff)
Avoid -Werror,-Wcast-function-type-mismatch
...as seen when building LOWA (i.e., --disable-dynloading) with a recent Clang with <https://github.com/llvm/llvm-project/commit/999d4f840777bf8de26d45947192aa0728edc0fb> "Split -Wcast-function-type into a separate group (#86131)", where -Wcast-function-type-mismatch generally warns about casts between incompatible function types... > cppuhelper/source/shlib.cxx:294:23: error: cast from 'void *(*)(void *, void *)' to 'ImplementationConstructorFn *' (aka 'css::uno::XInterface *(*)(css::uno::XComponentContext *, const css::uno::Sequence<css::uno::Any> &)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch] > 294 | = reinterpret_cast<ImplementationConstructorFn *>( > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 295 | map[i].constructor_function); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...but not for the special case of casting from/to void(*)(void). (Using the correct function type > css::uno::XInterface * (*)(css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any> const &) throughout would be even better, but doesn't easily fit into this C code that is included in low-level places that don't know those UNO types and is shared between LOWA and Android etc.) Change-Id: Ic4dbabbff0f772b34cf692db968c3ad257c37cb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173463 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
-rw-r--r--include/osl/detail/component-mapping.h2
-rwxr-xr-xsolenv/bin/native-code.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/osl/detail/component-mapping.h b/include/osl/detail/component-mapping.h
index 4d4264180476..64c967019ba0 100644
--- a/include/osl/detail/component-mapping.h
+++ b/include/osl/detail/component-mapping.h
@@ -31,7 +31,7 @@ typedef struct {
typedef struct {
const char *name;
- void * (*constructor_function)(void *, void *);
+ void (*constructor_function)(void);
} lib_to_constructor_mapping;
const lib_to_factory_mapping *lo_get_factory_map(void);
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index bd84bd68e305..b64606bac16e 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -879,7 +879,7 @@ for constructor in sorted(full_constructor_map.keys()):
constructor_guard = get_constructor_guard(constructor)
if constructor_guard:
print (constructor_guard)
- print ('void * '+constructor+'( void *, void * );')
+ print ('void '+constructor+'( void );')
if constructor_guard:
print ('#endif')