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: New Flymake rewrite in emacs-26 Date: Wed, 11 Oct 2017 13:24:51 +0300 Message-ID: <831smaoubw.fsf@gnu.org> References: <8760bwz5qf.fsf@gmail.com> <83infw1dkz.fsf@gnu.org> <87efqbb35x.fsf@gmail.com> <831smbqe70.fsf@gnu.org> <87tvz79h0s.fsf@gmail.com> <83wp43ov7s.fsf@gnu.org> <87bmlf9dh3.fsf@gmail.com> <83tvz7ot1o.fsf@gnu.org> <87y3oj7x60.fsf@gmail.com> <87a80y8s3s.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1507717526 13563 195.159.176.226 (11 Oct 2017 10:25:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 11 Oct 2017 10:25:26 +0000 (UTC) Cc: npostavs@users.sourceforge.net, lele@metapensiero.it, emacs-devel@gnu.org, mvoteiza@udel.edu, monnier@iro.umontreal.ca, sdl.web@gmail.com To: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 11 12:25:19 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 1e2ECR-0002G3-Mv for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 12:25:15 +0200 Original-Received: from localhost ([::1]:40055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2ECX-0001y9-IB for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 06:25:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2ECN-0001wO-9L for emacs-devel@gnu.org; Wed, 11 Oct 2017 06:25:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2ECJ-0003aj-1w for emacs-devel@gnu.org; Wed, 11 Oct 2017 06:25:11 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2ECI-0003aN-Uo; Wed, 11 Oct 2017 06:25:06 -0400 Original-Received: from [176.228.60.248] (port=4269 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e2ECH-0007ZS-HN; Wed, 11 Oct 2017 06:25:06 -0400 In-reply-to: <87a80y8s3s.fsf@gmail.com> (joaotavora@gmail.com) 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:219367 Archived-At: > From: joaotavora@gmail.com (João Távora) > Cc: Eli Zaretskii , Mark Oteiza , Lele Gaifax , Leo Liu , Stefan Monnier , Emacs developers > Date: Wed, 11 Oct 2017 01:07:19 +0100 > > Thanks for the idea. Certainly not nonsense, but also not a silver > bullet, since Makefiles can invoke gcc in arbitrary ways that fool a > guesser. Still, it’s probably decent in a fair amount of cases, and I’m > giving it a go to see if it works with Emacs sources and perhaps some > other GNU projects. I attach my flag-guessing function at the end. > > First, my idea is to cache the result of these flags contingent on the > Makefile’s location and mtime. This, I think, is doable. Then I use a > regexp to extract the gcc invocation from the output. > > The regexp is very poor but does the job. For the src/fringe.c file the > regexp is > > "gcc[[:space:]]+\\(\\(?:-.*\\)*\\)/path/to/fringe.c" > > This indeed matches Make’s output and gets me something like this for > the match group 1 > > -c -Demacs -I. -I. -I../lib -I../lib -isystem /usr/include/freetype2 > -isystem /usr/include/alsa -pthread -isystem /usr/include/librsvg-2.0 > -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/libpng16 > -isystem /usr/include/cairo -isystem /usr/include/glib-2.0 -isystem > /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem > /usr/include/pixman-1 -isystem /usr/include/freetype2 -isystem > /usr/include/libpng16 -isystem /usr/include/libpng16 -isystem > /usr/include/libxml2 -isystem /usr/include/dbus-1.0 -isystem > /usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread -isystem > /usr/include/glib-2.0 -isystem > /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem > /usr/include/glib-2.0 -isystem > /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem > /usr/include/freetype2 -isystem /usr/include/freetype2 -isystem > /usr/include/freetype2 -MMD -MF > deps//home/capitaomorte/Source/Emacs/emacs-26/src/fringe.d -MP -isystem > /usr/include/p11-kit-1 -fno-common -W -Wabi -Waddress > [... elided many many -W flags] > -Wno-type-limits -Wno-unused-parameter -Wno-format-nonliteral -g3 -O2 > > Unfortunately, not all flags make sense for flymake, like the -M family > of flags. Ideally, i’d need a way to parse this big string of flags back > into, say, an alist, and cherry pick the -I, -D, and -W flags from that > set. But I’m afraid split-string will insufficiently deal with escaped > spaces in the output. > > Any ideas? We are talking about a solution specific to Emacs, right? If so, and assuming that Flymake is already capable of parsing a Makefile, we could simply have somewhere the list of *FLAGS variables from the Emacs Makefile that Flymake needs to use. That list will not include DEPFLAGS, for example,, which you say make no sense for Flymake. Then Flymake could pick up the expanded value of each of these variables, and concatenate them.