[libc-commits] [libc] [libc] Use QUEUE_TYPEOF in STAILQ_LAST (PR #79011)
via libc-commits
libc-commits at lists.llvm.org
Mon Jan 22 09:03:28 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Petr Hosek (petrhosek)
<details>
<summary>Changes</summary>
This is to ensure this macro is compatible with both C and C++.
---
Full diff: https://github.com/llvm/llvm-project/pull/79011.diff
1 Files Affected:
- (modified) libc/include/llvm-libc-macros/sys-queue-macros.h (+3-1)
``````````diff
diff --git a/libc/include/llvm-libc-macros/sys-queue-macros.h b/libc/include/llvm-libc-macros/sys-queue-macros.h
index f41e7363e418bf4..59e6a9a392c9781 100644
--- a/libc/include/llvm-libc-macros/sys-queue-macros.h
+++ b/libc/include/llvm-libc-macros/sys-queue-macros.h
@@ -160,7 +160,9 @@
#define STAILQ_EMPTY(head) ((head)->first == NULL)
#define STAILQ_FIRST(head) ((head)->first)
#define STAILQ_LAST(head, type, field) \
- (STAILQ_EMPTY(head) ? NULL : __containerof((head)->last, type, field.next))
+ (STAILQ_EMPTY(head) \
+ ? NULL \
+ : __containerof((head)->last, QUEUE_TYPEOF(type), field.next))
#define STAILQ_NEXT(elem, field) ((elem)->field.next)
#define STAILQ_FOREACH(var, head, field) \
``````````
</details>
https://github.com/llvm/llvm-project/pull/79011
More information about the libc-commits
mailing list