Skip to contentSkip to conversation

confusing checkpatch.pl messages

DISCUSSION Németh Márton 3 participants 3 messages Jan 6, 2009 – Jan 8, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I run the checkpatch.pl against the attache file and it reported some confusing warning and error messages. The attached file has an obsoleted syntax:

Quoted 11 lines

From "info gcc", Chapter 5.21 "Designated Initializers":
In a structure initializer, specify the name of a field to initialize
with `.FIELDNAME =' before the element value. For example, given the following structure,

     struct point { int x, y; };

the following initialization

     struct point p = { .y = yvalue, .x = xvalue };
Quoted 8 lines

is equivalent to

     struct point p = { xvalue, yvalue };

Another syntax which has the same meaning, obsolete since GCC 2.5, is
`FIELDNAME:', as shown here:

    struct point p = { y: yvalue, x: xvalue };

However, the checkpatch.pl speaks about labels, which are incorrect, I think:

Quoted 23 lines
$ /usr/src/linux/scripts/checkpatch.pl --file test.c
WARNING: labels should not be indented
#5: FILE: test.c:5:
+       open: test_open,

ERROR: spaces required around that ':' (ctx:VxW)
#6: FILE: test.c:6:
+ release: test_close,

               ^

WARNING: labels should not be indented
#6: FILE: test.c:6:
+ release: test_close,

ERROR: spaces required around that ':' (ctx:VxW)
#7: FILE: test.c:7:
+ ioctl: test_ioctl,

             ^

WARNING: labels should not be indented
#7: FILE: test.c:7:
+ ioctl: test_ioctl,

Quoted 5 lines

total: 2 errors, 3 warnings, 9 lines checked

test.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Regards,

Márton Németh

#include <linux/blkdev.h>

static struct block_device_operations bdops = {
open: test_open,
release: test_close,
ioctl: test_ioctl,
};

#1 lore raw
Quoted 19 lines · Németh Márton

Hi,

I run the checkpatch.pl against the attache file and it reported some confusing warning and error messages. The attached file has an obsoleted syntax:

From "info gcc", Chapter 5.21 "Designated Initializers":

Quoted 12 lines

In a structure initializer, specify the name of a field to initialize
with `.FIELDNAME =' before the element value. For example, given the following structure,

     struct point { int x, y; };

the following initialization

     struct point p = { .y = yvalue, .x = xvalue };

is equivalent to

Quoted 12 lines
Quoted 6 lines
     struct point p = { xvalue, yvalue };

Another syntax which has the same meaning, obsolete since GCC 2.5, is
`FIELDNAME:', as shown here:

    struct point p = { y: yvalue, x: xvalue };

However, the checkpatch.pl speaks about labels, which are incorrect, I think:

Quoted 4 lines
$ /usr/src/linux/scripts/checkpatch.pl --file test.c
WARNING: labels should not be indented
#5: FILE: test.c:5:
+       open: test_open,

Well, the warning message is wrong, that part is presumably a bug. It's right to complain, though, as that obsolete syntax shouldn't be used.

#2 lore raw
In reply to Németh Márton
Quoted 5 lines · Németh Márton

Hi,

I run the checkpatch.pl against the attache file and it reported some confusing warning and error messages. The attached file has an obsoleted syntax:

[...]

Quoted 3 lines
Quoted 1 line
    struct point p = { y: yvalue, x: xvalue };

However, the checkpatch.pl speaks about labels, which are incorrect, I think:

Yeah that is the wrong error for sure. Will see if I can stop it doing that and emit something more sensible.

-apw