]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts/checkpatch: remove check on forbidden space before '[' in C++
authorPierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Mon, 15 Jun 2026 19:35:24 +0000 (12:35 -0700)
committerPierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Tue, 16 Jun 2026 17:59:05 +0000 (10:59 -0700)
Lambdas are very confusing for checkpatch, so just relax this check.

Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-26-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
scripts/checkpatch.pl

index 538e059e2653986eb94d0df8f7b309fc969ebfeb..03f35e75012c8c7a00b67f036e4befb2ea162d4a 100755 (executable)
@@ -2423,7 +2423,8 @@ sub process {
 #  3. inside a curly brace -- = { [0...10] = 5 }
 #  4. after a comma -- [1] = 5, [2] = 6
 #  5. in a macro definition -- #define abc(x) [x] = y
-               while ($line =~ /(.*?\s)\[/g) {
+               my $cpp = $realfile =~ /(\.cpp)$/;
+               while (!$cpp && $line =~ /(.*?\s)\[/g) {
                        my ($where, $prefix) = ($-[1], $1);
                        if ($prefix !~ /$Type\s+$/ &&
                            ($where != 0 || $prefix !~ /^.\s+$/) &&