From: Igor Putovny Date: Thu, 30 May 2024 10:27:54 +0000 (+0200) Subject: Backport SKIP_BACK with type control from v3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c72186fe0866cee88677b864ea43b36981a0d83f;p=thirdparty%2Fbird.git Backport SKIP_BACK with type control from v3 --- diff --git a/lib/birdlib.h b/lib/birdlib.h index c1090417a..3460389bf 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -19,7 +19,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))); SAME_TYPE(&_ptr->i, p); _ptr; }) #define BIRD_ALIGN(s, a) (((s)+a-1)&~(a-1)) #define CPU_STRUCT_ALIGN (sizeof(struct align_probe))