emacs-devel
[Top][All Lists]
Advanced

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

Re: A note about clang-format


From: Gerd Möllmann
Subject: Re: A note about clang-format
Date: Wed, 23 Aug 2023 07:58:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

João Távora <joaotavora@gmail.com> writes:

> On Tue, Aug 22, 2023, 20:45 Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
>  > I think we (meaning you) should lobby Eli for compile_commands.json
>  > generation first :)
>
>  I think that might not even be necessary because users can do that
>  easily, if they know how.  See https://github.com/rizsotto/Bear, for
>  example, which is GPLv3.  With it, do an initial full build with "bear
>  -- gmake" instead of just "gmake".
>
> Yes, I've used 'bear' before (in fact I asked you, remember?).

Sorry, I didn't remember that that was you :-).

>
> But -- great as it is -- it's still basically a hack which requires
> actually compiling the code to learn _how_ it would be
> compiled. That's not always practical, perhaps not even always
> possible depending on the toolchain to use.

Some alternatives to Bear use a --dry-run.  I haven't tried them though:
https://github.com/nickdiego/compiledb for example.  Would that be
sufficient for the cases you think of?

> So it's a needless hindrance and, afair, not perfectly accurate (you
> had some non-trivial ad-hoc tweak script as I recall).

Yes, the script adds an "-include config.h" for the files in src/.  That
makes things a little bit smoother with clangd.  One can do without,
though.

> I don't see a fundamental technical reason not to generate this simple
> file from our own configuration script, which is the source of truth
> for this information after all.  In all Cmake projects I work with,
> it's a matter of setting a simple variable. I wonder if the automake
> world doesn't have something similar. If it doesn't, how hard can it
> be to add one?

AFAIK, there is nothing like that in autoconf/automake.  At least last
time I checked about a year ago there wasn't.  I also have a vague
memory that someone on their mailing list said it it would be
impoossible to produce a correct compilation database without running
make, because one could alwasys do something like "CFLAGS=... make".
Can't find that article ATM, maybe I'm confusing that with something
else.



reply via email to

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