Skip to contentSkip to conversation

checkpatch: false positive "Alignment should match open parenthesis" with struct_group_tagged()

DISCUSSION Marc Kleine-Budde 2 participants 3 messages Nov 21

lore
Share & tools
lore
#0 lore raw

Hello,

it seems that all users of struct_group_tagged() in the kernel indent with 1 tab, like this:

| struct gs_host_frame {
| 	struct_group_tagged(gs_host_frame_header, header,
| 		u32 echo_id;
| 		__le32 can_id;
|
| 		u8 can_dlc;
| 		u8 channel;
| 		u8 flags;
| 		u8 reserved;
| 	);
|
| 	union {
| 		DECLARE_FLEX_ARRAY(struct classic_can, classic_can);
| 		DECLARE_FLEX_ARRAY(struct classic_can_ts, classic_can_ts);
| 		DECLARE_FLEX_ARRAY(struct classic_can_quirk, classic_can_quirk);
| 		DECLARE_FLEX_ARRAY(struct canfd, canfd);
| 		DECLARE_FLEX_ARRAY(struct canfd_ts, canfd_ts);
| 		DECLARE_FLEX_ARRAY(struct canfd_quirk, canfd_quirk);
| 	};
| } __packed;

But checkpatch doesn't like this and warns:

● 06b928706f7e: can: gs_usb: gs_usb_get_gs_can(): introduce new function to consolidate validation of struct gs_can
● checkpatch.pl: drivers/net/can/usb/gs_usb.c:271: CHECK: Alignment should match open parenthesis

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
#1 lore raw
Quoted 1 line · Marc Kleine-Budde

Hello,

Hello to you.

Quoted 13 lines

it seems that all users of struct_group_tagged() in the kernel indent with 1 tab, like this:

Quoted 10 lines
struct gs_host_frame {
	struct_group_tagged(gs_host_frame_header, header,
		u32 echo_id;
		__le32 can_id;

		u8 can_dlc;
		u8 channel;
		u8 flags;
		u8 reserved;
	);

Thanks for the report, but I don't care.
It's just an unusual macro mechanism.

include/linux/stddef.h:#define struct_group_tagged(TAG, NAME, MEMBERS...) \

etc..,

#2 lore raw
Quoted 14 lines · Joe Perches
Quoted 13 lines

it seems that all users of struct_group_tagged() in the kernel indent with 1 tab, like this:

Quoted 10 lines
struct gs_host_frame {
	struct_group_tagged(gs_host_frame_header, header,
		u32 echo_id;
		__le32 can_id;

		u8 can_dlc;
		u8 channel;
		u8 flags;
		u8 reserved;
	);
Quoted 4 lines

Thanks for the report, but I don't care.
It's just an unusual macro mechanism.

include/linux/stddef.h:#define struct_group_tagged(TAG, NAME, MEMBERS...) \

...it isn't used that often anyway :) and it's only on the "CHECK" level.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |