From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Suspicious warning in W64 build Date: Sat, 09 Sep 2017 19:07:23 +0300 Message-ID: <83377vx3d0.fsf@gnu.org> References: <1017454172.910810.1504618695244@mail.libero.it> <83tw0ezgi1.fsf@gnu.org> <1146932094.13821.1504798935795@mail.libero.it> <83mv66z66p.fsf@gnu.org> <102a4c21-c275-c73e-ec53-0d85975dc968@cs.ucla.edu> <83a825znuf.fsf@gnu.org> <831snhzkgw.fsf@gnu.org> <837ex9x7vf.fsf@gnu.org> <83tw0cwcle.fsf@gnu.org> <83h8wcw3td.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1504973289 8478 195.159.176.226 (9 Sep 2017 16:08:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Sep 2017 16:08:09 +0000 (UTC) Cc: angelo.g0@libero.it, emacs-devel@gnu.org To: Richard Copley Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 09 18:08:04 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqiIY-0001e4-Oy for ged-emacs-devel@m.gmane.org; Sat, 09 Sep 2017 18:07:58 +0200 Original-Received: from localhost ([::1]:50166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqiIg-0001CY-0B for ged-emacs-devel@m.gmane.org; Sat, 09 Sep 2017 12:08:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqiI3-0001CE-Fs for emacs-devel@gnu.org; Sat, 09 Sep 2017 12:07:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqiHz-0006b6-Fw for emacs-devel@gnu.org; Sat, 09 Sep 2017 12:07:27 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqiHz-0006au-CK; Sat, 09 Sep 2017 12:07:23 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1635 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dqiHy-0000bh-4G; Sat, 09 Sep 2017 12:07:23 -0400 In-reply-to: (message from Richard Copley on Sat, 9 Sep 2017 12:17:14 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:218068 Archived-At: > From: Richard Copley > Date: Sat, 9 Sep 2017 12:17:14 +0100 > Cc: Angelo Graziosi , Emacs Development > > > 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.