summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-08-18 23:26:06 +0200
committerBruno Haible <bruno@clisp.org>2018-08-18 23:33:03 +0200
commited1c87c60327fe57f74a4d5b40c235032899acce (patch)
tree6fe14891eb264bd789d9a908d1b2f4503109fcfd
parent35d328144bd3282d1de6d16a67a04a70146315ac (diff)
downloadgnulib-ed1c87c60327fe57f74a4d5b40c235032899acce.tar.gz
Avoid -Wcast-function-type warnings from casts after GetProcAddress.
Reported by Andy Moreton <andrewjmoreton@gmail.com> in <https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00468.html>. Solution proposed by Eli Zaretskii. * lib/getaddrinfo.c (GetProcAddress): Cast result to 'void *' first. * lib/gettimeofday.c (GetProcAddress): Likewise. * lib/link.c (GetProcAddress): Likewise. * lib/physmem.c (GetProcAddress): Likewise. * lib/poll.c (GetProcAddress): Likewise. * lib/select.c (GetProcAddress): Likewise. * lib/stat-w32.c (GetProcAddress): Likewise.
-rw-r--r--ChangeLog14
-rw-r--r--lib/getaddrinfo.c5
-rw-r--r--lib/gettimeofday.c4
-rw-r--r--lib/link.c4
-rw-r--r--lib/physmem.c7
-rw-r--r--lib/poll.c4
-rw-r--r--lib/select.c4
-rw-r--r--lib/stat-w32.c4
8 files changed, 46 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fa281b1606..2264d83b95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2018-08-18 Bruno Haible <bruno@clisp.org>
+ Avoid -Wcast-function-type warnings from casts after GetProcAddress.
+ Reported by Andy Moreton <andrewjmoreton@gmail.com> in
+ <https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00468.html>.
+ Solution proposed by Eli Zaretskii.
+ * lib/getaddrinfo.c (GetProcAddress): Cast result to 'void *' first.
+ * lib/gettimeofday.c (GetProcAddress): Likewise.
+ * lib/link.c (GetProcAddress): Likewise.
+ * lib/physmem.c (GetProcAddress): Likewise.
+ * lib/poll.c (GetProcAddress): Likewise.
+ * lib/select.c (GetProcAddress): Likewise.
+ * lib/stat-w32.c (GetProcAddress): Likewise.
+
+2018-08-18 Bruno Haible <bruno@clisp.org>
+
glob: Fix another compilation error when glob.h is not replaced.
Reported and fix proposed by Reuben Thomas <rrt@sc3d.org> again.
* lib/globfree.c: Include <libc-config.h>.
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 756c31b7b1..7bf38e8f85 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -62,6 +62,11 @@
#include "sockets.h"
#ifdef WINDOWS_NATIVE
+
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
const struct addrinfo*,
struct addrinfo**);
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index bff40d7964..36b50744b2 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -33,6 +33,10 @@
#ifdef WINDOWS_NATIVE
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
diff --git a/lib/link.c b/lib/link.c
index bf0b344b75..cff54a26be 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -30,6 +30,10 @@
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
/* CreateHardLink was introduced only in Windows 2000. */
typedef BOOL (WINAPI * CreateHardLinkFuncType) (LPCTSTR lpFileName,
LPCTSTR lpExistingFileName,
diff --git a/lib/physmem.c b/lib/physmem.c
index cbb33ac0ba..c89c0f06f7 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -59,8 +59,14 @@
#endif
#ifdef _WIN32
+
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
+
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
/* MEMORYSTATUSEX is missing from older windows headers, so define
a local replacement. */
typedef struct
@@ -76,6 +82,7 @@ typedef struct
DWORDLONG ullAvailExtendedVirtual;
} lMEMORYSTATUSEX;
typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
+
#endif
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
diff --git a/lib/poll.c b/lib/poll.c
index 26f7f1202a..576ec9fbf7 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -84,6 +84,10 @@
of SOCKETs, not bit masks of FDs. */
# undef select
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
static BOOL IsConsoleHandle (HANDLE h)
{
DWORD mode;
diff --git a/lib/select.c b/lib/select.c
index 3659cb5694..ffb58ee4db 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -47,6 +47,10 @@
#undef select
+/* Avoid warnings from gcc -Wcast-function-type. */
+#define GetProcAddress \
+ (void *) GetProcAddress
+
struct bitset {
unsigned char in[FD_SETSIZE / CHAR_BIT];
unsigned char out[FD_SETSIZE / CHAR_BIT];
diff --git a/lib/stat-w32.c b/lib/stat-w32.c
index 802b38a8ef..c7a53f9da8 100644
--- a/lib/stat-w32.c
+++ b/lib/stat-w32.c
@@ -38,6 +38,10 @@
#include "pathmax.h"
#include "verify.h"
+/* Avoid warnings from gcc -Wcast-function-type. */
+#define GetProcAddress \
+ (void *) GetProcAddress
+
#if _GL_WINDOWS_STAT_INODES == 2
/* GetFileInformationByHandleEx was introduced only in Windows Vista. */
typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile,