mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 15:46:06 +00:00

We are finalizing the header inclusion policy, and for our public headers in the `libc/include` folder, they must use relative path in `"..."` when including each other. This PR does the cleanup making sure that all the public header inclusions in `libc/include` folder use relative paths. --------- Co-authored-by: Nick Desaulniers <nickdesaulniers@users.noreply.github.com>
21 lines
867 B
C
21 lines
867 B
C
//===-- Definition of the containerof macro -------------------------------===//
|
|
//
|
|
// 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_CONTAINEROF_MACRO_H
|
|
#define LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
|
|
|
|
#include "offsetof-macro.h"
|
|
|
|
#define __containerof(ptr, type, member) \
|
|
({ \
|
|
const __typeof(((type *)0)->member) *__ptr = (ptr); \
|
|
(type *)(void *)((const char *)__ptr - offsetof(type, member)); \
|
|
})
|
|
|
|
#endif // LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
|