emacs-devel
[Top][All Lists]
Advanced

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

Re: MS-Windows warnings (was build failure) for Emacs master


From: Yuri Khan
Subject: Re: MS-Windows warnings (was build failure) for Emacs master
Date: Wed, 13 Apr 2016 11:49:39 +0600

On Wed, Apr 13, 2016 at 4:52 AM, Paul Eggert <address@hidden> wrote:
> On 04/12/2016 01:54 PM, Angelo Graziosi wrote:
>
>> C:/msys64/tmp/mingw-w64-emacs-git/src/emacs/lib-src/ntlib.c:110:15:
>> warning: format '%d' expects argument of type 'int', but argument 2 has type
>> 'DWORD {aka long unsigned int}' [-Wformat=]
>>
>>        printf ("Checking parent status failed: %d\n", GetLastError ());
>
> For portable code, that would be a valid warning. If GetLastError returns
> unsigned long, the format should use %lu, not %d

The wider issue here is that GetLastError return values are not even
meant for printf’ing. They are for feeding through FormatMessage.

> As I understand it, though, MS-Windows defines GetLastError to return
> unsigned int on 64-bit machines, and unsigned long on 32-bit machines (!).

That is, in <stdint.h> terms, uint32_t everywhere.

> This idiosyncrasy could be handled in the MS-Windows port by something like
> this:
>
>     #ifdef __MINGW64__
>     # define pDWORD ""
>     #else
>     # define pDWORD "l"
>     #endif

Alternatively, use the non-standard %I32u format specification.



reply via email to

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