[libc-commits] [libc] [libc] Provide sys/queue.h (PR #78081)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Jan 17 22:13:03 PST 2024


================
@@ -96,27 +148,61 @@
     struct type *next;                                                         \
   }
 
+#define STAILQ_CLASS_ENTRY(type)                                               \
+  struct {                                                                     \
+    class type *next;                                                          \
+  }
+
 // Singly-linked tail queue access methods.
 
 #define STAILQ_EMPTY(head) ((head)->first == NULL)
 #define STAILQ_FIRST(head) ((head)->first)
+#define STAILQ_LAST(head, type, field)                                         \
+  STAILQ_EMPTY(head)                                                           \
+  ? NULL                                                                       \
+  : (QUEUE_TYPEOF(type) *)((char *)(head)->last -                              \
+                           offsetof(QUEUE_TYPEOF(type), field))
----------------
petrhosek wrote:

Done.

https://github.com/llvm/llvm-project/pull/78081


More information about the libc-commits mailing list