From: Junio C Hamano <gitster@pobox.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] sparse: ignore warning from new glibc headers
Date: Wed, 17 Jul 2024 11:51:23 -0700 [thread overview]
Message-ID: <xmqqr0br26ok.fsf@gitster.g> (raw)
In-Reply-To: <9bdac465-5f43-42de-9cad-e6c43a5a53cc@ramsayjones.plus.com> (Ramsay Jones's message of "Wed, 17 Jul 2024 19:40:35 +0100")
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> On 17/07/2024 17:54, Junio C Hamano wrote:
>> Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
>>
>>> With at least glibc 2.39, glibc provides a function declaration that
>>> matches with this POSIX interface:
>>>
>>> int regexec(const regex_t *restrict preg, const char *restrict string,
>>> size_t nmatch, regmatch_t pmatch[restrict], int eflags);
>>>
>>> such prototype requires variable-length-array for `pmatch'.
>>> ...
>>> Thus, sparse reports this error:
>>>
>>>> ../add-patch.c: note: in included file (through ../git-compat-util.h):
>>>> /usr/include/regex.h:682:41: error: undefined identifier '__nmatch'
>>>> /usr/include/regex.h:682:41: error: bad constant expression type
>>>> /usr/include/regex.h:682:41: error: Variable length array is used.
>
> Yes, I noted this about 2 years ago! If memory serves, it was when the
> libc6-dev package went from v2.31 to 2.35 (well 2.31-0ubuntu9.9).
Yes, our mails crossed. I was just writing to linux-sparse@vger ;-)
> I mentioned this problem to Luc on the sparse mailing list[1] and
> he produced a patch which 'fixed' the problem in one way, but
> caused a different problem[2]. Namely, because git passes -Wvla
> to gcc, it now issues the 'used vla' warnings, which gcc does
> not because of some '# pragma GCC diagnostic ignored "-Wvla"' which
> sparse does not honor! :(
Sorry, but I do not follow. Isn't -Wno-vla an instruction to sparse
to tell it *not* to complain about use of vla?
We do not pass -Wvla or -Wno-vla to sparse ourselves. Because the
tool comes from the Linux land where VLA is not welcome, we'd by
default get the "hey, you used vla here---did you mean it?" error.
And the patch by Luc Van Oostenryck in the thread you raised at
around the end of 2023 does apply to the tip and with
SP_EXTRA_FLAGS += -Wno-vla
in Makefile, sparse seems to be happy when I do "make sparse".
next prev parent reply other threads:[~2024-07-17 18:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 23:17 [PATCH] sparse: ignore warning from new glibc headers Đoàn Trần Công Danh
2024-07-17 16:54 ` Junio C Hamano
2024-07-17 18:40 ` Ramsay Jones
2024-07-17 18:51 ` Junio C Hamano [this message]
2024-07-17 19:20 ` Ramsay Jones
2024-07-17 22:36 ` Ramsay Jones
2024-07-17 22:53 ` Junio C Hamano
2024-07-18 0:02 ` Ramsay Jones
2024-07-18 2:39 ` Đoàn Trần Công Danh
2024-07-18 7:07 ` Junio C Hamano
2024-07-18 8:46 ` Đoàn Trần Công Danh
2024-07-18 4:47 ` Junio C Hamano
2024-07-19 2:03 ` Ramsay Jones
2025-04-08 20:56 ` Johannes Schindelin
2025-04-08 22:35 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr0br26ok.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
--cc=ramsay@ramsayjones.plus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).