[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 80/153: Silence GCC 8 cast-function-type warnings
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 80/153: Silence GCC 8 cast-function-type warnings |
Date: |
Tue, 11 Sep 2018 12:52:31 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 25d2a1bae7871986eabdbe68dc05c5b6473ad4d7
Author: Marcel Raad <address@hidden>
AuthorDate: Thu Aug 9 17:19:24 2018 +0200
Silence GCC 8 cast-function-type warnings
On Windows, casting between unrelated function types is fine and
sometimes even necessary, so just use an intermediate cast to
(void (*) (void)) to silence the warning as described in [0].
[0] https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html
Closes https://github.com/curl/curl/pull/2860
---
lib/formdata.c | 4 +++-
lib/system_win32.c | 5 ++++-
lib/telnet.c | 4 +++-
lib/warnless.h | 3 +++
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/formdata.c b/lib/formdata.c
index 5731da95c..450a0e5d8 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 89d648516..6b8004e5b 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 6a144ed3a..031d61f4e 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 f6a2d744b..284ea1e75 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);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 95/153: travis: revert back to gcc-7 for coverage builds, (continued)
- [GNUnet-SVN] [gnurl] 95/153: travis: revert back to gcc-7 for coverage builds, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 86/153: docs: add disallow-username-in-url.d and haproxy-protocol.d on the list, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 98/153: urldata: remove unused pipe_broke struct field, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 92/153: TODO: host name sections in config files, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 110/153: Remove unused definitions, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 68/153: http_proxy: Remove unused macro SELECT_TIMEOUT, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 90/153: ssh-libssh: reduce excessive verbose output about pubkey auth, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 94/153: RELEASE-NOTES: synced, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 87/153: http: fix for tiny "HTTP/0.9" response, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 88/153: travis: update to GCC 8, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 80/153: Silence GCC 8 cast-function-type warnings,
gnunet <=
- [GNUnet-SVN] [gnurl] 84/153: Split non-portable part off test 1133, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 63/153: RELEASE-NOTES: synced, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 85/153: .travis.yml: verify that man pages can be regenerated, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 79/153: CURLINFO_SIZE_UPLOAD: fix missing counter update, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 61/153: windows: implement send buffer tuning, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 77/153: RELEASE-NOTES: synced, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 83/153: projects: Improve Windows perl detection in batch scripts, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 78/153: Documentation: fix CURLOPT_SSH_COMPRESSION copy/paste bug, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 55/153: DEPRECATE: remove release date from 7.62.0, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 82/153: docs: Improve the manual pages of some callbacks, gnunet, 2018/09/11