aboutsummaryrefslogtreecommitdiff
path: root/libc/src
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2024-07-13 11:23:32 -0700
committerGitHub <noreply@github.com>2024-07-13 11:23:32 -0700
commit4a68654ad6c4d85208b817fc914e17d084ed25ae (patch)
treef78ae55f6d3d232e0f8a5361937a0257e2cbfaca /libc/src
parentf96e4e8c106a502a86f128ec0069091f75a47730 (diff)
downloadllvm-4a68654ad6c4d85208b817fc914e17d084ed25ae.zip
llvm-4a68654ad6c4d85208b817fc914e17d084ed25ae.tar.gz
llvm-4a68654ad6c4d85208b817fc914e17d084ed25ae.tar.bz2
[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.
Diffstat (limited to 'libc/src')
-rw-r--r--libc/src/errno/CMakeLists.txt1
-rw-r--r--libc/src/errno/errno.h14
-rw-r--r--libc/src/errno/libc_errno.cpp15
-rw-r--r--libc/src/errno/libc_errno.h2
4 files changed, 7 insertions, 25 deletions
diff --git a/libc/src/errno/CMakeLists.txt b/libc/src/errno/CMakeLists.txt
index b05fd4e..1d78a5e 100644
--- a/libc/src/errno/CMakeLists.txt
+++ b/libc/src/errno/CMakeLists.txt
@@ -18,7 +18,6 @@ add_entrypoint_object(
SRCS
libc_errno.cpp
HDRS
- errno.h
libc_errno.h # Include this
COMPILE_OPTIONS
${full_build_flag}
diff --git a/libc/src/errno/errno.h b/libc/src/errno/errno.h
deleted file mode 100644
index a2df935..0000000
--- a/libc/src/errno/errno.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- Implementation header for errno -------------------------*- C++ -*-===//
-//
-// 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_SRC_ERRNO_ERRNO_H
-#define LLVM_LIBC_SRC_ERRNO_ERRNO_H
-
-extern "C" int *__llvm_libc_errno();
-
-#endif // LLVM_LIBC_SRC_ERRNO_ERRNO_H
diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index f7bd3a3..7b28a62 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "libc_errno.h"
-#include "src/errno/errno.h"
#include "src/__support/macros/config.h"
// libc never stores a value; `errno` macro uses get link-time failure.
@@ -47,9 +46,6 @@ LIBC_ERRNO_MODE_SYSTEM
namespace LIBC_NAMESPACE_DECL {
-// Define the global `libc_errno` instance.
-Errno libc_errno;
-
#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_UNDEFINED
void Errno::operator=(int) {}
@@ -61,9 +57,7 @@ namespace {
LIBC_THREAD_LOCAL int thread_errno;
}
-extern "C" {
-int *__llvm_libc_errno() { return &thread_errno; }
-}
+extern "C" int *__llvm_libc_errno() { return &thread_errno; }
void Errno::operator=(int a) { thread_errno = a; }
Errno::operator int() { return thread_errno; }
@@ -74,9 +68,7 @@ namespace {
int shared_errno;
}
-extern "C" {
-int *__llvm_libc_errno() { return &shared_errno; }
-}
+extern "C" int *__llvm_libc_errno() { return &shared_errno; }
void Errno::operator=(int a) { shared_errno = a; }
Errno::operator int() { return shared_errno; }
@@ -93,4 +85,7 @@ Errno::operator int() { return errno; }
#endif
+// Define the global `libc_errno` instance.
+Errno libc_errno;
+
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/errno/libc_errno.h b/libc/src/errno/libc_errno.h
index c6c6b20..82c65f5 100644
--- a/libc/src/errno/libc_errno.h
+++ b/libc/src/errno/libc_errno.h
@@ -33,6 +33,8 @@
namespace LIBC_NAMESPACE_DECL {
+extern "C" int *__llvm_libc_errno();
+
struct Errno {
void operator=(int);
operator int();