On 2023-12-02 01:04, Bruno Haible wrote:
> On the contrary, I will try to find and eliminate such alarms.
Please don't complicate and/or slow down shared Gnulib code just to
pacify this particular false alarm from Clang. The obstack fix was fine,
because it made obstack clearer and no slower. But we shouldn't have to
insert unnecessary "is the size zero?" checks merely to pacify the false
alarms.
I would suggest writing macros that encapsulate code like "NULL + 0" and replace the code with macro invocations. On legacy systems, the macro would expand into the legacy code; on modern systems where checks like "is this zero size?" should be eliminated by the compiler, the macro would expand into the correct ISO C code. This can also make the code more transparent as long as the macro has a self-describing name.
The right place to fix this problem is in Clang, not in Gnulib.
I don't think so. As long as Clang implements ISO C, it is not Clang's problem but a problem of code that produces UB (in the technical sense).
Just my two cents, of course.