emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cc5325b: Pacify -Wcast-function-type warnings in GC


From: Eli Zaretskii
Subject: [Emacs-diffs] master cc5325b: Pacify -Wcast-function-type warnings in GCC 8.1
Date: Fri, 17 Aug 2018 10:31:35 -0400 (EDT)

branch: master
commit cc5325b0bea13bd93478fcee0b035877b3a72290
Author: Andy Moreton <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Pacify -Wcast-function-type warnings in GCC 8.1
    
    * src/image.c: Move attributes into DEF_DLL_FN call.
    * src/dynlib.c (dynlib_addr): Use get_proc_addr.
    * src/w32.h: (get_proc_addr): New function.
    (LOAD_DLL_FN): Use it.
    (DEF_DLL_FN): Allow function attributes after argument
    list.  Add function pointer type used by LOAD_DLL_FN.
    * src/w32.c (open_process_token, get_token_information)
    (lookup_account_sid, get_sid_sub_authority)
    (get_sid_sub_authority_count, get_security_info)
    (get_file_security, set_file_security)
    (set_named_security_info)
    (get_security_descriptor_owner, get_security_descriptor_group)
    (get_security_descriptor_dacl, is_valid_sid, equal_sid)
    (get_length_sid, copy_sid, get_native_system_info)
    (get_system_times, create_symbolic_link)
    (is_valid_security_descriptor, convert_sd_to_sddl)
    (convert_sddl_to_sd, get_adapters_info, reg_open_key_ex_w)
    (reg_query_value_ex_w, expand_environment_strings_w)
    (init_environment, create_toolhelp32_snapshot)
    (process32_first, process32_next, open_thread_token)
    (impersonate_self, revert_to_self, get_process_memory_info)
    (get_process_working_set_size, global_memory_status)
    (global_memory_status_ex, init_winsock)
    (maybe_load_unicows_dll, globals_of_w32): Use get_proc_addr.
    * src/w32fns.c (setup_w32_kbdhook, Ffile_system_info)
    (get_dll_version, w32_reset_stack_overflow_guard)
    (w32_backtrace, globals_of_w32fns): Use get_proc_addr.
    * src/w32font.c (get_outline_metrics_w, get_text_metrics_w)
    (get_glyph_outline_w, get_char_width_32_w): Use get_proc_addr.
    * src/w32heap.c (init_heap): Use get_proc_addr.
    * src/w32menu.c (globals_of_w32menu): Use get_proc_addr.
    * src/w32proc.c (init_timers, sys_kill, w32_compare_strings):
    Use get_proc_addr.
    * src/w32uniscribe.c (syms_of_w32uniscribe): Use get_proc_addr.
---
 src/dynlib.c       |   5 +-
 src/image.c        |   2 +-
 src/w32.c          | 211 +++++++++++++++++++++++++----------------------------
 src/w32.h          |  26 ++++++-
 src/w32fns.c       |  42 +++++------
 src/w32font.c      |   8 +-
 src/w32heap.c      |   6 +-
 src/w32menu.c      |  12 ++-
 src/w32proc.c      |  15 ++--
 src/w32uniscribe.c |   6 +-
 10 files changed, 172 insertions(+), 161 deletions(-)

diff --git a/src/dynlib.c b/src/dynlib.c
index 53afdaf..d40aa67 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -156,9 +156,8 @@ dynlib_addr (void *addr, const char **fname, const char 
**symname)
             address we pass to it is not an address of a string, but
             an address of a function.  So we don't care about the
             Unicode version.  */
-         s_pfn_Get_Module_HandleExA =
-           (GetModuleHandleExA_Proc) GetProcAddress (hm_kernel32,
-                                                     "GetModuleHandleExA");
+         s_pfn_Get_Module_HandleExA = (GetModuleHandleExA_Proc)
+            get_proc_addr (hm_kernel32, "GetModuleHandleExA");
        }
       if (s_pfn_Get_Module_HandleExA)
        {
diff --git a/src/image.c b/src/image.c
index 499c1b6..7866b9c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5734,7 +5734,7 @@ DEF_DLL_FN (void, png_read_end, (png_structp, png_infop));
 DEF_DLL_FN (void, png_error, (png_structp, png_const_charp));
 
 #  if (PNG_LIBPNG_VER >= 10500)
-DEF_DLL_FN (void, png_longjmp, (png_structp, int)) PNG_NORETURN;
+DEF_DLL_FN (void, png_longjmp, (png_structp, int) PNG_NORETURN);
 DEF_DLL_FN (jmp_buf *, png_set_longjmp_fn,
            (png_structp, png_longjmp_ptr, size_t));
 #  endif /* libpng version >= 1.5 */
diff --git a/src/w32.c b/src/w32.c
index ef60475..78f946c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -576,8 +576,8 @@ open_process_token (HANDLE ProcessHandle,
     {
       g_b_init_open_process_token = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Open_Process_Token =
-        (OpenProcessToken_Proc) GetProcAddress (hm_advapi32, 
"OpenProcessToken");
+      s_pfn_Open_Process_Token = (OpenProcessToken_Proc)
+        get_proc_addr (hm_advapi32, "OpenProcessToken");
     }
   if (s_pfn_Open_Process_Token == NULL)
     {
@@ -608,8 +608,8 @@ get_token_information (HANDLE TokenHandle,
     {
       g_b_init_get_token_information = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Token_Information =
-        (GetTokenInformation_Proc) GetProcAddress (hm_advapi32, 
"GetTokenInformation");
+      s_pfn_Get_Token_Information = (GetTokenInformation_Proc)
+        get_proc_addr (hm_advapi32, "GetTokenInformation");
     }
   if (s_pfn_Get_Token_Information == NULL)
     {
@@ -644,8 +644,8 @@ lookup_account_sid (LPCTSTR lpSystemName,
     {
       g_b_init_lookup_account_sid = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Lookup_Account_Sid =
-        (LookupAccountSid_Proc) GetProcAddress (hm_advapi32, 
LookupAccountSid_Name);
+      s_pfn_Lookup_Account_Sid = (LookupAccountSid_Proc)
+        get_proc_addr (hm_advapi32, LookupAccountSid_Name);
     }
   if (s_pfn_Lookup_Account_Sid == NULL)
     {
@@ -677,9 +677,8 @@ get_sid_sub_authority (PSID pSid, DWORD n)
     {
       g_b_init_get_sid_sub_authority = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Sid_Sub_Authority =
-        (GetSidSubAuthority_Proc) GetProcAddress (
-            hm_advapi32, "GetSidSubAuthority");
+      s_pfn_Get_Sid_Sub_Authority = (GetSidSubAuthority_Proc)
+        get_proc_addr (hm_advapi32, "GetSidSubAuthority");
     }
   if (s_pfn_Get_Sid_Sub_Authority == NULL)
     {
@@ -702,9 +701,8 @@ get_sid_sub_authority_count (PSID pSid)
     {
       g_b_init_get_sid_sub_authority_count = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Sid_Sub_Authority_Count =
-        (GetSidSubAuthorityCount_Proc) GetProcAddress (
-            hm_advapi32, "GetSidSubAuthorityCount");
+      s_pfn_Get_Sid_Sub_Authority_Count = (GetSidSubAuthorityCount_Proc)
+        get_proc_addr (hm_advapi32, "GetSidSubAuthorityCount");
     }
   if (s_pfn_Get_Sid_Sub_Authority_Count == NULL)
     {
@@ -733,9 +731,8 @@ get_security_info (HANDLE handle,
     {
       g_b_init_get_security_info = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Security_Info =
-        (GetSecurityInfo_Proc) GetProcAddress (
-            hm_advapi32, "GetSecurityInfo");
+      s_pfn_Get_Security_Info = (GetSecurityInfo_Proc)
+        get_proc_addr (hm_advapi32, "GetSecurityInfo");
     }
   if (s_pfn_Get_Security_Info == NULL)
     {
@@ -769,9 +766,8 @@ get_file_security (const char *lpFileName,
        {
          g_b_init_get_file_security_w = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Get_File_SecurityW =
-           (GetFileSecurityW_Proc) GetProcAddress (hm_advapi32,
-                                                  "GetFileSecurityW");
+         s_pfn_Get_File_SecurityW = (GetFileSecurityW_Proc)
+            get_proc_addr (hm_advapi32, "GetFileSecurityW");
        }
       if (s_pfn_Get_File_SecurityW == NULL)
        {
@@ -791,9 +787,8 @@ get_file_security (const char *lpFileName,
        {
          g_b_init_get_file_security_a = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Get_File_SecurityA =
-           (GetFileSecurityA_Proc) GetProcAddress (hm_advapi32,
-                                                  "GetFileSecurityA");
+         s_pfn_Get_File_SecurityA = (GetFileSecurityA_Proc)
+            get_proc_addr (hm_advapi32, "GetFileSecurityA");
        }
       if (s_pfn_Get_File_SecurityA == NULL)
        {
@@ -828,9 +823,8 @@ set_file_security (const char *lpFileName,
        {
          g_b_init_set_file_security_w = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Set_File_SecurityW =
-           (SetFileSecurityW_Proc) GetProcAddress (hm_advapi32,
-                                                   "SetFileSecurityW");
+         s_pfn_Set_File_SecurityW = (SetFileSecurityW_Proc)
+            get_proc_addr (hm_advapi32, "SetFileSecurityW");
        }
       if (s_pfn_Set_File_SecurityW == NULL)
        {
@@ -849,9 +843,8 @@ set_file_security (const char *lpFileName,
        {
          g_b_init_set_file_security_a = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Set_File_SecurityA =
-           (SetFileSecurityA_Proc) GetProcAddress (hm_advapi32,
-                                                   "SetFileSecurityA");
+         s_pfn_Set_File_SecurityA = (SetFileSecurityA_Proc)
+            get_proc_addr (hm_advapi32, "SetFileSecurityA");
        }
       if (s_pfn_Set_File_SecurityA == NULL)
        {
@@ -889,9 +882,8 @@ set_named_security_info (LPCTSTR lpObjectName,
        {
          g_b_init_set_named_security_info_w = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Set_Named_Security_InfoW =
-           (SetNamedSecurityInfoW_Proc) GetProcAddress (hm_advapi32,
-                                                        
"SetNamedSecurityInfoW");
+         s_pfn_Set_Named_Security_InfoW = (SetNamedSecurityInfoW_Proc)
+            get_proc_addr (hm_advapi32, "SetNamedSecurityInfoW");
        }
       if (s_pfn_Set_Named_Security_InfoW == NULL)
        {
@@ -911,9 +903,8 @@ set_named_security_info (LPCTSTR lpObjectName,
        {
          g_b_init_set_named_security_info_a = 1;
          hm_advapi32 = LoadLibrary ("Advapi32.dll");
-         s_pfn_Set_Named_Security_InfoA =
-           (SetNamedSecurityInfoA_Proc) GetProcAddress (hm_advapi32,
-                                                        
"SetNamedSecurityInfoA");
+         s_pfn_Set_Named_Security_InfoA = (SetNamedSecurityInfoA_Proc)
+            get_proc_addr (hm_advapi32, "SetNamedSecurityInfoA");
        }
       if (s_pfn_Set_Named_Security_InfoA == NULL)
        {
@@ -943,9 +934,8 @@ get_security_descriptor_owner (PSECURITY_DESCRIPTOR 
pSecurityDescriptor,
     {
       g_b_init_get_security_descriptor_owner = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Security_Descriptor_Owner =
-        (GetSecurityDescriptorOwner_Proc) GetProcAddress (
-            hm_advapi32, "GetSecurityDescriptorOwner");
+      s_pfn_Get_Security_Descriptor_Owner = (GetSecurityDescriptorOwner_Proc)
+        get_proc_addr (hm_advapi32, "GetSecurityDescriptorOwner");
     }
   if (s_pfn_Get_Security_Descriptor_Owner == NULL)
     {
@@ -972,9 +962,8 @@ get_security_descriptor_group (PSECURITY_DESCRIPTOR 
pSecurityDescriptor,
     {
       g_b_init_get_security_descriptor_group = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Security_Descriptor_Group =
-        (GetSecurityDescriptorGroup_Proc) GetProcAddress (
-            hm_advapi32, "GetSecurityDescriptorGroup");
+      s_pfn_Get_Security_Descriptor_Group = (GetSecurityDescriptorGroup_Proc)
+        get_proc_addr (hm_advapi32, "GetSecurityDescriptorGroup");
     }
   if (s_pfn_Get_Security_Descriptor_Group == NULL)
     {
@@ -1002,9 +991,8 @@ get_security_descriptor_dacl (PSECURITY_DESCRIPTOR 
pSecurityDescriptor,
     {
       g_b_init_get_security_descriptor_dacl = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Security_Descriptor_Dacl =
-        (GetSecurityDescriptorDacl_Proc) GetProcAddress (
-            hm_advapi32, "GetSecurityDescriptorDacl");
+      s_pfn_Get_Security_Descriptor_Dacl = (GetSecurityDescriptorDacl_Proc)
+        get_proc_addr (hm_advapi32, "GetSecurityDescriptorDacl");
     }
   if (s_pfn_Get_Security_Descriptor_Dacl == NULL)
     {
@@ -1029,9 +1017,8 @@ is_valid_sid (PSID sid)
     {
       g_b_init_is_valid_sid = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Is_Valid_Sid =
-        (IsValidSid_Proc) GetProcAddress (
-            hm_advapi32, "IsValidSid");
+      s_pfn_Is_Valid_Sid = (IsValidSid_Proc)
+        get_proc_addr (hm_advapi32, "IsValidSid");
     }
   if (s_pfn_Is_Valid_Sid == NULL)
     {
@@ -1053,9 +1040,8 @@ equal_sid (PSID sid1, PSID sid2)
     {
       g_b_init_equal_sid = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Equal_Sid =
-        (EqualSid_Proc) GetProcAddress (
-            hm_advapi32, "EqualSid");
+      s_pfn_Equal_Sid = (EqualSid_Proc)
+        get_proc_addr (hm_advapi32, "EqualSid");
     }
   if (s_pfn_Equal_Sid == NULL)
     {
@@ -1077,9 +1063,8 @@ get_length_sid (PSID sid)
     {
       g_b_init_get_length_sid = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Get_Length_Sid =
-        (GetLengthSid_Proc) GetProcAddress (
-            hm_advapi32, "GetLengthSid");
+      s_pfn_Get_Length_Sid = (GetLengthSid_Proc)
+        get_proc_addr (hm_advapi32, "GetLengthSid");
     }
   if (s_pfn_Get_Length_Sid == NULL)
     {
@@ -1101,9 +1086,8 @@ copy_sid (DWORD destlen, PSID dest, PSID src)
     {
       g_b_init_copy_sid = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Copy_Sid =
-        (CopySid_Proc) GetProcAddress (
-            hm_advapi32, "CopySid");
+      s_pfn_Copy_Sid = (CopySid_Proc)
+        get_proc_addr (hm_advapi32, "CopySid");
     }
   if (s_pfn_Copy_Sid == NULL)
     {
@@ -1127,9 +1111,9 @@ get_native_system_info (LPSYSTEM_INFO lpSystemInfo)
       if (g_b_init_get_native_system_info == 0)
        {
          g_b_init_get_native_system_info = 1;
-         s_pfn_Get_Native_System_Info =
-           (GetNativeSystemInfo_Proc)GetProcAddress (GetModuleHandle 
("kernel32.dll"),
-                                                     "GetNativeSystemInfo");
+         s_pfn_Get_Native_System_Info = (GetNativeSystemInfo_Proc)
+            get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                                  "GetNativeSystemInfo");
        }
       if (s_pfn_Get_Native_System_Info != NULL)
        s_pfn_Get_Native_System_Info (lpSystemInfo);
@@ -1151,9 +1135,9 @@ get_system_times (LPFILETIME lpIdleTime,
   if (g_b_init_get_system_times == 0)
     {
       g_b_init_get_system_times = 1;
-      s_pfn_Get_System_times =
-       (GetSystemTimes_Proc)GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                                            "GetSystemTimes");
+      s_pfn_Get_System_times = (GetSystemTimes_Proc)
+        get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "GetSystemTimes");
     }
   if (s_pfn_Get_System_times == NULL)
     return FALSE;
@@ -1181,9 +1165,9 @@ create_symbolic_link (LPCSTR lpSymlinkFilename,
       if (g_b_init_create_symbolic_link_w == 0)
        {
          g_b_init_create_symbolic_link_w = 1;
-         s_pfn_Create_Symbolic_LinkW =
-           (CreateSymbolicLinkW_Proc)GetProcAddress (GetModuleHandle 
("kernel32.dll"),
-                                                    "CreateSymbolicLinkW");
+         s_pfn_Create_Symbolic_LinkW = (CreateSymbolicLinkW_Proc)
+            get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                                  "CreateSymbolicLinkW");
        }
       if (s_pfn_Create_Symbolic_LinkW == NULL)
        {
@@ -1216,9 +1200,9 @@ create_symbolic_link (LPCSTR lpSymlinkFilename,
       if (g_b_init_create_symbolic_link_a == 0)
        {
          g_b_init_create_symbolic_link_a = 1;
-         s_pfn_Create_Symbolic_LinkA =
-           (CreateSymbolicLinkA_Proc)GetProcAddress (GetModuleHandle 
("kernel32.dll"),
-                                                    "CreateSymbolicLinkA");
+         s_pfn_Create_Symbolic_LinkA = (CreateSymbolicLinkA_Proc)
+            get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                                  "CreateSymbolicLinkA");
        }
       if (s_pfn_Create_Symbolic_LinkA == NULL)
        {
@@ -1261,9 +1245,9 @@ is_valid_security_descriptor (PSECURITY_DESCRIPTOR 
pSecurityDescriptor)
   if (g_b_init_is_valid_security_descriptor == 0)
     {
       g_b_init_is_valid_security_descriptor = 1;
-      s_pfn_Is_Valid_Security_Descriptor_Proc =
-       (IsValidSecurityDescriptor_Proc)GetProcAddress (GetModuleHandle 
("Advapi32.dll"),
-                                                       
"IsValidSecurityDescriptor");
+      s_pfn_Is_Valid_Security_Descriptor_Proc = 
(IsValidSecurityDescriptor_Proc)
+        get_proc_addr (GetModuleHandle ("Advapi32.dll"),
+                              "IsValidSecurityDescriptor");
     }
   if (s_pfn_Is_Valid_Security_Descriptor_Proc == NULL)
     {
@@ -1295,12 +1279,14 @@ convert_sd_to_sddl (PSECURITY_DESCRIPTOR 
SecurityDescriptor,
       g_b_init_convert_sd_to_sddl = 1;
 #ifdef _UNICODE
       s_pfn_Convert_SD_To_SDDL =
-       
(ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)GetProcAddress 
(GetModuleHandle ("Advapi32.dll"),
-                                                                               
  "ConvertSecurityDescriptorToStringSecurityDescriptorW");
+       (ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)
+        get_proc_addr (GetModuleHandle ("Advapi32.dll"),
+                              
"ConvertSecurityDescriptorToStringSecurityDescriptorW");
 #else
       s_pfn_Convert_SD_To_SDDL =
-       
(ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)GetProcAddress 
(GetModuleHandle ("Advapi32.dll"),
-                                                                               
  "ConvertSecurityDescriptorToStringSecurityDescriptorA");
+       (ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)
+        get_proc_addr (GetModuleHandle ("Advapi32.dll"),
+                              
"ConvertSecurityDescriptorToStringSecurityDescriptorA");
 #endif
     }
   if (s_pfn_Convert_SD_To_SDDL == NULL)
@@ -1338,12 +1324,14 @@ convert_sddl_to_sd (LPCTSTR StringSecurityDescriptor,
       g_b_init_convert_sddl_to_sd = 1;
 #ifdef _UNICODE
       s_pfn_Convert_SDDL_To_SD =
-       
(ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)GetProcAddress 
(GetModuleHandle ("Advapi32.dll"),
-                                                                               
  "ConvertStringSecurityDescriptorToSecurityDescriptorW");
+       (ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)
+        get_proc_addr (GetModuleHandle ("Advapi32.dll"),
+                              
"ConvertStringSecurityDescriptorToSecurityDescriptorW");
 #else
       s_pfn_Convert_SDDL_To_SD =
-       
(ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)GetProcAddress 
(GetModuleHandle ("Advapi32.dll"),
-                                                                               
  "ConvertStringSecurityDescriptorToSecurityDescriptorA");
+       (ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)
+        get_proc_addr (GetModuleHandle ("Advapi32.dll"),
+                              
"ConvertStringSecurityDescriptorToSecurityDescriptorA");
 #endif
     }
   if (s_pfn_Convert_SDDL_To_SD == NULL)
@@ -1375,7 +1363,7 @@ get_adapters_info (PIP_ADAPTER_INFO pAdapterInfo, PULONG 
pOutBufLen)
       hm_iphlpapi = LoadLibrary ("Iphlpapi.dll");
       if (hm_iphlpapi)
        s_pfn_Get_Adapters_Info = (GetAdaptersInfo_Proc)
-         GetProcAddress (hm_iphlpapi, "GetAdaptersInfo");
+         get_proc_addr (hm_iphlpapi, "GetAdaptersInfo");
     }
   if (s_pfn_Get_Adapters_Info == NULL)
     return ERROR_NOT_SUPPORTED;
@@ -1398,7 +1386,7 @@ reg_open_key_ex_w (HKEY hkey, LPCWSTR lpSubKey, DWORD 
ulOptions,
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
       if (hm_advapi32)
        s_pfn_Reg_Open_Key_Ex_w = (RegOpenKeyExW_Proc)
-         GetProcAddress (hm_advapi32, "RegOpenKeyExW");
+         get_proc_addr (hm_advapi32, "RegOpenKeyExW");
     }
   if (s_pfn_Reg_Open_Key_Ex_w == NULL)
     return ERROR_NOT_SUPPORTED;
@@ -1422,7 +1410,7 @@ reg_query_value_ex_w (HKEY hkey, LPCWSTR lpValueName, 
LPDWORD lpReserved,
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
       if (hm_advapi32)
        s_pfn_Reg_Query_Value_Ex_w = (RegQueryValueExW_Proc)
-         GetProcAddress (hm_advapi32, "RegQueryValueExW");
+         get_proc_addr (hm_advapi32, "RegQueryValueExW");
     }
   if (s_pfn_Reg_Query_Value_Ex_w == NULL)
     return ERROR_NOT_SUPPORTED;
@@ -1445,7 +1433,7 @@ expand_environment_strings_w (LPCWSTR lpSrc, LPWSTR 
lpDst, DWORD nSize)
       hm_kernel32 = LoadLibrary ("Kernel32.dll");
       if (hm_kernel32)
        s_pfn_Expand_Environment_Strings_w = (ExpandEnvironmentStringsW_Proc)
-         GetProcAddress (hm_kernel32, "ExpandEnvironmentStringsW");
+         get_proc_addr (hm_kernel32, "ExpandEnvironmentStringsW");
     }
   if (s_pfn_Expand_Environment_Strings_w == NULL)
     {
@@ -2807,7 +2795,8 @@ init_environment (char ** argv)
           MSIE 5.  */
        ShGetFolderPath_fn get_folder_path;
        get_folder_path = (ShGetFolderPath_fn)
-         GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA");
+         get_proc_addr (GetModuleHandle ("shell32.dll"),
+                                "SHGetFolderPathA");
 
        if (get_folder_path != NULL)
          {
@@ -6639,8 +6628,8 @@ create_toolhelp32_snapshot (DWORD Flags, DWORD Ignored)
     {
       g_b_init_create_toolhelp32_snapshot = 1;
       s_pfn_Create_Toolhelp32_Snapshot = (CreateToolhelp32Snapshot_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "CreateToolhelp32Snapshot");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "CreateToolhelp32Snapshot");
     }
   if (s_pfn_Create_Toolhelp32_Snapshot == NULL)
     {
@@ -6658,8 +6647,8 @@ process32_first (HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
     {
       g_b_init_process32_first = 1;
       s_pfn_Process32_First = (Process32First_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "Process32First");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "Process32First");
     }
   if (s_pfn_Process32_First == NULL)
     {
@@ -6677,8 +6666,8 @@ process32_next (HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
     {
       g_b_init_process32_next = 1;
       s_pfn_Process32_Next = (Process32Next_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "Process32Next");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "Process32Next");
     }
   if (s_pfn_Process32_Next == NULL)
     {
@@ -6704,8 +6693,8 @@ open_thread_token (HANDLE ThreadHandle,
     {
       g_b_init_open_thread_token = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Open_Thread_Token =
-        (OpenThreadToken_Proc) GetProcAddress (hm_advapi32, "OpenThreadToken");
+      s_pfn_Open_Thread_Token = (OpenThreadToken_Proc)
+        get_proc_addr (hm_advapi32, "OpenThreadToken");
     }
   if (s_pfn_Open_Thread_Token == NULL)
     {
@@ -6734,8 +6723,8 @@ impersonate_self (SECURITY_IMPERSONATION_LEVEL 
ImpersonationLevel)
     {
       g_b_init_impersonate_self = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Impersonate_Self =
-        (ImpersonateSelf_Proc) GetProcAddress (hm_advapi32, "ImpersonateSelf");
+      s_pfn_Impersonate_Self = (ImpersonateSelf_Proc)
+        get_proc_addr (hm_advapi32, "ImpersonateSelf");
     }
   if (s_pfn_Impersonate_Self == NULL)
     {
@@ -6757,8 +6746,8 @@ revert_to_self (void)
     {
       g_b_init_revert_to_self = 1;
       hm_advapi32 = LoadLibrary ("Advapi32.dll");
-      s_pfn_Revert_To_Self =
-        (RevertToSelf_Proc) GetProcAddress (hm_advapi32, "RevertToSelf");
+      s_pfn_Revert_To_Self = (RevertToSelf_Proc)
+        get_proc_addr (hm_advapi32, "RevertToSelf");
     }
   if (s_pfn_Revert_To_Self == NULL)
     {
@@ -6784,7 +6773,7 @@ get_process_memory_info (HANDLE h_proc,
       hm_psapi = LoadLibrary ("Psapi.dll");
       if (hm_psapi)
        s_pfn_Get_Process_Memory_Info = (GetProcessMemoryInfo_Proc)
-         GetProcAddress (hm_psapi, "GetProcessMemoryInfo");
+         get_proc_addr (hm_psapi, "GetProcessMemoryInfo");
     }
   if (s_pfn_Get_Process_Memory_Info == NULL)
     {
@@ -6809,8 +6798,8 @@ get_process_working_set_size (HANDLE h_proc,
     {
       g_b_init_get_process_working_set_size = 1;
       s_pfn_Get_Process_Working_Set_Size = (GetProcessWorkingSetSize_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "GetProcessWorkingSetSize");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "GetProcessWorkingSetSize");
     }
   if (s_pfn_Get_Process_Working_Set_Size == NULL)
     {
@@ -6832,8 +6821,8 @@ global_memory_status (MEMORYSTATUS *buf)
     {
       g_b_init_global_memory_status = 1;
       s_pfn_Global_Memory_Status = (GlobalMemoryStatus_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "GlobalMemoryStatus");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "GlobalMemoryStatus");
     }
   if (s_pfn_Global_Memory_Status == NULL)
     {
@@ -6855,8 +6844,8 @@ global_memory_status_ex (MEMORY_STATUS_EX *buf)
     {
       g_b_init_global_memory_status_ex = 1;
       s_pfn_Global_Memory_Status_Ex = (GlobalMemoryStatusEx_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                       "GlobalMemoryStatusEx");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                              "GlobalMemoryStatusEx");
     }
   if (s_pfn_Global_Memory_Status_Ex == NULL)
     {
@@ -7428,8 +7417,8 @@ init_winsock (int load_now)
     return TRUE;
 
   pfn_SetHandleInformation
-    = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                              "SetHandleInformation");
+    = (void *) get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                                     "SetHandleInformation");
 
   winsock_lib = LoadLibrary ("Ws2_32.dll");
 
@@ -7438,7 +7427,7 @@ init_winsock (int load_now)
       /* dynamically link to socket functions */
 
 #define LOAD_PROC(fn) \
-      if ((pfn_##fn = (void *) GetProcAddress (winsock_lib, #fn)) == NULL) \
+      if ((pfn_##fn = (void *) get_proc_addr (winsock_lib, #fn)) == NULL) \
         goto fail;
 
       LOAD_PROC (WSAStartup);
@@ -7473,8 +7462,8 @@ init_winsock (int load_now)
 #undef LOAD_PROC
 
       /* Try loading functions not available before XP.  */
-      pfn_getaddrinfo = (void *) GetProcAddress (winsock_lib, "getaddrinfo");
-      pfn_freeaddrinfo = (void *) GetProcAddress (winsock_lib, "freeaddrinfo");
+      pfn_getaddrinfo = (void *) get_proc_addr (winsock_lib, "getaddrinfo");
+      pfn_freeaddrinfo = (void *) get_proc_addr (winsock_lib, "freeaddrinfo");
       /* Paranoia: these two functions should go together, so if one
         is absent, we cannot use the other.  */
       if (pfn_getaddrinfo == NULL)
@@ -9892,10 +9881,10 @@ maybe_load_unicows_dll (void)
             pointers, and assign the correct addresses to these
             pointers at program startup (see emacs.c, which calls
             this function early on).  */
-         pMultiByteToWideChar =
-           (MultiByteToWideChar_Proc)GetProcAddress (ret, 
"MultiByteToWideChar");
-         pWideCharToMultiByte =
-           (WideCharToMultiByte_Proc)GetProcAddress (ret, 
"WideCharToMultiByte");
+         pMultiByteToWideChar = (MultiByteToWideChar_Proc)
+            get_proc_addr (ret, "MultiByteToWideChar");
+         pWideCharToMultiByte = (WideCharToMultiByte_Proc)
+            get_proc_addr (ret, "WideCharToMultiByte");
           multiByteToWideCharFlags = MB_ERR_INVALID_CHARS;
          return ret;
        }
@@ -9946,7 +9935,7 @@ globals_of_w32 (void)
   HMODULE kernel32 = GetModuleHandle ("kernel32.dll");
 
   get_process_times_fn = (GetProcessTimes_Proc)
-    GetProcAddress (kernel32, "GetProcessTimes");
+    get_proc_addr (kernel32, "GetProcessTimes");
 
   DEFSYM (QCloaded_from, ":loaded-from");
 
diff --git a/src/w32.h b/src/w32.h
index fe8689a..a053ee0 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -164,6 +164,10 @@ extern void reset_standard_handles (int in, int out,
 /* Return the string resource associated with KEY of type TYPE.  */
 extern LPBYTE w32_get_resource (const char * key, LPDWORD type);
 
+/* Load a function from a DLL.  Defined in this file.  */
+typedef void (* VOIDFNPTR) (void);
+INLINE VOIDFNPTR get_proc_addr (HINSTANCE handle, LPCSTR fname);
+
 extern void release_listen_threads (void);
 extern void init_ntproc (int);
 extern void term_ntproc (int);
@@ -241,14 +245,30 @@ extern ssize_t emacs_gnutls_push (gnutls_transport_ptr_t 
p,
                                   const void* buf, size_t sz);
 #endif /* HAVE_GNUTLS */
 
-/* Definine a function that will be loaded from a DLL.  */
-#define DEF_DLL_FN(type, func, args) static type (FAR CDECL *fn_##func) args
+
+
+/* Load a function address from a DLL. Cast the result via "VOIDFNPTR"
+   to pacify -Wcast-function-type in GCC 8.1.  */
+INLINE VOIDFNPTR
+get_proc_addr (HINSTANCE handle, LPCSTR fname)
+{
+  return (VOIDFNPTR) GetProcAddress (handle, fname);
+}
+
+/* Define a function that will be loaded from a DLL.  The variable
+   arguments should contain the argument list for the function, and
+   optionally be followed by function attributes.  For example:
+   DEF_DLL_FN (void, png_longjmp, (png_structp, int) PNG_NORETURN);
+  */
+#define DEF_DLL_FN(type, func, ...)                     \
+  typedef type (CDECL *W32_PFN_##func) __VA_ARGS__;     \
+  static W32_PFN_##func fn_##func
 
 /* Load a function from the DLL.  */
 #define LOAD_DLL_FN(lib, func)                                         \
   do                                                                   \
     {                                                                  \
-      fn_##func = (void *) GetProcAddress (lib, #func);                        
\
+      fn_##func = (W32_PFN_##func) get_proc_addr (lib, #func);   \
       if (!fn_##func)                                                  \
        return false;                                                   \
     }                                                                  \
diff --git a/src/w32fns.c b/src/w32fns.c
index 8d5293c..c32868f 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2640,7 +2640,7 @@ setup_w32_kbdhook (void)
   if (w32_kbdhook_active)
     {
       IsDebuggerPresent_Proc is_debugger_present = (IsDebuggerPresent_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"), "IsDebuggerPresent");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"), "IsDebuggerPresent");
       if (is_debugger_present && is_debugger_present ())
        return;
     }
@@ -2655,7 +2655,7 @@ setup_w32_kbdhook (void)
         (https://support.microsoft.com/en-us/kb/124103) is used for
         NT 4 systems.  */
       GetConsoleWindow_Proc get_console = (GetConsoleWindow_Proc)
-       GetProcAddress (GetModuleHandle ("kernel32.dll"), "GetConsoleWindow");
+       get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetConsoleWindow");
 
       if (get_console != NULL)
        kbdhook.console = get_console ();
@@ -9117,9 +9117,9 @@ DEFUN ("file-system-info", Ffile_system_info, 
Sfile_system_info, 1, 1, 0,
   {
     HMODULE hKernel = GetModuleHandle ("kernel32");
     GetDiskFreeSpaceExW_Proc pfn_GetDiskFreeSpaceExW =
-      (GetDiskFreeSpaceExW_Proc) GetProcAddress (hKernel, 
"GetDiskFreeSpaceExW");
+      (GetDiskFreeSpaceExW_Proc) get_proc_addr (hKernel, 
"GetDiskFreeSpaceExW");
     GetDiskFreeSpaceExA_Proc pfn_GetDiskFreeSpaceExA =
-      (GetDiskFreeSpaceExA_Proc) GetProcAddress (hKernel, 
"GetDiskFreeSpaceExA");
+      (GetDiskFreeSpaceExA_Proc) get_proc_addr (hKernel, 
"GetDiskFreeSpaceExA");
     bool have_pfn_GetDiskFreeSpaceEx =
       ((w32_unicode_filenames && pfn_GetDiskFreeSpaceExW)
        || (!w32_unicode_filenames && pfn_GetDiskFreeSpaceExA));
@@ -9694,8 +9694,8 @@ get_dll_version (const char *dll_name)
 
   if (hdll)
     {
-      DLLGETVERSIONPROC pDllGetVersion
-       = (DLLGETVERSIONPROC) GetProcAddress (hdll, "DllGetVersion");
+      DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)
+        get_proc_addr (hdll, "DllGetVersion");
 
       if (pDllGetVersion)
        {
@@ -10662,9 +10662,8 @@ void
 w32_reset_stack_overflow_guard (void)
 {
   if (resetstkoflw == NULL)
-    resetstkoflw =
-      (_resetstkoflw_proc)GetProcAddress (GetModuleHandle ("msvcrt.dll"),
-                                         "_resetstkoflw");
+    resetstkoflw = (_resetstkoflw_proc)
+      get_proc_addr (GetModuleHandle ("msvcrt.dll"), "_resetstkoflw");
   /* We ignore the return value.  If _resetstkoflw fails, the next
      stack overflow will crash the program.  */
   if (resetstkoflw != NULL)
@@ -10738,9 +10737,8 @@ w32_backtrace (void **buffer, int limit)
   if (!s_pfn_CaptureStackBackTrace)
     {
       hm_kernel32 = LoadLibrary ("Kernel32.dll");
-      s_pfn_CaptureStackBackTrace =
-       (CaptureStackBackTrace_proc) GetProcAddress (hm_kernel32,
-                                                    
"RtlCaptureStackBackTrace");
+      s_pfn_CaptureStackBackTrace = (CaptureStackBackTrace_proc)
+        get_proc_addr (hm_kernel32, "RtlCaptureStackBackTrace");
     }
   if (s_pfn_CaptureStackBackTrace)
     return s_pfn_CaptureStackBackTrace (0, min (BACKTRACE_LIMIT_MAX, limit),
@@ -10873,29 +10871,29 @@ globals_of_w32fns (void)
     it dynamically.  Do it once, here, instead of every time it is used.
   */
   track_mouse_event_fn = (TrackMouseEvent_Proc)
-    GetProcAddress (user32_lib, "TrackMouseEvent");
+    get_proc_addr (user32_lib, "TrackMouseEvent");
 
   monitor_from_point_fn = (MonitorFromPoint_Proc)
-    GetProcAddress (user32_lib, "MonitorFromPoint");
+    get_proc_addr (user32_lib, "MonitorFromPoint");
   get_monitor_info_fn = (GetMonitorInfo_Proc)
-    GetProcAddress (user32_lib, "GetMonitorInfoA");
+    get_proc_addr (user32_lib, "GetMonitorInfoA");
   monitor_from_window_fn = (MonitorFromWindow_Proc)
-    GetProcAddress (user32_lib, "MonitorFromWindow");
+    get_proc_addr (user32_lib, "MonitorFromWindow");
   enum_display_monitors_fn = (EnumDisplayMonitors_Proc)
-    GetProcAddress (user32_lib, "EnumDisplayMonitors");
+    get_proc_addr (user32_lib, "EnumDisplayMonitors");
   get_title_bar_info_fn = (GetTitleBarInfo_Proc)
-    GetProcAddress (user32_lib, "GetTitleBarInfo");
+    get_proc_addr (user32_lib, "GetTitleBarInfo");
 
   {
     HMODULE imm32_lib = GetModuleHandle ("imm32.dll");
     get_composition_string_fn = (ImmGetCompositionString_Proc)
-      GetProcAddress (imm32_lib, "ImmGetCompositionStringW");
+      get_proc_addr (imm32_lib, "ImmGetCompositionStringW");
     get_ime_context_fn = (ImmGetContext_Proc)
-      GetProcAddress (imm32_lib, "ImmGetContext");
+      get_proc_addr (imm32_lib, "ImmGetContext");
     release_ime_context_fn = (ImmReleaseContext_Proc)
-      GetProcAddress (imm32_lib, "ImmReleaseContext");
+      get_proc_addr (imm32_lib, "ImmReleaseContext");
     set_ime_composition_window_fn = (ImmSetCompositionWindow_Proc)
-      GetProcAddress (imm32_lib, "ImmSetCompositionWindow");
+      get_proc_addr (imm32_lib, "ImmSetCompositionWindow");
   }
 
   except_code = 0;
diff --git a/src/w32font.c b/src/w32font.c
index c2f5dc3..f613061 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -153,7 +153,7 @@ get_outline_metrics_w(HDC hdc, UINT cbData, 
LPOUTLINETEXTMETRICW lpotmw)
       hm_unicows = w32_load_unicows_or_gdi32 ();
       if (hm_unicows)
        s_pfn_Get_Outline_Text_MetricsW = (GetOutlineTextMetricsW_Proc)
-         GetProcAddress (hm_unicows, "GetOutlineTextMetricsW");
+         get_proc_addr (hm_unicows, "GetOutlineTextMetricsW");
     }
   eassert (s_pfn_Get_Outline_Text_MetricsW != NULL);
   return s_pfn_Get_Outline_Text_MetricsW (hdc, cbData, lpotmw);
@@ -170,7 +170,7 @@ get_text_metrics_w(HDC hdc, LPTEXTMETRICW lptmw)
       hm_unicows = w32_load_unicows_or_gdi32 ();
       if (hm_unicows)
        s_pfn_Get_Text_MetricsW = (GetTextMetricsW_Proc)
-         GetProcAddress (hm_unicows, "GetTextMetricsW");
+         get_proc_addr (hm_unicows, "GetTextMetricsW");
     }
   eassert (s_pfn_Get_Text_MetricsW != NULL);
   return s_pfn_Get_Text_MetricsW (hdc, lptmw);
@@ -188,7 +188,7 @@ get_glyph_outline_w (HDC hdc, UINT uChar, UINT uFormat, 
LPGLYPHMETRICS lpgm,
       hm_unicows = w32_load_unicows_or_gdi32 ();
       if (hm_unicows)
        s_pfn_Get_Glyph_OutlineW = (GetGlyphOutlineW_Proc)
-         GetProcAddress (hm_unicows, "GetGlyphOutlineW");
+         get_proc_addr (hm_unicows, "GetGlyphOutlineW");
     }
   eassert (s_pfn_Get_Glyph_OutlineW != NULL);
   return s_pfn_Get_Glyph_OutlineW (hdc, uChar, uFormat, lpgm, cbBuffer,
@@ -206,7 +206,7 @@ get_char_width_32_w (HDC hdc, UINT uFirstChar, UINT 
uLastChar, LPINT lpBuffer)
       hm_unicows = w32_load_unicows_or_gdi32 ();
       if (hm_unicows)
        s_pfn_Get_Char_Width_32W = (GetCharWidth32W_Proc)
-         GetProcAddress (hm_unicows, "GetCharWidth32W");
+         get_proc_addr (hm_unicows, "GetCharWidth32W");
     }
   eassert (s_pfn_Get_Char_Width_32W != NULL);
   return s_pfn_Get_Char_Width_32W (hdc, uFirstChar, uLastChar, lpBuffer);
diff --git a/src/w32heap.c b/src/w32heap.c
index df79f8c..8c94682 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -250,7 +250,9 @@ init_heap (void)
 #ifndef MINGW_W64
       /* Set the low-fragmentation heap for OS before Vista.  */
       HMODULE hm_kernel32dll = LoadLibrary ("kernel32.dll");
-      HeapSetInformation_Proc s_pfn_Heap_Set_Information = 
(HeapSetInformation_Proc) GetProcAddress (hm_kernel32dll, "HeapSetInformation");
+      HeapSetInformation_Proc s_pfn_Heap_Set_Information =
+        (HeapSetInformation_Proc) get_proc_addr (hm_kernel32dll,
+                                                        "HeapSetInformation");
       if (s_pfn_Heap_Set_Information != NULL)
        {
          if (s_pfn_Heap_Set_Information ((PVOID) heap,
@@ -281,7 +283,7 @@ init_heap (void)
          in ntdll.dll since XP.  */
       HMODULE hm_ntdll = LoadLibrary ("ntdll.dll");
       RtlCreateHeap_Proc s_pfn_Rtl_Create_Heap
-       = (RtlCreateHeap_Proc) GetProcAddress (hm_ntdll, "RtlCreateHeap");
+       = (RtlCreateHeap_Proc) get_proc_addr (hm_ntdll, "RtlCreateHeap");
       /* Specific parameters for the private heap.  */
       RTL_HEAP_PARAMETERS params;
       ZeroMemory (&params, sizeof(params));
diff --git a/src/w32menu.c b/src/w32menu.c
index ece5836..a2d39c5 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1607,9 +1607,13 @@ globals_of_w32menu (void)
 #ifndef NTGUI_UNICODE
   /* See if Get/SetMenuItemInfo functions are available.  */
   HMODULE user32 = GetModuleHandle ("user32.dll");
-  get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, 
"GetMenuItemInfoA");
-  set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, 
"SetMenuItemInfoA");
-  unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, 
"AppendMenuW");
-  unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, 
"MessageBoxW");
+  get_menu_item_info = (GetMenuItemInfoA_Proc)
+    get_proc_addr (user32, "GetMenuItemInfoA");
+  set_menu_item_info = (SetMenuItemInfoA_Proc)
+    get_proc_addr (user32, "SetMenuItemInfoA");
+  unicode_append_menu = (AppendMenuW_Proc)
+    get_proc_addr (user32, "AppendMenuW");
+  unicode_message_box = (MessageBoxW_Proc)
+    get_proc_addr (user32, "MessageBoxW");
 #endif /* !NTGUI_UNICODE */
 }
diff --git a/src/w32proc.c b/src/w32proc.c
index 61ce157..5c2cb32 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -548,9 +548,8 @@ init_timers (void)
      through a pointer.  */
   s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */
   if (os_subtype != OS_9X)
-    s_pfn_Get_Thread_Times =
-      (GetThreadTimes_Proc)GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                                          "GetThreadTimes");
+    s_pfn_Get_Thread_Times = (GetThreadTimes_Proc)
+      get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes");
 
   /* Make sure we start with zeroed out itimer structures, since
      dumping may have left there traces of threads long dead.  */
@@ -2691,8 +2690,8 @@ sys_kill (pid_t pid, int sig)
        {
          g_b_init_debug_break_process = 1;
          s_pfn_Debug_Break_Process = (DebugBreakProcess_Proc)
-           GetProcAddress (GetModuleHandle ("kernel32.dll"),
-                           "DebugBreakProcess");
+           get_proc_addr (GetModuleHandle ("kernel32.dll"),
+                                  "DebugBreakProcess");
        }
 
       if (s_pfn_Debug_Break_Process == NULL)
@@ -3608,9 +3607,9 @@ w32_compare_strings (const char *s1, const char *s2, char 
*locname,
     {
       if (os_subtype == OS_9X)
        {
-         pCompareStringW =
-            (CompareStringW_Proc) GetProcAddress (LoadLibrary ("Unicows.dll"),
-                                                  "CompareStringW");
+         pCompareStringW = (CompareStringW_Proc)
+            get_proc_addr (LoadLibrary ("Unicows.dll"),
+                                  "CompareStringW");
          if (!pCompareStringW)
            {
              errno = EINVAL;
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 11bfa54..54f1616 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -1194,11 +1194,11 @@ syms_of_w32uniscribe (void)
   register_font_driver (&uniscribe_font_driver, NULL);
 
   script_get_font_scripts_fn = (ScriptGetFontScriptTags_Proc)
-    GetProcAddress (uniscribe, "ScriptGetFontScriptTags");
+    get_proc_addr (uniscribe, "ScriptGetFontScriptTags");
   script_get_font_languages_fn = (ScriptGetFontLanguageTags_Proc)
-    GetProcAddress (uniscribe, "ScriptGetFontLanguageTags");
+    get_proc_addr (uniscribe, "ScriptGetFontLanguageTags");
   script_get_font_features_fn = (ScriptGetFontFeatureTags_Proc)
-    GetProcAddress (uniscribe, "ScriptGetFontFeatureTags");
+    get_proc_addr (uniscribe, "ScriptGetFontFeatureTags");
   if (script_get_font_scripts_fn
       && script_get_font_languages_fn
       && script_get_font_features_fn)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]