[Top][All Lists]

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

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

From: Paul Eggert
Subject: Re: MS-Windows warnings (was build failure) for Emacs master
Date: Tue, 12 Apr 2016 15:52:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 04/12/2016 01:54 PM, Angelo Graziosi wrote:

current build logs have a lot of "garbage" like this:

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

As I understand it, though, MS-Windows defines GetLastError to return unsigned int on 64-bit machines, and unsigned long on 32-bit machines (!). This idiosyncrasy could be handled in the MS-Windows port by something like this:

|#ifdef __MINGW64__ # define pDWORD "" #else # define pDWORD "l" #endif and then the above code could be: printf ("Checking parent status failed: %"pDWORD"u\n", GetLastError ()); |

Perhaps %u happens to work on both 32- and 64-bit MS-Windows, and if so then plain %u should suffice in practice.

checking whether C compiler handles -Wbuiltin-macro-redefined... yes

Why enabling this by default? All this should be OFF by default and only the maintainers which need it should enable it

Warnings are enabled by default in master if you have a .git subdirectory (and thus are more likely to be a maintainer-type). See the thread containing this email:


and the followup change here:


It would be easy enough to disable -Wformat warnings when compiling anything under MS-Windows), if MS-Windows developers would prefer that. I'd rather leave these warnings enabled on non-MS-Windows platforms, though, as they're useful for catching portability glitches.

reply via email to

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