Subject: bug#78250: 31.0.50; Eglot: eglot-show-call-hierarchy

From: Gerd Möllmann <[email-masked]>
Date: Fri, 09 May 2025 10:38:24 +0200

João Távora <[email-masked]> writes:

> Gerd Möllmann <[email-masked]> writes:
>
>> João Távora <[email-masked]> writes:
>>
>>> diff --git a/.clangd b/.clangd
>>> index 469d33dfd03..5c7308d64ae 100644
>>> --- a/.clangd
>>> +++ b/.clangd
>>> @@ -2,4 +2,5 @@
>>>  If:
>>>      PathMatch: "src/*.c"
>>>  CompileFlags:
>>> -    Add: [-Wno-unused-macros, -include=config.h]
>>> +    Add: [-Wno-unused-macros, -include=config.h, -fstrict-flex-arrays=3]
>>> +    Remove: [-fstrict-flex-arrays]
>>
>> Hm, is there something wrong with the flexible array members in Emacs?
>
> No reason to think so, but I get a "unknown flag -fstrict-flex-arrays"
> diagnostic from clangd (both versions 19 and 21git), which I presume
> comes from that flag being mentioned in compile_commands.json but not
> understood by the clang compiler that lives in clangd.  These are
> relatively common in projects with very specific flags.  The patch above
> fixes the situation while also telling clangd that we are using strict
> flex arrays (in case that influences its analysis).
>
> If you don't get that diagonstic, perhaps you're using a hand-rolled
> compile_commands.json.  I used simply `bear -- make` to create mine
> after deleting src/*.o.

I don't have that flag in compile-commands.json, but maybe the
difference is that I also build with clang (macOS/arm64). The
compilation database is also from bear -- gmake.