From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: guillaume papin Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Flymake support for C/C++ Date: Sat, 14 Oct 2017 10:56:10 +0000 Message-ID: References: <87zi8wmmhw.fsf@gmail.com> , <874lr2kr9r.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1507978636 29324 195.159.176.226 (14 Oct 2017 10:57:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 14 Oct 2017 10:57:16 +0000 (UTC) Cc: Richard Stallman , Noam Postavsky , Sami Kerola , "emacs-devel@gnu.org" , Stefan Monnier , Alan Mackenzie , Eli Zaretskii , "sdl.web@gmail.com" To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= , Reuben Thomas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 14 12:57:11 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 1e3K7u-0006OJ-Nk for ged-emacs-devel@m.gmane.org; Sat, 14 Oct 2017 12:57:06 +0200 Original-Received: from localhost ([::1]:53557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3K82-0006zx-5o for ged-emacs-devel@m.gmane.org; Sat, 14 Oct 2017 06:57:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3K7C-0006zc-VV for emacs-devel@gnu.org; Sat, 14 Oct 2017 06:56:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3K7B-0003oa-Uv for emacs-devel@gnu.org; Sat, 14 Oct 2017 06:56:23 -0400 Original-Received: from mail-eopbgr00107.outbound.protection.outlook.com ([40.107.0.107]:40703 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e3K76-0003lv-MM; Sat, 14 Oct 2017 06:56:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epitechfr.onmicrosoft.com; s=selector1-epitech-eu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=he+ejXTtNuHsxzQIA4MsfOzJhRuScUqvYi52AlkcKek=; b=fqRKS/LCtLQePFRQmyMuZdDyRBqpKfgA9FB/vkly+kZNj97EM/uu3sWi+mGKzPm0t+tgbvLQ2TuM52fHMNty0je7phFrjRvMjyeVX4goKJYiIf19dHs7js1io4LsaglapnF0mvLOMswpLnlJZAnw5IS/Izmvhabia9YG9BfqXlY= Original-Received: from HE1PR02MB1195.eurprd02.prod.outlook.com (10.163.173.153) by HE1PR02MB1196.eurprd02.prod.outlook.com (10.163.173.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sat, 14 Oct 2017 10:56:11 +0000 Original-Received: from HE1PR02MB1195.eurprd02.prod.outlook.com ([fe80::74fa:43af:e662:826a]) by HE1PR02MB1195.eurprd02.prod.outlook.com ([fe80::74fa:43af:e662:826a%13]) with mapi id 15.20.0077.022; Sat, 14 Oct 2017 10:56:11 +0000 Thread-Topic: [PATCH] Flymake support for C/C++ Thread-Index: AQHTQ2wptZtCy0L2wE6NSSImkuE0VaLikonkgABduACAACgIYoAACrl9 In-Reply-To: <874lr2kr9r.fsf@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=guillaume.papin@epitech.eu; x-originating-ip: [85.68.71.246] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR02MB1196; 6:YzHcpGm2LIaU4YzBjD8AmLkRITuMrKvoCuHIBIs+0bGWZBWd+kLbIx7nZnr8VJ3uARzC7gGnSFeXSLlq0lFpV6zf1r3KIoXUWWJ011p5rWQjr0lhmsEQEzvO86sVDZCr8iu18XGHnF+pdA8Wh2lmbkxmZ/XoLFtgQ6fynRIHXuk04wzkuz/z1ZbDcNdsYfTgei6YEWQJkoiqpAE/pNcqEtuxIaGTjj11P7vSQcy+GItnFu+L8Vi8QGZFAAXLm2inzJ4Em7vh9xW21Z+moq5poQEjzahnrfdl+RGhlUtkdlhcy4jnfjNgUnCITcBpKUkH7aXbrLe45iS8GeGk2vlbEw==; 5:/VspUu/FNuKNbtap3nDYY1BW+2QNUEXdUvHQEUiXXqhvh1ijGkztn/5MFmSM76H72+dHKGlwkkX+txUgfXw8cyaPhP1QFqhb74npAuGP/dbyBsDaMd44Hdi2k9mZZ1pLvDaW3fmR6l4xKZQ8bNLzwg==; 24:sTigpYm/NOPlgoK47DGSUVQkZlRAkg5mXW3eirsEwBcxGSzsCCTo+GNmYHT0TMdBJ5+xUy/Nk86HOLtDxLHJJMcz5pXKwoioIT1NQkYR4qc=; 7:R/OvSXAdYu1/Pr8N5I3j9855BKNhAVZwMIJjYVO7LsXR0KF1eOvMSCFLSn462iymckXr/SxkWfWxvYpvMPj9gpZ+tSl9Ichi8CommZKD3qj+UFMjq07oN3+xl9VVF+BwCvSdNdhLCWEw0M/ApVm2dCTjHZd3FexJfGD1bUMhdazFcKPFSCKH76QpW/o6VXzdGHX/sGtmyYAMLDMBUHsk16A25gx41SlLT x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: f1ae4880-5dc4-437f-35de-08d512f22e65 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:HE1PR02MB1196; x-ms-traffictypediagnostic: HE1PR02MB1196: x-exchange-antispam-report-test: UriScan:(226959686518644)(22074186197030)(166708455590820)(192374486261705)(183786458502308); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123558100)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR02MB1196; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR02MB1196; x-forefront-prvs: 046060344D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(376002)(199003)(189002)(8676002)(7416002)(101416001)(54356999)(76176999)(3280700002)(81166006)(81156014)(74316002)(14454004)(189998001)(2900100001)(33656002)(97736004)(2950100002)(74482002)(5660300001)(66066001)(5250100002)(68736007)(3660700001)(305945005)(229853002)(105586002)(7696004)(7736002)(50986999)(106356001)(6436002)(6506006)(4326008)(6246003)(3846002)(6116002)(102836003)(93886005)(6306002)(39060400002)(86362001)(575784001)(8936002)(99286003)(86152003)(110136005)(25786009)(2906002)(966005)(55016002)(9686003)(54906003)(786003)(316002)(478600001)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR02MB1196; H:HE1PR02MB1195.eurprd02.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: epitech.eu does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-OriginatorOrg: epitech.eu X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2017 10:56:10.8813 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 901cb4ca-b862-4029-9306-e5cd0f6d9f86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB1196 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.107 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:219503 Archived-At: flycheck used to invoke Make, at least for checking Makefiles. However they removed this feature[1], after user complained about the security implication of invoking Make[2] [3= ]. The issue being that even in --just-print=A0mode, Make can do some work. On a side note, at some point earlier they changed the --dry-run flag (equi= valent to --just-print) by -n, because the latter is POSIX compliant, working with more make implementatio= ns[4]. To answer your questions, which weren't addressed to me but I will share wh= at I know: > In the context of this specific subthread, can you tell us if Flycheck > automatically infers the compilation flags of, say, GNU Emacs and GNU > Hello when checking C code? Does it do so for any other project? Out-of-the-box, Flycheck does not seem to infer the flags for GNU Hello. For example I have the following error when I open src/hello.c: error config.h: No such file or directory (c/c++-gcc) There are options to configure flycheck with the following customization va= riables: flycheck-c/c++-gcc-executable User option: The executable of the c/c++-gcc syntax checker. flycheck-gcc-args User option: A list of additional command line arguments. flycheck-gcc-definitions User option: Additional preprocessor definitions for GCC. flycheck-gcc-include-path User option: A list of include directories for GCC. flycheck-gcc-includes User option: A list of additional include files for GCC. flycheck-gcc-language-standard User option: The language standard to use in GCC. flycheck-gcc-no-exceptions User option: Whether to disable exceptions in GCC. flycheck-gcc-no-rtti User option: Whether to disable RTTI in GCC. flycheck-gcc-openmp User option: Whether to enable OpenMP in GCC. flycheck-gcc-pedantic User option: Whether to warn about language extensions in GCC. flycheck-gcc-pedantic-errors User option: Whether to error on language extensions in GCC. flycheck-gcc-warnings User option: A list of additional warnings to enable in GCC. M-x customize-variable RET flycheck-gcc-args RET can be sufficient, the oth= er options preceded this generic option. However settings the option per file manually does not really scale IMHO. Also, many other features would benefit from knowing these compile options,= for example ff-find-other-file, c-macro-expand, and maybe more in the futu= r: disassembler plugin, company mode, GCC fix-it hints[6] integration,=20 Then there is flycheck extension, like one I maintain (irony-mode) and othe= rs, such as cmake-ide and ede-compdb, that uses the compilation database I ment= ioned earlier[5]. For example ede-compdb works for both flymake and flycheck: - https://github.com/randomphrase/ede-compdb#flymake-support I'm not sure that the best solution is for flymake to invent it's own way o= f getting the compile options. IMHO it would be best if it only provided a way to customize them, letting the burden of how to do it to "something else", but I may not be pr= actical here. [1] https://github.com/flycheck/flycheck/blob/cfe02c0b2f0ad09ff0555583b5cf4= 3125f549108/CHANGES.old#L129 [2] https://github.com/flycheck/flycheck/issues/572 [3] https://github.com/flycheck/flycheck/issues/573 [4] https://github.com/flycheck/flycheck/issues/322 [5] https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00398.html [6] GCC -fdiagnostics-parseable-fixits option, from https://gcc.gnu.org/onl= inedocs/gcc/Diagnostic-Message-Formatting-Options.html=