src/winsup/utils ChangeLog.64bit cygcheck.cc l ...
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Feb 6 17:58:00 GMT 2013
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
More information about the Cygwin-developers
mailing list