logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0004-Don-t-use-statement-expressions-on-non-GNU-compilers.patch (808B)


  1. From d1f061dee88d2ea01601d6d2742635c66985ca61 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 16 Jun 2019 12:16:18 -0700
  4. Subject: [PATCH] Don't use statement expressions on non-GNU compilers
  5. ---
  6. include/list.h | 5 +++++
  7. 1 file changed, 5 insertions(+)
  8. diff --git a/include/list.h b/include/list.h
  9. index 5d86b131..7108cea7 100644
  10. --- a/include/list.h
  11. +++ b/include/list.h
  12. @@ -5,9 +5,14 @@
  13. #include <stddef.h>
  14. +#ifdef __GNUC__
  15. #define container_of(ptr, type, member) ({ \
  16. const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  17. (type *)( (char *)__mptr - offsetof(type,member) );})
  18. +#else
  19. +#define container_of(ptr, type, member) ( \
  20. + (type *)( (char *)(ptr) - offsetof(type,member) ))
  21. +#endif
  22. struct list_head {
  23. struct list_head *next, *prev;
  24. --
  25. 2.20.1