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 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H 10 #define LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H 11 12 #include "src/__support/macros/attributes.h" 13 #include "src/__support/macros/properties/architectures.h" 14 15 #include "hdr/errno_macros.h" 16 17 // This header is to be consumed by internal implementations, in which all of 18 // them should refer to `libc_errno` instead of using `errno` directly from 19 // <errno.h> header. 20 21 // Unit and hermetic tests should: 22 // - #include "src/errno/libc_errno.h" 23 // - NOT #include <errno.h> 24 // - Only use `libc_errno` in the code 25 // - Depend on libc.src.errno.errno 26 27 // Integration tests should: 28 // - NOT #include "src/errno/libc_errno.h" 29 // - #include <errno.h> 30 // - Use regular `errno` in the code 31 // - Still depend on libc.src.errno.errno 32 33 namespace LIBC_NAMESPACE { 34 struct Errno { 35 void operator=(int); 36 operator int(); 37 }; 38 39 extern Errno libc_errno; 40 41 } // namespace LIBC_NAMESPACE 42 43 #endif // LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H 44