[Top][All Lists]

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

Re: Suspicious warning in W64 build

From: Fabrice Popineau
Subject: Re: Suspicious warning in W64 build
Date: Fri, 15 Sep 2017 08:55:06 +0200

2017-09-14 23:17 GMT+02:00 Andy Moreton <address@hidden>:
On Thu 14 Sep 2017, Eli Zaretskii wrote:

>> Date: Tue, 12 Sep 2017 21:38:24 +0300
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden, address@hidden
>> > From: Fabrice Popineau <address@hiddenlec.fr>
>> > Date: Tue, 12 Sep 2017 20:01:58 +0200
>> > Cc: Richard Copley <address@hidden>, Emacs developers <address@hidden>
>> >
>> > As an alternative, I can provide them.
>> > I have the same install with the same warnings.
>> >
>> > Should you want them, they are at this address :
>> > https://drive.google.com/file/d/0BzJyP_aI_ouHOWR6YXZ1LTRiam8/view?usp=sharing
>> Thanks.  I think I see the problems, or at least some of them, but I
>> need to think how to solve this for all the supported MinGW versions
>> to work correctly.
> It was a mess, but I hope I fixed these warnings now.  Please try the
> latest master and see if any fallout remains.

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
    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"

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"

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

I'd rather cast the values to "long long unsigned int" as these values are assumed to be positive,
and would be meaningless if printed in decimal. 

There are also a bunch of warnings in dispnew.c:adjust_glyph_matrix()
because the w parameter could be NULL. Actually, some parts of the code
are protected with if (w) { ... } but much more than those ones assume that
w is not NULL.

I wonder if the whole function should not just return if w is NULL.


reply via email to

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