aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRichard Palethorpe <rpalethorpe@suse.com>2022-03-21 11:21:19 +0000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-05-21 15:05:46 +0200
commitfbdc046e9561829265588582a0e5926eda1eaa88 (patch)
tree8f582ca2d8b973bc1f90dd842833789ff3cf0de4
parent618f92e7ad155144cc8c97098f7ef86a57aad39d (diff)
downloadsparse-fbdc046e9561829265588582a0e5926eda1eaa88.tar.gz
Use offsetof macro to silence null ptr subtraction warning
Subtracting (char *)0 is undefined behavior. Newer compilers warn about this unless it is done in system headers. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--token.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/token.h b/token.h
index bccac0e4..9000e0cb 100644
--- a/token.h
+++ b/token.h
@@ -201,7 +201,7 @@ struct token {
static inline struct token *containing_token(struct token **p)
{
- void *addr = (char *)p - ((char *)&((struct token *)0)->next - (char *)0);
+ void *addr = (char *)p - offsetof(struct token, next);
return addr;
}