emacs-devel
[Top][All Lists]
Advanced

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

Re: Suspicious warning in W64 build


From: Eli Zaretskii
Subject: Re: Suspicious warning in W64 build
Date: Fri, 15 Sep 2017 12:03:58 +0300

> From: Andy Moreton <address@hidden>
> Date: Thu, 14 Sep 2017 22:17:26 +0100
> 
> There are still some issues with the pI format. This seems to fix them:
> 
> diff --git a/src/lisp.h b/src/lisp.h
> index c5aea9c34c..f522e5ee1c 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -99,7 +99,7 @@ enum { EMACS_INT_WIDTH = LLONG_WIDTH, EMACS_UINT_WIDTH = 
> ULLONG_WIDTH };
>     later and the runtime version is 5.0.0 or later.  Otherwise,
>     printf-like functions are declared with __ms_printf__ attribute,
>     which will cause a warning for %lld etc.  */
> -#  if defined __MINGW32__                                            \
> +#  if defined __MINGW32__ && !defined MINGW_W64                              
> \
>    && (!defined __USE_MINGW_ANSI_STDIO                                        
> \
>        || !(GNUC_PREREQ (6, 0, 0) && __MINGW32_MAJOR_VERSION >= 5))
>  #   define pI "I64"

Thanks, but that's not quite right, because it will cause the MinGW64
build to use "%lld" even when __USE_MINGW_ANSI_STDIO is _not_ defined,
which will cause warnings of a different kind.  (Right now, we define
__USE_MINGW_ANSI_STDIO in config.h, but I wanted to make this
future-proof.)

So I pushed a slightly different change, which will hopefully fix the
problem.  Too bad MinGW64 uses a different versioning scheme...

> There are also several similar warnings in unexw32.c due to signed/unsigned 
> mismatch:
> 
> ../../src/unexw32.c: In function 'copy_executable_and_dump_data':
> ../../src/unexw32.c:503:10: warning: format '%llx' expects argument of type 
> 'long long unsigned int', but argument 2 has type 'long long int' [-Wformat=]
>   printf ("\t0x%"pDWP" Offset in input file.\n", s - p_infile->file_base);  \
>           ^                                      ~~~~~~~~~~~~~~~
> ../../src/unexw32.c:553:3: note: in expansion of macro 'COPY_CHUNK'
>    COPY_CHUNK ("Copying DOS header...", dos_header,
>    ^~~~~~~~~~
> ../../src/unexw32.c:475:21: note: format string is defined here
>  # define pDWP  "16llx"
>                      ^

Darn that GCC 7 paranoia with signed/unsigned mismatches in printf!
GCC 6 doesn't warn here.

> Should these be using the ptrdiff_t formatter pD from lisp.h ?

No, that would cause the values be printed in decimal.  I installed
what should be a fix.

Thanks.



reply via email to

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