[libc-commits] [libc] [libc] implement sigsetjmp/siglongjmp for x86-64 (PR #136072)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Apr 22 11:26:30 PDT 2025


================
@@ -0,0 +1,22 @@
+//===-- Definition of macros for offsetof ---------------------------------===//
+//
+// 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_HDR_OFFSETOF_MACROS_H
+#define LLVM_LIBC_HDR_OFFSETOF_MACROS_H
+
+#undef offsetof
+
+// Simplify the inclusion if builtin function is available.
+#if __has_builtin(__builtin_offsetof)
+#define offsetof(t, d) __builtin_offsetof(t, d)
+#else
+#define __need_offsetof
+#include <stddef.h> // compiler resource header
+#endif
----------------
michaelrj-google wrote:

why is the `__has_builtin` necessary? If it is necessary, why isn't it in `include/llvm-libc-macros/offsetof-macro.h`?

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


More information about the libc-commits mailing list