mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 02:29:23 +00:00
compiler: add ASSIGN_TYPED and ASSIGN_MEMBER
Looks like it's the most appropriate place for those hooks. Didn't know about those helpers - maybe I should have used them in my code more widely instead of casts. Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
e1d7ff8f0d
commit
4f0fdb463e
5 changed files with 3 additions and 12 deletions
|
|
@ -54,9 +54,6 @@ typedef struct {
|
|||
typedef struct user_pt_regs user_regs_struct_t;
|
||||
|
||||
|
||||
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
|
||||
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
|
||||
|
||||
#define REG_RES(regs) ((u64)(regs).regs[0])
|
||||
#define REG_IP(regs) ((u64)(regs).pc)
|
||||
#define REG_SYSCALL_NR(regs) ((u64)(regs).regs[8])
|
||||
|
|
|
|||
|
|
@ -89,9 +89,6 @@ struct user_vfp_exc {
|
|||
unsigned long fpinst2;
|
||||
};
|
||||
|
||||
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
|
||||
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
|
||||
|
||||
#define REG_RES(regs) ((regs).ARM_r0)
|
||||
#define REG_IP(regs) ((regs).ARM_pc)
|
||||
#define REG_SYSCALL_NR(regs) ((regs).ARM_r7)
|
||||
|
|
|
|||
|
|
@ -72,9 +72,6 @@ typedef UserPpc64RegsEntry UserRegsEntry;
|
|||
|
||||
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__PPC64
|
||||
|
||||
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
|
||||
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
|
||||
|
||||
#define REG_RES(regs) ((u64)(regs).gpr[3])
|
||||
#define REG_IP(regs) ((u64)(regs).nip)
|
||||
#define REG_SYSCALL_NR(regs) ((u64)(regs).gpr[0])
|
||||
|
|
|
|||
|
|
@ -105,9 +105,6 @@ typedef struct {
|
|||
u32 padding[24];
|
||||
} user_fpregs_struct_t;
|
||||
|
||||
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
|
||||
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
# define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
|
||||
#define ASSIGN_TYPED(a, b) do { (a) = (typeof(a))(b); } while (0)
|
||||
#define ASSIGN_MEMBER(a, b, m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue