* Patch for warnings in 64bit Windows builds
@ 2015-07-28 11:57 Andy Moreton
2015-07-28 13:40 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Andy Moreton @ 2015-07-28 11:57 UTC (permalink / raw)
To: emacs-devel
Hi,
The 64bit Windows builds have shown a few warnings for some time:
../../src/w32proc.c: In function 'w32_compare_strings':
../../src/w32proc.c:3526:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
pCompareStringW = GetProcAddress (LoadLibrary ("Unicows.dll"),
^
../../src/w32fns.c: In function 'Ffile_system_info':
../../src/w32fns.c:7827:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
= GetProcAddress (hKernel, "GetDiskFreeSpaceExW");
^
../../src/w32fns.c:7830:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
= GetProcAddress (hKernel, "GetDiskFreeSpaceExA");
^
The following patch builds cleanly on:
- 32bit mingw
- 32bit mingw --with-wide-int
- 64bit mingw64
I don't have copyright paperwork on file, so please let me know if that
is required.
AndyM
diff --git a/src/w32fns.c b/src/w32fns.c
index abfa315e2a96..499450f4c927 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7799,6 +7799,11 @@ The following %-sequences are provided:
\f
#ifdef WINDOWSNT
+typedef BOOL (WINAPI *GetDiskFreeSpaceExW_Proc)
+ (LPCWSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
+typedef BOOL (WINAPI *GetDiskFreeSpaceExA_Proc)
+ (LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
+
DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
doc: /* Return storage information about the file system FILENAME is on.
Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
@@ -7822,12 +7827,10 @@ If the underlying system call fails, value is nil. */)
added rather late on. */
{
HMODULE hKernel = GetModuleHandle ("kernel32");
- BOOL (WINAPI *pfn_GetDiskFreeSpaceExW)
- (wchar_t *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER)
- = GetProcAddress (hKernel, "GetDiskFreeSpaceExW");
- BOOL (WINAPI *pfn_GetDiskFreeSpaceExA)
- (char *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER)
- = GetProcAddress (hKernel, "GetDiskFreeSpaceExA");
+ GetDiskFreeSpaceExW_Proc pfn_GetDiskFreeSpaceExW =
+ (GetDiskFreeSpaceExW_Proc) GetProcAddress (hKernel, "GetDiskFreeSpaceExW");
+ GetDiskFreeSpaceExA_Proc pfn_GetDiskFreeSpaceExA =
+ (GetDiskFreeSpaceExA_Proc) GetProcAddress (hKernel, "GetDiskFreeSpaceExA");
bool have_pfn_GetDiskFreeSpaceEx =
((w32_unicode_filenames && pfn_GetDiskFreeSpaceExW)
|| (!w32_unicode_filenames && pfn_GetDiskFreeSpaceExA));
diff --git a/src/w32proc.c b/src/w32proc.c
index ca4322b69d16..66a9761ad138 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3327,16 +3327,16 @@ yield nil. */)
(Lisp_Object cp)
{
CHARSETINFO info;
- DWORD dwcp;
+ DWORD_PTR dwcp;
CHECK_NUMBER (cp);
if (!IsValidCodePage (XINT (cp)))
return Qnil;
- /* Going through a temporary DWORD variable avoids compiler warning
+ /* Going through a temporary DWORD_PTR variable avoids compiler warning
about cast to pointer from integer of different size, when
- building --with-wide-int. */
+ building --with-wide-int or building for 64bit. */
dwcp = XINT (cp);
if (TranslateCharsetInfo ((DWORD *) dwcp, &info, TCI_SRCCODEPAGE))
return make_number (info.ciCharset);
@@ -3499,6 +3499,9 @@ get_lcid (const char *locale_name)
# define LINGUISTIC_IGNORECASE 0x00000010
#endif
+typedef int (WINAPI *CompareStringW_Proc)
+ (LCID, DWORD, LPCWSTR, int, LPCWSTR, int);
+
int
w32_compare_strings (const char *s1, const char *s2, char *locname,
int ignore_case)
@@ -3507,7 +3510,7 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
wchar_t *string1_w, *string2_w;
int val, needed;
extern BOOL g_b_init_compare_string_w;
- static int (WINAPI *pCompareStringW)(LCID, DWORD, LPCWSTR, int, LPCWSTR, int);
+ static CompareStringW_Proc pCompareStringW;
DWORD flags = 0;
USE_SAFE_ALLOCA;
@@ -3523,8 +3526,9 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
{
if (os_subtype == OS_9X)
{
- pCompareStringW = GetProcAddress (LoadLibrary ("Unicows.dll"),
- "CompareStringW");
+ pCompareStringW =
+ (CompareStringW_Proc) GetProcAddress (LoadLibrary ("Unicows.dll"),
+ "CompareStringW");
if (!pCompareStringW)
{
errno = EINVAL;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Patch for warnings in 64bit Windows builds
2015-07-28 11:57 Patch for warnings in 64bit Windows builds Andy Moreton
@ 2015-07-28 13:40 ` Eli Zaretskii
2015-07-30 21:09 ` Andy Moreton
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2015-07-28 13:40 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Tue, 28 Jul 2015 12:57:42 +0100
>
> The 64bit Windows builds have shown a few warnings for some time:
>
> ../../src/w32proc.c: In function 'w32_compare_strings':
> ../../src/w32proc.c:3526:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
> pCompareStringW = GetProcAddress (LoadLibrary ("Unicows.dll"),
> ^
> ../../src/w32fns.c: In function 'Ffile_system_info':
> ../../src/w32fns.c:7827:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
> = GetProcAddress (hKernel, "GetDiskFreeSpaceExW");
> ^
> ../../src/w32fns.c:7830:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
> = GetProcAddress (hKernel, "GetDiskFreeSpaceExA");
> ^
> The following patch builds cleanly on:
> - 32bit mingw
> - 32bit mingw --with-wide-int
> - 64bit mingw64
Thanks, pushed.
> I don't have copyright paperwork on file, so please let me know if that
> is required.
Not needed, but you are encouraged to start the paperwork rolling, so
it will be ready for your next contribution.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for warnings in 64bit Windows builds
2015-07-28 13:40 ` Eli Zaretskii
@ 2015-07-30 21:09 ` Andy Moreton
2015-07-31 6:55 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Andy Moreton @ 2015-07-30 21:09 UTC (permalink / raw)
To: emacs-devel
On Tue 28 Jul 2015, Eli Zaretskii wrote:
>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Tue, 28 Jul 2015 12:57:42 +0100
>>
>> The 64bit Windows builds have shown a few warnings for some time:
>>
>> ../../src/w32proc.c: In function 'w32_compare_strings':
>> ../../src/w32proc.c:3526:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
>> pCompareStringW = GetProcAddress (LoadLibrary ("Unicows.dll"),
>> ^
>> ../../src/w32fns.c: In function 'Ffile_system_info':
>> ../../src/w32fns.c:7827:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>> = GetProcAddress (hKernel, "GetDiskFreeSpaceExW");
>> ^
>> ../../src/w32fns.c:7830:9: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>> = GetProcAddress (hKernel, "GetDiskFreeSpaceExA");
>> ^
>> The following patch builds cleanly on:
>> - 32bit mingw
>> - 32bit mingw --with-wide-int
>> - 64bit mingw64
>
> Thanks, pushed.
I've noticed some other warnings in the 64bit mingw64 builds requiring
a similar fix:
../../src/w32.c: In function 'maybe_load_unicows_dll':
../../src/w32.c:9174:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
pMultiByteToWideChar = GetProcAddress (ret, "MultiByteToWideChar");
^
../../src/w32.c:9175:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
pWideCharToMultiByte = GetProcAddress (ret, "WideCharToMultiByte");
^
There is also a warning about socket handling:
../../src/w32.c: In function 'sys_socket':
../../src/w32.c:7336:14: warning: overflow in implicit constant conversion [-Woverflow]
return INVALID_SOCKET;
^
c:/msys64/mingw64/x86_64-w64-mingw32/include/psdk_inc/_socket_types.h
contains:
#if 1
typedef UINT_PTR SOCKET;
#else
typedef INT_PTR SOCKET;
#endif
#define INVALID_SOCKET (SOCKET)(~0)
Thus it is corect to warn about a conversion from unsigned 64bit to a
signed 32bit value.
>> I don't have copyright paperwork on file, so please let me know if that
>> is required.
>
> Not needed, but you are encouraged to start the paperwork rolling, so
> it will be ready for your next contribution.
Where do I find the appropriate forms ?
AndyM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for warnings in 64bit Windows builds
2015-07-30 21:09 ` Andy Moreton
@ 2015-07-31 6:55 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2015-07-31 6:55 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Thu, 30 Jul 2015 22:09:51 +0100
>
> I've noticed some other warnings in the 64bit mingw64 builds requiring
> a similar fix:
>
> ../../src/w32.c: In function 'maybe_load_unicows_dll':
> ../../src/w32.c:9174:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
> pMultiByteToWideChar = GetProcAddress (ret, "MultiByteToWideChar");
> ^
> ../../src/w32.c:9175:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
> pWideCharToMultiByte = GetProcAddress (ret, "WideCharToMultiByte");
> ^
>
> There is also a warning about socket handling:
>
> ../../src/w32.c: In function 'sys_socket':
> ../../src/w32.c:7336:14: warning: overflow in implicit constant conversion [-Woverflow]
> return INVALID_SOCKET;
> ^
> c:/msys64/mingw64/x86_64-w64-mingw32/include/psdk_inc/_socket_types.h
> contains:
>
> #if 1
> typedef UINT_PTR SOCKET;
> #else
> typedef INT_PTR SOCKET;
> #endif
>
> #define INVALID_SOCKET (SOCKET)(~0)
>
> Thus it is corect to warn about a conversion from unsigned 64bit to a
> signed 32bit value.
Please propose changes to eliminate those. (I can propose them
myself, but I cannot test them.)
> >> I don't have copyright paperwork on file, so please let me know if that
> >> is required.
> >
> > Not needed, but you are encouraged to start the paperwork rolling, so
> > it will be ready for your next contribution.
>
> Where do I find the appropriate forms ?
One place is in Gnulib's Git repository, in the doc/Copyright/
directory. You want the file request-assign.future. There are some
explanations in
https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html, but
the form is pretty much self-explanatory.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-31 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 11:57 Patch for warnings in 64bit Windows builds Andy Moreton
2015-07-28 13:40 ` Eli Zaretskii
2015-07-30 21:09 ` Andy Moreton
2015-07-31 6:55 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).