skbuff: Move conditional preprocessor directives out of struct sk_buff
authorKees Cook <keescook@chromium.org>
Sun, 21 Nov 2021 00:31:48 +0000 (16:31 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Nov 2021 15:13:54 +0000 (15:13 +0000)
commitfba84957e2e2e201cf4e352efe0c7cac0fbb5d5d
treef6711038ddfc05da565be7bcef2561bb45c1a6cc
parentcb902b332f9545635911063b671927defa5866bf
skbuff: Move conditional preprocessor directives out of struct sk_buff

In preparation for using the struct_group() macro in struct sk_buff,
move the conditional preprocessor directives out of the region of struct
sk_buff that will be enclosed by struct_group(). While GCC and Clang are
happy with conditional preprocessor directives here, sparse is not, even
under -Wno-directive-within-macro[1], as would be seen under a C=1 build:

net/core/filter.c: note: in included file (through include/linux/netlink.h, include/linux/sock_diag.h):
./include/linux/skbuff.h:820:1: warning: directive in macro's argument list
./include/linux/skbuff.h:822:1: warning: directive in macro's argument list
./include/linux/skbuff.h:846:1: warning: directive in macro's argument list
./include/linux/skbuff.h:848:1: warning: directive in macro's argument list

Additionally remove empty macro argument definitions and usage.

"objdump -d" shows no object code differences.

[1] https://www.spinics.net/lists/linux-sparse/msg10857.html

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/core/filter.c