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

via libc-commits libc-commits at lists.llvm.org
Wed Jan 17 11:23:34 PST 2024


================
@@ -0,0 +1,259 @@
+//===-- Macros defined in sys/queue.h header file -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __LLVM_LIBC_MACROS_SYS_QUEUE_MACROS_H
+#define __LLVM_LIBC_MACROS_SYS_QUEUE_MACROS_H
+
+#include <llvm-libc-macros/null-macro.h>
+#include <llvm-libc-macros/offsetof-macro.h>
+
+#ifdef __cplusplus
+#define QUEUE_TYPEOF(type) type
+#else
+#define QUEUE_TYPEOF(type) struct type
+#endif
+
+// Singly-linked list definitions.
----------------
michaelrj-google wrote:

These macros seem overall fine, we normally organize our headers a bit differently. The macros should go in `llvm-libc-macros/sys-queue-macros.h`, which will leave this header practically empty. That's fine though, since that will allow you to use the path `include/llvm-libc-macros/sys-queue-macros.h` in your test which should make it guaranteed to grab the right file.

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


More information about the libc-commits mailing list