From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: New Flymake rewrite in emacs-26 Date: Wed, 11 Oct 2017 13:01:41 +0100 Message-ID: <87y3oh7v16.fsf@gmail.com> 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> <831smaoubw.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1507723329 17343 195.159.176.226 (11 Oct 2017 12:02:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 11 Oct 2017 12:02:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) Cc: npostavs@users.sourceforge.net, lele@metapensiero.it, emacs-devel@gnu.org, mvoteiza@udel.edu, monnier@iro.umontreal.ca, sdl.web@gmail.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 11 14:02:01 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 1e2Fi4-0003KI-1b for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 14:02:00 +0200 Original-Received: from localhost ([::1]:40715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2Fi9-0007Dp-Sj for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 08:02:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2Fhy-0007DZ-KM for emacs-devel@gnu.org; Wed, 11 Oct 2017 08:02:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2Fhs-00078W-D6 for emacs-devel@gnu.org; Wed, 11 Oct 2017 08:01:54 -0400 Original-Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:49362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2Fhs-00076a-2s; Wed, 11 Oct 2017 08:01:48 -0400 Original-Received: by mail-wm0-x230.google.com with SMTP id b189so3991316wmd.4; Wed, 11 Oct 2017 05:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=t6kC4g9u15m6fEBKHWx8RwlCaarLBM9qquNJ2huL01I=; b=kJhgp5BMSpiECsiuzcMM0hnJPrth89vUKnx552n4fgveP3sS57iz+A2T0enDwYG1oc 6jG1svWXhqq5WtQMx6K5YpFcFT86fpxM9SzJ23x6y6vcJyG6tCkrY/YjS+se2qJY4pXd ILjI2pX7mZgnhCQDhyJXG6ioHMDZEOXpa5bMFl4ozMQ8rZCfUMFadTaicL/F8zIWwEkI g+qPp7hWTPYIMkZ7mToFh4o7HU0saTzhwpr2iHLbjRi2S3OIpBGwI4rFzCoXAz1fXGTz t0QzVq4GAu2yq806no5F0CpCgs4VQdgGJTkdBbgZwPAUtQVDFDO0n92RCMgLBLPx4JYb dXJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=t6kC4g9u15m6fEBKHWx8RwlCaarLBM9qquNJ2huL01I=; b=Xys+DYsTZft+SDHoxYVmyUOR4Gr3Sw1HdtmgIxCvW1t8X4Z5ndpaGpjNmU3CHs8IgO kZKnRfh0epL4qu2CDE8M5LNcuZDNySVdLLyMq/pA4COojThljM+/OKbIO2kyvvnvwWlF 9RUGaRQCvkc6RcNRkDo89FrKTBEgVVg85eaU9P3cMmbWwjtV7bQ370/e1clqHumNWQ1C lNrCXyT+4/xEiUzHYqw5GxoIAcU81K/NOXh1UdPLT1tKRg2IUIKTmSIAR6COP+51myZe WT6dxPVTTg82UkYPS6TicyaUTcgZ+R12kjsrYGE84mgqnr6U3PwppZMEPGHlK+ALRAsD z2fA== X-Gm-Message-State: AMCzsaUWx5BIIdQXaSr9y16DGx/nTEds5as3Knh784tWMLRfhSo/+eAJ tHaaa45t5lDrWxx9zF4Sqlc= X-Google-Smtp-Source: AOwi7QAzVkHKGcDgXR+j3MTlYcJmEcFTwAhwo/xJWfuUVYX7Ydmhkx6XsS7BjNacyj08AkzMPVE06w== X-Received: by 10.223.139.12 with SMTP id n12mr14413117wra.223.1507723306823; Wed, 11 Oct 2017 05:01:46 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id p38sm16647275wrb.41.2017.10.11.05.01.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Oct 2017 05:01:45 -0700 (PDT) In-Reply-To: <831smaoubw.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 Oct 2017 13:24:51 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::230 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:219370 Archived-At: Eli Zaretskii writes: >> From: joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) >> Cc: Eli Zaretskii , Mark Oteiza , Lel= e Gaifax , Leo Liu , Stefan Monn= ier , Emacs developers >> Date: Wed, 11 Oct 2017 01:07:19 +0100 >>=20 >> 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=E2=80=99s probably decent in a fair amount of cases, = and I=E2=80=99m >> 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. >>=20 >> First, my idea is to cache the result of these flags contingent on the >> Makefile=E2=80=99s location and mtime. This, I think, is doable. Then I = use a >> regexp to extract the gcc invocation from the output. >>=20 >> The regexp is very poor but does the job. For the src/fringe.c file the >> regexp is >>=20 >> "gcc[[:space:]]+\\(\\(?:-.*\\)*\\)/path/to/fringe.c" >>=20 >> This indeed matches Make=E2=80=99s output and gets me something like thi= s for >> the match group 1 >>=20 >> -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 -isys= tem >> /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 >>=20 >> Unfortunately, not all flags make sense for flymake, like the -M family >> of flags. Ideally, i=E2=80=99d need a way to parse this big string of fl= ags back >> into, say, an alist, and cherry pick the -I, -D, and -W flags from that >> set. But I=E2=80=99m afraid split-string will insufficiently deal with e= scaped >> spaces in the output. >>=20 >> Any ideas? > > We are talking about a solution specific to Emacs, right? No, I was aiming for something more generic that includes at least Emacs and perhaps otherGNU projects. But I have no problem in making it work just for Emacs first. > If so, and assuming that Flymake is already capable of parsing a > Makefile, It is not. The only thing it currently knows about Makefiles is what it has known for many versions, which is to invoke their "check-syntax" target with a special environment variable set to to a specific temporary file which contains the buffer's contents. This invocation is expected to compile files with the correct flags and produce errors and warnings in the standard output. > 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. If we are going to make it specific to Emacs, this sounds more complicated than adding a "check-syntax" target to the Makefile, which would bring the (minor) benefit that people using emacs < 26.1 could also use older Flymake to edit Emacs sources. Jo=C3=A3o