Clang warns when casting between function pointer types where the calling conventions differ; this is of course intended to catch bugs that we ourselves have had to work around. But the casts here are compatible with what MIDL generates, so there isn't much we can do here beyond disabling the warning. This is generated code anyway; it should be expected to work.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- configure.ac | 1 + dlls/msi/Makefile.in | 2 ++ 2 files changed, 3 insertions(+)
diff --git a/configure.ac b/configure.ac index 970ff0b3419..aa91a15604d 100644 --- a/configure.ac +++ b/configure.ac @@ -1069,6 +1069,7 @@ then WINE_TRY_CROSSCFLAGS([-fno-strict-aliasing]) dnl clang needs to be told to fail on unknown options WINE_TRY_CROSSCFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"]) + WINE_TRY_CROSSCFLAGS([-Wcast-calling-convention],[AC_SUBST(NO_CAST_CALLING_CONV_CFLAGS,"-Wno-cast-calling-convention")]) WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement]) WINE_TRY_CROSSCFLAGS([-Wempty-body]) WINE_TRY_CROSSCFLAGS([-Wignored-qualifiers]) diff --git a/dlls/msi/Makefile.in b/dlls/msi/Makefile.in index cf6d498e344..cbc8e33dc8c 100644 --- a/dlls/msi/Makefile.in +++ b/dlls/msi/Makefile.in @@ -6,6 +6,8 @@ EXTRAIDLFLAGS = --prefix-server=s_
EXTRADLLFLAGS = -mno-cygwin
+winemsi_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) + C_SRCS = \ action.c \ alter.c \
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/rpcrt4/tests/Makefile.in | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/rpcrt4/tests/Makefile.in b/dlls/rpcrt4/tests/Makefile.in index 1e7276c893a..013352af115 100644 --- a/dlls/rpcrt4/tests/Makefile.in +++ b/dlls/rpcrt4/tests/Makefile.in @@ -6,6 +6,9 @@ EXTRADEFS = -DPROXY_DELEGATION server_EXTRAIDLFLAGS = -Os --prefix-client=mixed_ server_interp_EXTRAIDLFLAGS = -Oicf --prefix-client=interp_
+server_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) +server_interp_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) + C_SRCS = \ cstub.c \ generated.c \
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/schedsvc/Makefile.in | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/schedsvc/Makefile.in b/dlls/schedsvc/Makefile.in index 1737650654d..c9865b9febd 100644 --- a/dlls/schedsvc/Makefile.in +++ b/dlls/schedsvc/Makefile.in @@ -3,6 +3,9 @@ IMPORTS = rpcrt4 advapi32 ole32
EXTRADLLFLAGS = -mno-cygwin
+atsvc_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) +schrpc_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) + C_SRCS = \ atsvc.c \ schedsvc.c \
Signed-off-by: Chip Davis cdavis@codeweavers.com --- programs/rpcss/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/programs/rpcss/Makefile.in b/programs/rpcss/Makefile.in index dcc405a944b..430ab5e2c74 100644 --- a/programs/rpcss/Makefile.in +++ b/programs/rpcss/Makefile.in @@ -3,6 +3,10 @@ IMPORTS = rpcrt4 advapi32
EXTRADLLFLAGS = -mconsole -municode -mno-cygwin
+epm_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) +irot_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) +irpcss_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) + C_SRCS = \ epmp.c \ irotp.c \
Signed-off-by: Chip Davis cdavis@codeweavers.com --- programs/services/Makefile.in | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/programs/services/Makefile.in b/programs/services/Makefile.in index 560e277a9bf..0055808e51c 100644 --- a/programs/services/Makefile.in +++ b/programs/services/Makefile.in @@ -3,6 +3,8 @@ IMPORTS = rpcrt4 advapi32 userenv setupapi
EXTRADLLFLAGS = -mconsole -mno-cygwin
+svcctl_s_EXTRADEFS = $(NO_CAST_CALLING_CONV_CFLAGS) + C_SRCS = \ rpc.c \ services.c \
Hi Chip,
On 08.04.2020 08:05, Chip Davis wrote:
Clang warns when casting between function pointer types where the calling conventions differ; this is of course intended to catch bugs that we ourselves have had to work around. But the casts here are compatible with what MIDL generates, so there isn't much we can do here beyond disabling the warning. This is generated code anyway; it should be expected to work.
I think we should try to fix it on widl side. For example, is there any reason we can't just use explicit (void*) cast in generated code instead?
Thanks,
Jacek