This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: src/winsup/utils ChangeLog.64bit cygcheck.cc l ...
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Wed, 6 Feb 2013 18:57:08 +0100
- Subject: Re: src/winsup/utils ChangeLog.64bit cygcheck.cc l ...
- References: <20130206170349.28387.qmail@sourceware.org> <51129485.4090007@redhat.com>
- Reply-to: cygwin-developers at cygwin dot com
On Feb 6 10:36, Eric Blake wrote:
> On 02/06/2013 10:03 AM, corinna@[...] wrote:
Bzzz.
> #include <string.h>
> +#define __STDC_FORMAT_MACROS
> +#include <inttypes.h>
> #include <wchar.h>
> #include <locale.h>
> #include <sys/cygwin.h>
> @@ -162,7 +164,8 @@
> wchar_t *buf = get_module_filename (GetCurrentProcess (), NULL);
> if (!buf)
> {
> - printf ("ldd: GetModuleFileName returned an error %lu\n",
> GetLastError ());
> + printf ("ldd: GetModuleFileName returned an error %" PRIu32 "\n",
> + (unsigned int) GetLastError ());
>
> PRIu32 is for uint32_t, not unsigned int; and on platforms where
> uint32_t is unsigned long, you've ended up causing a compiler warning.
> If you are going to cast GetLastError(), then just use %u; no need to
> drag in <inttypes.h>.
I changed that in ldd.cc. Other than that, We *know* that DWORD is
declared as unsigned long on 32 bit, but as unsigned int on 64 bit,
because sizeof long == 64 on x86_64-pc-cygwin. Therefore I'm using
the PRIu32 and PRIx32 to make sure that I have the right format
specifier for a known 32 bit variable, which uses a different type
on different platforms.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat