xref: /freebsd/contrib/llvm-project/clang/lib/Headers/__stddef_offsetof.h (revision 439352ac8257c8419cb4a662abb7f260f31f9932)
15f757f3fSDimitry Andric /*===---- __stddef_offsetof.h - Definition of offsetof ---------------------===
25f757f3fSDimitry Andric  *
35f757f3fSDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45f757f3fSDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
55f757f3fSDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65f757f3fSDimitry Andric  *
75f757f3fSDimitry Andric  *===-----------------------------------------------------------------------===
85f757f3fSDimitry Andric  */
95f757f3fSDimitry Andric 
10*439352acSDimitry Andric /*
11*439352acSDimitry Andric  * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
12*439352acSDimitry Andric  * and needs to behave as if it was textual.
13*439352acSDimitry Andric  */
14*439352acSDimitry Andric #if !defined(offsetof) ||                                                      \
15*439352acSDimitry Andric     (__has_feature(modules) && !__building_module(_Builtin_stddef))
165f757f3fSDimitry Andric #define offsetof(t, d) __builtin_offsetof(t, d)
175f757f3fSDimitry Andric #endif
18