diff options
author | Maria Matejka <mq@ucw.cz> | 2021-10-13 11:33:48 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-11-22 19:05:43 +0100 |
commit | 2d7e42cc593b3c99f8eacaaa506194aeb3a5cf85 (patch) | |
tree | 97696150b29d35c467a854163b0f75f0634860e2 /lib | |
parent | c70b3198dc349127273d202ab8c36afeebb6d9d0 (diff) |
Type checking in SKIP_BACK macro
Diffstat (limited to 'lib')
-rw-r--r-- | lib/birdlib.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h index 431b7c0d..2e642d38 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -16,7 +16,7 @@ struct align_probe { char x; long int y; }; #define OFFSETOF(s, i) ((size_t) &((s *)0)->i) -#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i))) +#define SKIP_BACK(s, i, p) ({ s *_ptr = ((s *)((char *)p - OFFSETOF(s, i))); ASSERT_DIE(&_ptr->i == p); _ptr; }) #define BIRD_ALIGN(s, a) (((s)+a-1)&~(a-1)) #define CPU_STRUCT_ALIGN (sizeof(struct align_probe)) |