[PATCH] headers/deps: Attribute placement fixes for Clang & GCC

From: Ingo Molnar
Date: Tue Jan 04 2022 - 19:26:39 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> Ugh - so my changes there are outright buggy.
>
> I'm reverting all those attribute position changes as we speak ...
>
> I'm actually happy about this in a way, as it settles the issue nicely.
> :-)

And, by the way - by putting the attribute after the 'struct' keyword we
get the best of the two worlds: accidentally non-defined attribute
shortcuts will still result in a build error.

Below is the fix - should be identical to yours (which was whitespace
mangled).

I'll backmerge these fixes to the originating commits & push out -v2 later
today.

Thanks,

Ingo
---
include/linux/dcache.h | 3 +--
include/linux/fs_types.h | 3 +--
include/linux/netdevice_api.h | 2 +-
include/net/xdp_types.h | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 520daf638d06..da7e77a7cede 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -127,8 +127,7 @@ enum dentry_d_lock_class
DENTRY_D_LOCK_NESTED
};

-____cacheline_aligned
-struct dentry_operations {
+struct ____cacheline_aligned dentry_operations {
int (*d_revalidate)(struct dentry *, unsigned int);
int (*d_weak_revalidate)(struct dentry *, unsigned int);
int (*d_hash)(const struct dentry *, struct qstr *);
diff --git a/include/linux/fs_types.h b/include/linux/fs_types.h
index b53aadafab1b..e2e1c0827183 100644
--- a/include/linux/fs_types.h
+++ b/include/linux/fs_types.h
@@ -994,8 +994,7 @@ struct file_operations {
int (*fadvise)(struct file *, loff_t, loff_t, int);
} __randomize_layout;

-____cacheline_aligned
-struct inode_operations {
+struct ____cacheline_aligned inode_operations {
struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *);
int (*permission) (struct user_namespace *, struct inode *, int);
diff --git a/include/linux/netdevice_api.h b/include/linux/netdevice_api.h
index 4a8d7688e148..0e5e08dcbb2a 100644
--- a/include/linux/netdevice_api.h
+++ b/include/linux/netdevice_api.h
@@ -49,7 +49,7 @@
#endif

/* This structure contains an instance of an RX queue. */
-____cacheline_aligned_in_smp struct netdev_rx_queue {
+struct ____cacheline_aligned_in_smp netdev_rx_queue {
struct xdp_rxq_info xdp_rxq;
#ifdef CONFIG_RPS
struct rps_map __rcu *rps_map;
diff --git a/include/net/xdp_types.h b/include/net/xdp_types.h
index 442028626b35..accc12372bca 100644
--- a/include/net/xdp_types.h
+++ b/include/net/xdp_types.h
@@ -56,7 +56,7 @@ struct xdp_mem_info {
struct page_pool;

/* perf critical, avoid false-sharing */
-____cacheline_aligned struct xdp_rxq_info {
+struct ____cacheline_aligned xdp_rxq_info {
struct net_device *dev;
u32 queue_index;
u32 reg_state;