mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
LinuxKPI: add __struct_size
Use __builtin_object_size() by default. If __builtin_dynamic_object_size() is available use that instead. I would hope that in a future version we can remove the conditional checks but in order to be able to MFC this without checking all compiler versions simply keep it this way for now. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52077
This commit is contained in:
parent
3f48a0fe53
commit
ff5bcb7428
1 changed files with 6 additions and 0 deletions
|
|
@ -130,4 +130,10 @@
|
|||
#define is_signed_type(t) ((t)-1 < (t)1)
|
||||
#define is_unsigned_type(t) ((t)-1 > (t)1)
|
||||
|
||||
#if __has_builtin(__builtin_dynamic_object_size)
|
||||
#define __struct_size(_s) __builtin_dynamic_object_size(_s, 0)
|
||||
#else
|
||||
#define __struct_size(_s) __builtin_object_size(_s, 0)
|
||||
#endif
|
||||
|
||||
#endif /* _LINUXKPI_LINUX_COMPILER_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue