Skip to content

Commit d526d47

Browse files
committed
[libc][annex_k] Add errno_t.
1 parent 596ff85 commit d526d47

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed

libc/hdr/types/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ add_proxy_header_library(
162162
libc.include.fcntl
163163
)
164164

165+
add_proxy_header_library(
166+
errno_t
167+
HDRS
168+
errno_t.h
169+
FULL_BUILD_DEPENDS
170+
libc.include.llvm-libc-types.errno_t
171+
libc.include.errno
172+
)
173+
165174
add_proxy_header_library(
166175
fenv_t
167176
HDRS

libc/hdr/types/errno_t.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//===-- Proxy for errno_t -------------------------------------------------===//
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_HDR_TYPES_ERRNO_T_H
10+
#define LLVM_LIBC_HDR_TYPES_ERRNO_T_H
11+
12+
#define LIBC_HAS_ANNEX_K
13+
14+
#include "include/llvm-libc-types/errno_t.h"
15+
16+
#undef LIBC_HAS_ANNEX_K
17+
18+
#endif // LLVM_LIBC_HDR_TYPES_ERRNO_T_H

libc/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ add_header_macro(
302302
DEPENDS
303303
.llvm-libc-macros.generic_error_number_macros
304304
.llvm-libc-macros.error_number_macros
305+
.llvm-libc-types.errno_t
305306
)
306307

307308
add_header_macro(

libc/include/errno.h.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ __END_C_DECLS
3333

3434
#define errno (*__llvm_libc_errno())
3535

36+
#include "llvm-libc-types/errno_t.h"
37+
3638
#endif // LLVM_LIBC_ERRNO_H

libc/include/llvm-libc-types/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,5 @@ add_header(EFI_SYSTEM_TABLE
296296
.EFI_TABLE_HEADER
297297
.char16_t
298298
)
299+
300+
add_header(errno_t HDR errno_t.h)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//===-- Definition of type errno_t ----------------------------------------===//
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_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H
10+
#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H
11+
12+
#ifdef LIBC_HAS_ANNEX_K
13+
14+
typedef int errno_t;
15+
16+
#endif // LIBC_HAS_ANNEX_K
17+
18+
#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H

0 commit comments

Comments
 (0)