[libc++][Android] Allow testing libc++ with clang-r536225 (#116149)
[llvm-project.git] / libc / src / errno / libc_errno.h
blob44ee2714843bab60ad58567219b1861a035b9d3e
1 //===-- Implementation header for libc_errno --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
10 #define LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/macros/config.h"
14 #include "src/__support/macros/properties/architectures.h"
16 #include "hdr/errno_macros.h"
18 // This header is to be consumed by internal implementations, in which all of
19 // them should refer to `libc_errno` instead of using `errno` directly from
20 // <errno.h> header.
22 // Unit and hermetic tests should:
23 // - #include "src/errno/libc_errno.h"
24 // - NOT #include <errno.h>
25 // - Only use `libc_errno` in the code
26 // - Depend on libc.src.errno.errno
28 // Integration tests should:
29 // - NOT #include "src/errno/libc_errno.h"
30 // - #include <errno.h>
31 // - Use regular `errno` in the code
32 // - Still depend on libc.src.errno.errno
34 namespace LIBC_NAMESPACE_DECL {
36 extern "C" int *__llvm_libc_errno() noexcept;
38 struct Errno {
39 void operator=(int);
40 operator int();
43 extern Errno libc_errno;
45 } // namespace LIBC_NAMESPACE_DECL
47 #endif // LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H