diff --git a/lib/formdata.c b/lib/formdata.c
index 5731da95c361bb40355328311bd929785ff8391e..450a0e5d8e02b40db7e0d9e2264707d8da526d40 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -39,6 +39,7 @@
 #include "sendf.h"
 #include "strdup.h"
 #include "rand.h"
+#include "warnless.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -878,7 +879,8 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
                compatibility: use of "-" pseudo file name should be avoided. */
             result = curl_mime_data_cb(part, (curl_off_t) -1,
                                        (curl_read_callback) fread,
-                                       (curl_seek_callback) fseek,
+                                       CURLX_FUNCTION_CAST(curl_seek_callback,
+                                                           fseek),
                                        NULL, (void *) stdin);
           }
           else
diff --git a/lib/system_win32.c b/lib/system_win32.c
index 89d648516dad9405be1fc64733f97dec96d0a115..6b8004e5bbb10843dd3c4a211e2b29d5019e0389 100644
--- a/lib/system_win32.c
+++ b/lib/system_win32.c
@@ -26,6 +26,7 @@
 
 #include <curl/curl.h>
 #include "system_win32.h"
+#include "warnless.h"
 
 /* The last #include files should be: */
 #include "curl_memory.h"
@@ -280,7 +281,9 @@ HMODULE Curl_load_library(LPCTSTR filename)
 
   /* Attempt to find LoadLibraryEx() which is only available on Windows 2000
      and above */
-  pLoadLibraryEx = (LOADLIBRARYEX_FN) GetProcAddress(hKernel32, LOADLIBARYEX);
+  pLoadLibraryEx =
+    CURLX_FUNCTION_CAST(LOADLIBRARYEX_FN,
+                        (GetProcAddress(hKernel32, LOADLIBARYEX)));
 
   /* Detect if there's already a path in the filename and load the library if
      there is. Note: Both back slashes and forward slashes have been supported
diff --git a/lib/telnet.c b/lib/telnet.c
index 6a144ed3a70aea48b60a95cbe6ff290cae9a2575..031d61f4e653205b3b72ae37677dc73b2365f26e 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1357,7 +1357,9 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
   }
 
   /* Grab a pointer to WSACreateEvent */
-  create_event_func = (WSOCK2_EVENT) GetProcAddress(wsock2, "WSACreateEvent");
+  create_event_func =
+    CURLX_FUNCTION_CAST(WSOCK2_EVENT,
+                        (GetProcAddress(wsock2, "WSACreateEvent")));
   if(create_event_func == NULL) {
     failf(data, "failed to find WSACreateEvent function (%u)", GetLastError());
     FreeLibrary(wsock2);
diff --git a/lib/warnless.h b/lib/warnless.h
index f6a2d744b76de08981818294f520acd665b24beb..284ea1e752cb8dd53850f9bd5949906aafbb17a6 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -26,6 +26,9 @@
 #include <curl/curl.h> /* for curl_socket_t */
 #endif
 
+#define CURLX_FUNCTION_CAST(target_type, func) \
+  (target_type)(void (*) (void))(func)
+
 unsigned short curlx_ultous(unsigned long ulnum);
 
 unsigned char curlx_ultouc(unsigned long ulnum);