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

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Tue Apr 22 13:06:53 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
----------------
SchrodingerZhu wrote:

It is the same for definition inside stddef.h which also goes to builtin function eventually.

I made this just for defining the macro explicitly if we are using clang/gcc. 

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


More information about the libc-commits mailing list