From 39540e9c3ef15f9a3b65bfefb6294bdc20d86ed7 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 9 Jul 2024 15:57:38 +0100 Subject: [PATCH] add pragma macros, silences -Wcast-function-type --- makefile | 2 +- src/ivmr.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 217efc4..9dbbe9a 100644 --- a/makefile +++ b/makefile @@ -33,6 +33,6 @@ $(BIN_DIR) $(OBJ_DIR): pwsh -Command New-Item -Path $@ -ItemType Directory clean: - pwsh -Command Remove-Item -Recurse $(EXE), $(OBJ_DIR) + pwsh -Command Remove-Item -Recurse $(EXE), $(OBJ_DIR) -force -include $(OBJ:.o=.d) diff --git a/src/ivmr.c b/src/ivmr.c index 631aecf..0a10bb3 100644 --- a/src/ivmr.c +++ b/src/ivmr.c @@ -20,6 +20,13 @@ #include "util.h" #include "log.h" +#define PRAGMA_IgnoreWCastIncompatibleFuncTypes \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") + +#define PRAGMA_Pop \ + _Pragma("GCC diagnostic pop") + static T_VBVMR_INTERFACE iVMR; static long initialize_dll_interfaces(PT_VMR vmr); @@ -79,6 +86,8 @@ static long initialize_dll_interfaces(PT_VMR vmr) if (G_H_Module == NULL) return -101; + PRAGMA_IgnoreWCastIncompatibleFuncTypes; + // Get function pointers vmr->VBVMR_Login = (T_VBVMR_Login)GetProcAddress(G_H_Module, "VBVMR_Login"); vmr->VBVMR_Logout = (T_VBVMR_Logout)GetProcAddress(G_H_Module, "VBVMR_Logout"); @@ -110,6 +119,8 @@ static long initialize_dll_interfaces(PT_VMR vmr) vmr->VBVMR_MacroButton_GetStatus = (T_VBVMR_MacroButton_GetStatus)GetProcAddress(G_H_Module, "VBVMR_MacroButton_GetStatus"); vmr->VBVMR_MacroButton_SetStatus = (T_VBVMR_MacroButton_SetStatus)GetProcAddress(G_H_Module, "VBVMR_MacroButton_SetStatus"); + PRAGMA_Pop; + // check pointers are valid if (vmr->VBVMR_Login == NULL) return -1;