[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Flymake support for C/C++

From: guillaume papin
Subject: Re: [PATCH] Flymake support for C/C++
Date: Sat, 14 Oct 2017 10:56:10 +0000

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 mode, Make can do some work.

On a side note, at some point earlier they changed the --dry-run flag 
(equivalent to --just-print) by -n,
because the latter is POSIX compliant, working with more make 

To answer your questions, which weren't addressed to me but I will share what I 

> 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 
      User option: The executable of the c/c++-gcc syntax checker.
      User option: A list of additional command line arguments.
      User option: Additional preprocessor definitions for GCC.
      User option: A list of include directories for GCC.
      User option: A list of additional include files for GCC.
      User option: The language standard to use in GCC.
      User option: Whether to disable exceptions in GCC.
      User option: Whether to disable RTTI in GCC.
      User option: Whether to enable OpenMP in GCC.
      User option: Whether to warn about language extensions in GCC.
      User option: Whether to error on language extensions in GCC.
      User option: A list of additional warnings to enable in GCC.

M-x customize-variable RET flycheck-gcc-args RET can be sufficient, the other 
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 futur: 
disassembler plugin, company mode, GCC fix-it hints[6] integration, 

Then there is flycheck extension, like one I maintain (irony-mode) and others,
such as cmake-ide and ede-compdb, that uses the compilation database I 
mentioned 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 of 
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 
practical here.

[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 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]