From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Richard Copley Newsgroups: gmane.emacs.devel Subject: Re: Suspicious warning in W64 build Date: Sun, 10 Sep 2017 02:01:09 +0100 Message-ID: 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> <83377vx3d0.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1505005317 4336 195.159.176.226 (10 Sep 2017 01:01:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2017 01:01:57 +0000 (UTC) Cc: Angelo Graziosi , Emacs Development To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 10 03:01:50 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 1dqqdA-0000VK-NU for ged-emacs-devel@m.gmane.org; Sun, 10 Sep 2017 03:01:48 +0200 Original-Received: from localhost ([::1]:51325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqqdE-0007Hz-EI for ged-emacs-devel@m.gmane.org; Sat, 09 Sep 2017 21:01:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqqd8-0007Hm-5W for emacs-devel@gnu.org; Sat, 09 Sep 2017 21:01:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqqd6-0005jt-Iq for emacs-devel@gnu.org; Sat, 09 Sep 2017 21:01:46 -0400 Original-Received: from mail-vk0-x242.google.com ([2607:f8b0:400c:c05::242]:37963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqqd4-0005e5-8M; Sat, 09 Sep 2017 21:01:42 -0400 Original-Received: by mail-vk0-x242.google.com with SMTP id o22so1414737vke.5; Sat, 09 Sep 2017 18:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OH26eRauZHfXWtMu2YiRyys/QZNSsfeVqTGgPkApJ6k=; b=A+zXaWH8Etq0QFImTBq0bnTQSfYd4g1qrRCJCBUmwdjK3sBweFRa802Rw0G187qVZD 1x8yZZAOu8dnc2KnnKIc/4CWVXFL3wv1ZaxDqnLwJK0wNayH3l9nLUumAkuotHWYcYu3 UOhqcVpyTsg+yqU+XipAkYo1Iu2iLR7U3OVqywqlB6a8PYFvcCIWuVY8a/NfvEU61B4P hLUyoZUqkK3ggxCGOiEUgJ5u6abqh+rxrKuO+q8F/N2GAPcJvJvEp8HDdNNao2tMwwbc kpHIDIezKXfc8NM0FYD8vCNB3S1DripA60r8KedbBc1YoIhbCxRdFvHLQKAn1SpzLqs1 Hf1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=OH26eRauZHfXWtMu2YiRyys/QZNSsfeVqTGgPkApJ6k=; b=VVr5V04NoAVSE4llGinjnERf36RJbyQnNXclydghaxissyu2zo7LWOAwrR4QBofBKy 3HaoB4PCMYHY7nY+htOg18+hqyDntAi0K3pYceT7yXfiJ/pcT/GkiGt9IJLzbPcCbpi1 VuR18MpddhAXDuRgWrfK76EIKw0k2qOlJ/wnXcBD5e5kKdjMEhg6tpFZ2t+2pVtuEcaE MED/p1it67tL9Dlp1B2f1NGm3eSze29STaZa+pXnwpN7emaJBgzjpmkefaKfwLd4oVAX J2BnkaCh4T6lSuWjyyVQKBdjnsJIHZEZKVIUgCNXxZ5DXNJxbR0e4t2tDmZsz7lm9gD+ cfNQ== X-Gm-Message-State: AHPjjUgICRMdT2M+C6yqMmGyxKuJnTHYxWkVuowWT7eeYVGQXlGNPSil wl/fSFIJ7Ozmv1cs845hIyalrtGXhuC9 X-Google-Smtp-Source: AOwi7QD7TT+v8M4QSCHzz0eraP0Prnf/YRzDlYmPYhHN1H5CKQ8442eZyGsrsQm/w1ic2TrvLGfzdzHYgMS5nwOFdLM= X-Received: by 10.31.99.134 with SMTP id x128mr4947764vkb.87.1505005299869; Sat, 09 Sep 2017 18:01:39 -0700 (PDT) Original-Received: by 10.159.41.102 with HTTP; Sat, 9 Sep 2017 18:01:09 -0700 (PDT) In-Reply-To: <83377vx3d0.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c05::242 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:218083 Archived-At: On 9 September 2017 at 17:07, Eli Zaretskii wrote: >> 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. No sweat. > I expect others who use MinGW64 to care enough to report and fix these > problems. I care and I'm encouraged by your words. I will do what I can. >> 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. I don't disagree. My impression is that Alexey and co. at MinGW-W64 are well aware of it. I don't know if there's a solution in the pipeline. I'm not the best person to press the point there (but ask me one more time and I will try). > 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. Yep. Sucks. > 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? This is due to a local patch. I'm really very sorry to have distracted you with it, when you don't have the source. If you want, I will get you a transcript from the unpatched Emacs git master branch as I should have done in the first place. > 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. Thanks very much.