This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: src/winsup/utils ChangeLog.64bit cygcheck.cc l ...


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]