checkpatch: tweak "struct should normally be const" warning
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Oct 2016 08:45:45 +0000 (10:45 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 1 Nov 2016 15:06:57 +0000 (16:06 +0100)
Avoid triggering on

    typedef struct BlockJobDriver BlockJobDriver;

or

    struct BlockJobDriver {

Cc: John Snow <jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scripts/checkpatch.pl

index 3afa19a..1f1c9d3 100755 (executable)
@@ -2498,8 +2498,8 @@ sub process {
                                VMStateDescription|
                                VMStateInfo}x;
                if ($line !~ /\bconst\b/ &&
-                   $line =~ /\b($struct_ops)\b/) {
-                       ERROR("struct $1 should normally be const\n" .
+                   $line =~ /\b($struct_ops)\b.*=/) {
+                       ERROR("initializer for struct $1 should normally be const\n" .
                                $herecurr);
                }