git/compat/regex
Johannes Schindelin 88c91d7d74 compat/regex: explicitly mark intentional use of the comma operator
The comma operator is a somewhat obscure C feature that is often used by
mistake and can even cause unintentional code flow. That is why the
`-Wcomma` option of clang was introduced: To identify unintentional uses
of the comma operator.

In the `compat/regex/` code, the comma operator is used twice, once to
avoid surrounding two conditional statements with curly brackets, the
other one to increment two counters simultaneously in a `do ... while`
condition.

The first one is replaced with a proper conditional block, surrounded by
curly brackets.

The second one would be harder to replace because the loop contains two
`continue`s. Therefore, the second one is marked as intentional by
casting the value-to-discard to `void`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-03-28 17:38:11 -07:00
..
regcomp.c compat: disable -Wunused-parameter in 3rd-party code 2024-08-28 09:51:18 -07:00
regex.c compat/regex: explicitly ignore "-Wsign-compare" warnings 2024-12-06 20:20:01 +09:00
regex.h Merge branch 'jk/asan-build-fix' 2020-01-30 14:17:09 -08:00
regex_internal.c compat/regex: explicitly mark intentional use of the comma operator 2025-03-28 17:38:11 -07:00
regex_internal.h compat/regex: move stdlib.h up in inclusion chain 2020-04-27 11:21:16 -07:00
regexec.c compat/regex: explicitly mark intentional use of the comma operator 2025-03-28 17:38:11 -07:00