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: Sat, 09 Sep 2017 19:07:23 +0300

> From: Richard Copley <address@hidden>
> Date: Sat, 9 Sep 2017 12:17:14 +0100
> Cc: Angelo Graziosi <address@hidden>, Emacs Development <address@hidden>
> 
> > I see a lot of warnings in that log.  It's a pity no one reports them,
> > let alone works on fixing them.  (I don't see any of them on my
> > systems.)
> 
> I assumed nobody was interested, since there were so many. My
> mistake, sorry.
> 
> Reporting the warnings by email and answering questions about what
> happens when one makes various changes isn't the most convenient
> edit-compile-test cycle I've seen. You have your reasons for using an
> old version of the compiler.

I use the latest GCC version provided by mingw.org's MinGW
distribution.  Currently, that's 6.3.0.

> Can you install MSYS2 and MinGW-W64
> somewhere just for build testing? It would be less frustrating.

Sorry, this is unlikely to happen.  Being a co-maintainer eats up all
of my free time, so entertaining yet another incompatible development
environment and keeping it in good shape is not something I can
afford.

I expect others who use MinGW64 to care enough to report and fix these
problems.

> At least some of the "-Wformat=" warnings are misleading.
> Emacs has to use MSVC's rules for format strings, but GCC
> warns based on the C standard rules implemented in GCC.

Actually, these are the most worrisome, because they seem to tell your
MinGW headers might mismatch your GCC version.  Or maybe this is a
general MinGW64 problem that should be solved by MinGW64 developers.
Consider this warning, which is quite typical, and is seen in your log
many times:

    CC       frame.o
  frame.c: In function 'make_terminal_frame':
  frame.c:1098:46: warning: unknown conversion type character 'l' in format 
[-Wformat=]
     fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
                                                ^~~~
  In file included from 
C:/msys64/mingw64/x86_64-w64-mingw32/include/inttypes.h:299:0,
                   from C:/projects/emacs/nt/inc/inttypes.h:24,
                   from lisp.h:31,
                   from frame.c:29:
  C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw_print_pop.h:77:19: note: 
format string is defined here
   #define PRIdMAX "lld"
                     ^
  frame.c:1098:46: warning: too many arguments for format [-Wformat-extra-args]
     fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
                                                ^~~~

How come the compiler doesn't recognize format specifiers defined on
the system headers?  And note that as result GCC ignores some
arguments of fset_name, which might mean it actually generates wrong
code for this function.

This should be taken up with MinGW64 developers ASAP, because I don't
see how we can fix this in Emacs.

Another class of similar warnings is like this:

    CC       keyboard.o
  keyboard.c: In function 'cmd_error':
  keyboard.c:957:23: warning: format '%d' expects argument of type 'int', but 
argument 3 has type 'EMACS_INT {aka long long int}' [-Wformat=]
    sprintf (macroerror, "After %"pI"d kbd macro iterations: ",
                         ^~~~~~~~~
  keyboard.c:957:35: note: format string is defined here
    sprintf (macroerror, "After %"pI"d kbd macro iterations: ",
                                ~~~~~^
                                %"pI"lld

You may think the compiler doesn't understand %lld, but it also
doesn't seem to understand the MS native %I64d:

  print.c: In function 'safe_debug_print':
  print.c:833:24: warning: unknown conversion type character 'I' in format 
[-Wformat=]
         fprintf (stderr, "#<%s_LISP_OBJECT 0x%08"pI"x>\r\n",
                          ^~~~~~~~~~~~~~~~~~~~~~~~
  In file included from print.c:25:0:
  lisp.h:98:16: note: format string is defined here
   #   define pI "I64"
                  ^

This leaves us in a conundrum, because I don't understand what printf
format spec will MinGW64 understand and process correctly when a
64-bit integral value has to be printed.

Another problem to be taken up with MinGW64 developers is this:

    CCLD     addpm.exe
  C:/projects/emacs/nt/addpm.c:42:0: warning: "_WIN32_WINNT" redefined
   #define _WIN32_WINNT _WIN32_WINNT_WIN7

  In file included from 
C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
                   from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:9,
                   from C:/projects/emacs/nt/addpm.c:37:
  C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:225:0: note: this is 
the location of the previous definition
   #define _WIN32_WINNT 0x502

These are all MinGW system headers, so it sounds like they contradict
one another?  Maybe there's something Emacs does to trigger this, but
what is that?

Anyway, I fixed some warnings, so you should see fewer of them.
Hopefully, I didn't introduce new warnings aor problems.  If/when the
MinGW64 folks (or someone here who is "in the know") tells how to
resolve the problems with printf and _WIN32_WINNT, we can fix the
rest.

There are few warnings which are not specific to MS-Windows; I will
describe them in a separate message.

Thanks.



reply via email to

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