]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid -Wcast-function-type warnings from casts after GetProcAddress.
authorBruno Haible <bruno@clisp.org>
Sat, 18 Aug 2018 21:26:06 +0000 (23:26 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Aug 2018 21:33:03 +0000 (23:33 +0200)
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.

ChangeLog
lib/getaddrinfo.c
lib/gettimeofday.c
lib/link.c
lib/physmem.c
lib/poll.c
lib/select.c
lib/stat-w32.c

index fa281b16064efd93d8cd75ddda27f7f7804b6b5b..2264d83b95b6204b6204ede5815f61ebe6397f28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+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.
index 756c31b7b1914214ee7b7d163b8adb2b1b62ee6d..7bf38e8f855c4e306ef3f09fe369255ee4d9d517 100644 (file)
 #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**);
index bff40d79642149971d80e8f288dd88b093bb6892..36b50744b2784bcbebc57feb70e0787982ead8dd 100644 (file)
 
 #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;
index bf0b344b7570d1455aae13e1c9dbc23483e51681..cff54a26befaba3718dea7b1cc5545e9fa33c176 100644 (file)
 #  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,
index cbb33ac0ba92ac0c223459d340503633d65398e9..c89c0f06f77376176d11475a8a425e810a640037 100644 (file)
 #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]))
index 26f7f1202a9c353bd119a5b9fcb1f73561a69ca5..576ec9fbf717761c4a862aae665f7d53a7007030 100644 (file)
    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;
index 3659cb5694e64033e7751c531a9d4f749c5a4648..ffb58ee4dbb033dcc0231e0fd350451d059f1527 100644 (file)
 
 #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];
index 802b38a8efb9878e318083f596e356f0eef7d30d..c7a53f9da8d8d09573d36fbb98f5f77dfff27de6 100644 (file)
 #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,