Skip to content

Commit 4a68654

Browse files
authored
[libc] Remove src/errno/errno.h (#98759)
This addresses the build error introduced in #98287 where src/errno/errno.h is included instead of the system errno.h. We instead move the declaration to libc_errno.h.
1 parent f96e4e8 commit 4a68654

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

libc/src/errno/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ add_entrypoint_object(
1818
SRCS
1919
libc_errno.cpp
2020
HDRS
21-
errno.h
2221
libc_errno.h # Include this
2322
COMPILE_OPTIONS
2423
${full_build_flag}

libc/src/errno/errno.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

libc/src/errno/libc_errno.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "libc_errno.h"
10-
#include "src/errno/errno.h"
1110
#include "src/__support/macros/config.h"
1211

1312
// libc never stores a value; `errno` macro uses get link-time failure.
@@ -47,9 +46,6 @@ LIBC_ERRNO_MODE_SYSTEM
4746

4847
namespace LIBC_NAMESPACE_DECL {
4948

50-
// Define the global `libc_errno` instance.
51-
Errno libc_errno;
52-
5349
#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_UNDEFINED
5450

5551
void Errno::operator=(int) {}
@@ -61,9 +57,7 @@ namespace {
6157
LIBC_THREAD_LOCAL int thread_errno;
6258
}
6359

64-
extern "C" {
65-
int *__llvm_libc_errno() { return &thread_errno; }
66-
}
60+
extern "C" int *__llvm_libc_errno() { return &thread_errno; }
6761

6862
void Errno::operator=(int a) { thread_errno = a; }
6963
Errno::operator int() { return thread_errno; }
@@ -74,9 +68,7 @@ namespace {
7468
int shared_errno;
7569
}
7670

77-
extern "C" {
78-
int *__llvm_libc_errno() { return &shared_errno; }
79-
}
71+
extern "C" int *__llvm_libc_errno() { return &shared_errno; }
8072

8173
void Errno::operator=(int a) { shared_errno = a; }
8274
Errno::operator int() { return shared_errno; }
@@ -93,4 +85,7 @@ Errno::operator int() { return errno; }
9385

9486
#endif
9587

88+
// Define the global `libc_errno` instance.
89+
Errno libc_errno;
90+
9691
} // namespace LIBC_NAMESPACE_DECL

libc/src/errno/libc_errno.h

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

3434
namespace LIBC_NAMESPACE_DECL {
3535

36+
extern "C" int *__llvm_libc_errno();
37+
3638
struct Errno {
3739
void operator=(int);
3840
operator int();

0 commit comments

Comments
 (0)