Re: [PATCH] sparse: ignore warning from new glibc headers
From: Junio C Hamano <hidden>
Date: 2024-07-18 07:07:56
Đoàn Trần Công Danh [off-list ref] writes:
quoted
BTW, I didn't expect it to take this long for this issue to come back to the list! I expected it to almost immediately cause problems with the sparse ci job, when the version of Ubuntu was updated to the LTS (now previous LTS!). So, I just found a simple solution for now (which turned into 2 years).Well, yeah, -Wno-vla would work, I used that macro __STDC_NO_VLA__ because I'm not sure Git want to use vla or not, so I only tried to disable it for system headers.
Defining __STDC_NO_VLA__ would rid use of variable length arrays in the regex.h header, so "-Wno-vla" would not be necessary. It's just that it makes me feel a bit dirty to define the macro that only compiler implementations are expected to define in order to cause header files behave the way they would with a compiler without VLA. If we apply Luc's patch [*1*] to sparse, the header would use vla in parameter in the prototype, sparse would grok it, *and* then complain that we are using vla, so we still need "-Wno-vla" on top (but "-Wno-vla" alone would not make (unpatched) sparse grok the construct, of course).
And yes, the vla declarationw as added into glibc 2.35.
Thanks. [Reference] *1* https://lore.kernel.org/all/uug4xslokvlxr6z24q52z4pt7nrtiimbzunz2gz3kpilk4kxts@7jljsksi6baq/