Skip to content

Commit d2c123c

Browse files
committed
module_param: add __same_type convenience wrapper for __builtin_types_compatible_p
Impact: new API __builtin_types_compatible_p() is a little awkward to use: it takes two types rather than types or variables, and it's just damn long. (typeof(type) == type, so this works on types as well as vars). Signed-off-by: Rusty Russell <[email protected]>
1 parent 45fcc70 commit d2c123c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/linux/compiler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
261261
# define __section(S) __attribute__ ((__section__(#S)))
262262
#endif
263263

264+
/* Are two types/vars the same type (ignoring qualifiers)? */
265+
#ifndef __same_type
266+
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
267+
#endif
268+
264269
/*
265270
* Prevent the compiler from merging or refetching accesses. The compiler
266271
* is also forbidden from reordering successive instances of ACCESS_ONCE(),

0 commit comments

Comments
 (0)