diff options
author | Richard Palethorpe <rpalethorpe@suse.com> | 2022-03-21 11:21:19 +0000 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-05-21 15:05:46 +0200 |
commit | fbdc046e9561829265588582a0e5926eda1eaa88 (patch) | |
tree | 8f582ca2d8b973bc1f90dd842833789ff3cf0de4 | |
parent | 618f92e7ad155144cc8c97098f7ef86a57aad39d (diff) | |
download | sparse-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.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |