unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Richard Copley <rcopley@gmail.com>
Cc: angelo.g0@libero.it, emacs-devel@gnu.org
Subject: Re: Suspicious warning in W64 build
Date: Sat, 09 Sep 2017 19:07:23 +0300	[thread overview]
Message-ID: <83377vx3d0.fsf@gnu.org> (raw)
In-Reply-To: <CAPM58oisvOXcYH7sUTqpAxCwcM-j+qSHQVt=JgFLRUcpUm-xLg@mail.gmail.com> (message from Richard Copley on Sat, 9 Sep 2017 12:17:14 +0100)

> From: Richard Copley <rcopley@gmail.com>
> Date: Sat, 9 Sep 2017 12:17:14 +0100
> Cc: Angelo Graziosi <angelo.g0@libero.it>, Emacs Development <emacs-devel@gnu.org>
> 
> > 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	other threads:[~2017-09-09 16:07 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 13:38 Suspicious warning in W64 build Angelo Graziosi
2017-09-05 14:04 ` Richard Copley
2017-09-07 15:16 ` Eli Zaretskii
2017-09-07 15:42   ` Angelo Graziosi
2017-09-07 17:52     ` Richard Copley
2017-09-07 17:58       ` Richard Copley
2017-09-07 19:00         ` Angelo Graziosi
2017-09-07 19:21           ` Richard Copley
2017-09-09  4:58             ` Herring, Davis
2017-09-09  9:55               ` Richard Copley
2017-09-09 10:20                 ` Eli Zaretskii
2017-09-09 11:24                   ` Angelo Graziosi
2017-09-09 13:25                     ` Eli Zaretskii
2017-09-09 11:16                 ` Angelo Graziosi
2017-09-07 18:58       ` Eli Zaretskii
2017-09-07 19:26         ` Paul Eggert
2017-09-07 19:50           ` Richard Copley
2017-09-07 20:02             ` Richard Copley
2017-09-08  6:49               ` Eli Zaretskii
2017-09-08  8:02                 ` Eli Zaretskii
2017-09-08 19:31                   ` Richard Copley
2017-09-08 20:17                     ` Eli Zaretskii
2017-09-08 21:08                       ` Richard Copley
2017-09-08 21:37                         ` Richard Copley
2017-09-09  7:37                           ` Eli Zaretskii
2017-09-08 22:20                         ` Richard Copley
2017-09-09  7:33                         ` Eli Zaretskii
2017-09-09  9:36                           ` Richard Copley
2017-09-09 10:42                             ` Eli Zaretskii
2017-09-09 10:52                               ` Eli Zaretskii
2017-09-09 11:17                               ` Richard Copley
2017-09-09 16:07                                 ` Eli Zaretskii [this message]
2017-09-10  1:01                                   ` Richard Copley
2017-09-10 14:40                                     ` Eli Zaretskii
2017-09-10 19:14                                       ` Richard Copley
2017-09-10 19:38                                         ` Angelo Graziosi
2017-09-11 16:17                                           ` Eli Zaretskii
2017-09-11 22:21                                             ` Angelo Graziosi
2017-09-11 16:39                                           ` Óscar Fuentes
2017-09-11 17:20                                             ` Eli Zaretskii
2017-09-12 17:49                                   ` Eli Zaretskii
2017-09-12 18:01                                     ` Fabrice Popineau
2017-09-12 18:37                                       ` Richard Copley
2017-09-12 18:59                                         ` Eli Zaretskii
2017-09-12 19:14                                           ` Richard Copley
2017-09-12 18:38                                       ` Eli Zaretskii
2017-09-14 17:47                                         ` Eli Zaretskii
2017-09-14 19:34                                           ` Richard Copley
2017-09-15  8:54                                             ` Eli Zaretskii
2017-09-15 23:05                                               ` Richard Copley
2017-09-16  6:40                                                 ` Eli Zaretskii
2017-09-16  8:19                                                   ` Richard Copley
2017-09-16  8:34                                                     ` Richard Copley
2017-09-16  8:54                                                       ` Eli Zaretskii
2017-09-16  9:07                                                         ` Richard Copley
2017-09-16 11:54                                                           ` Fabrice Popineau
2017-09-16  8:52                                                     ` Eli Zaretskii
2017-09-15  8:59                                             ` Eli Zaretskii
2017-09-15 14:43                                               ` Eli Zaretskii
2017-09-17  6:42                                                 ` Paul Eggert
2017-09-17  7:14                                                   ` Richard Copley
2017-09-17 14:31                                                     ` Eli Zaretskii
2017-09-17  6:40                                               ` Paul Eggert
2017-09-17 14:29                                                 ` Eli Zaretskii
2017-09-17 16:39                                                   ` Fabrice Popineau
2017-09-17 16:52                                                     ` Eli Zaretskii
2017-09-18  0:26                                                   ` Paul Eggert
2017-09-18 11:47                                                     ` Fabrice Popineau
2017-09-18 14:46                                                       ` Eli Zaretskii
2017-09-18  0:01                                                 ` Richard Stallman
2017-09-14 19:36                                           ` Fabrice Popineau
2017-09-14 21:17                                           ` Andy Moreton
2017-09-15  6:55                                             ` Fabrice Popineau
2017-09-15  9:12                                               ` Eli Zaretskii
2017-09-15 15:33                                                 ` Fabrice Popineau
2017-09-15 15:45                                                   ` Eli Zaretskii
2017-09-15 18:15                                                     ` Fabrice Popineau
2017-09-15 19:00                                                       ` Eli Zaretskii
2017-09-15 21:02                                                         ` Fabrice Popineau
2017-09-16  7:45                                                           ` Eli Zaretskii
2017-09-17  7:01                                                             ` Paul Eggert
2017-09-17 14:31                                                               ` Eli Zaretskii
2017-09-17 14:52                                                                 ` Philipp Stephani
2017-09-17 22:34                                                                   ` Paul Eggert
2017-09-17 17:07                                                                 ` Paul Eggert
2017-09-17 17:14                                                                   ` Eli Zaretskii
2017-09-17 18:53                                                                     ` Paul Eggert
2017-09-17 19:30                                                                       ` Eli Zaretskii
2017-09-17 20:34                                                                         ` Paul Eggert
2017-09-18  2:30                                                                           ` Eli Zaretskii
2017-09-18  4:52                                                                             ` Paul Eggert
2017-09-18 14:41                                                                               ` Eli Zaretskii
2017-09-18 17:35                                                                                 ` Paul Eggert
2017-09-18 17:58                                                                                   ` Andy Moreton
2017-09-19  9:05                                                                                     ` Paul Eggert
2017-09-18 18:01                                                                                   ` Eli Zaretskii
2017-09-17 20:45                                                   ` Paul Eggert
2017-09-16 13:17                                                 ` Andy Moreton
2017-09-16 13:46                                                   ` Eli Zaretskii
2017-09-16 18:57                                                     ` Richard Copley
2017-09-16 19:21                                                       ` Eli Zaretskii
2017-09-15  9:03                                             ` Eli Zaretskii
2017-09-09  8:49                       ` Angelo Graziosi
2017-09-09 10:37                         ` Eli Zaretskii
2017-09-09 11:32                           ` Angelo Graziosi
2017-09-09 13:28                             ` Eli Zaretskii
2017-09-09 13:33                               ` Fabrice Popineau
2017-09-09 14:55                               ` Angelo Graziosi
2017-09-09 16:37                                 ` Eli Zaretskii
2017-09-09 18:38                                   ` Angelo Graziosi
2017-09-09 18:59                                     ` Eli Zaretskii
2017-09-09 21:29                                       ` Angelo Graziosi
2017-09-10 14:56                                         ` Eli Zaretskii
2017-09-10 15:45                                           ` Angelo Graziosi
2017-09-10 16:02                                             ` Eli Zaretskii
2017-09-10 18:45                                               ` Angelo Graziosi
2017-09-10 19:43                                                 ` Eli Zaretskii
2017-09-09 15:40                           ` Angelo Graziosi
2017-09-09 16:40                             ` Eli Zaretskii
2017-09-09 18:33                               ` Fabrice Popineau
2017-09-07 20:20           ` Eli Zaretskii
2017-09-07 21:59             ` Angelo Graziosi
2017-09-08  8:01               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83377vx3d0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=angelo.g0@libero.it \
    --cc=emacs-devel@gnu.org \
    --cc=rcopley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).