From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] sparse: ignore warning from new glibc headers
Date: Tue, 8 Apr 2025 22:56:33 +0200 (CEST) [thread overview]
Message-ID: <77f82414-261c-d2bc-f911-ed3d4b06c86e@gmx.de> (raw)
In-Reply-To: <a667da3985a0fe943cc0ff6ee8513d731d75a299.1721171853.git.congdanhqx@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4031 bytes --]
Hi Danh,
On Wed, 17 Jul 2024, Đoàn Trần Công Danh wrote:
> 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.
>
> Note: `__nmatch' is POSIX's nmatch.
>
> The glibc's intention is informing their users to provides a large
> enough buffer to hold `__nmatch' results and provides diagnosis if
> necessary. It's merely a glibc' implementation detail.
>
> Hide that usage from sparse by using standard C11's macro:
> __STDC_NO_VLA__
>
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index bc81d3395032a..4b9daca1dcc58 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1381,7 +1381,7 @@ ARFLAGS = rcs
> PTHREAD_CFLAGS =
>
> # For the 'sparse' target
> -SPARSE_FLAGS ?= -std=gnu99
> +SPARSE_FLAGS ?= -std=gnu99 -D__STDC_NO_VLA__
> SP_EXTRA_FLAGS = -Wno-universal-initializer
>
> # For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets
> --
> 2.45.2.599.g51c0d632d3b6f
Thank you for this patch!
Due to the brownouts today (see
https://github.com/actions/runner-images/issues/11101, surfaced e.g. in
https://github.com/git/git/actions/runs/14342895944/job/40206357016), your
patch came in handy, as it is required for the following fix:
-- snipsnap --
Subject: [PATCH] ci: upgrade `sparse` to supported build agents
The `sparse` job still uses the `ubuntu-20.04` runner pool, but that
pool is about to go away, so let's stop using it.
There is no `sparse-22.04` artifact provided by the "Build sparse for
Ubuntu" Azure Pipeline, but that is not necessary anyway because Ubuntu
22.04 has the `sparse` package: https://packages.ubuntu.com/jammy/sparse
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
.github/workflows/main.yml | 11 +----------
ci/install-dependencies.sh | 2 +-
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ff44c0a8c067..c9455246269d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -449,20 +449,11 @@ jobs:
if: needs.ci-config.outputs.enabled == 'yes'
env:
jobname: sparse
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
concurrency:
group: sparse-${{ github.ref }}
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- - name: Download a current `sparse` package
- # Ubuntu's `sparse` version is too old for us
- uses: git-for-windows/get-azure-pipelines-artifact@v0
- with:
- repository: git/git
- definitionId: 10
- artifact: sparse-20.04
- - name: Install the current `sparse` package
- run: sudo dpkg -i sparse-20.04/sparse_*.deb
- uses: actions/checkout@v4
- name: Install other dependencies
run: ci/install-dependencies.sh
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 0df74610d063..8700c0f2924d 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -119,7 +119,7 @@ StaticAnalysis)
sparse)
sudo apt-get -q update -q
sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
- libexpat-dev gettext zlib1g-dev
+ libexpat-dev gettext zlib1g-dev sparse
;;
Documentation)
sudo apt-get -q update
--
2.49.0.windows.1
next prev parent reply other threads:[~2025-04-08 20:56 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
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 [this message]
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=77f82414-261c-d2bc-f911-ed3d4b06c86e@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
/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).