[libc-commits] [libc] d3e0459 - Revert "[libc] Add limits.h"
Alfred Persson Forsberg via libc-commits
libc-commits at lists.llvm.org
Wed Aug 16 21:24:29 PDT 2023
Author: Alfred Persson Forsberg
Date: 2023-08-17T06:21:50+02:00
New Revision: d3e045934a3d50411a20bbfdfedadbda83803890
URL: https://github.com/llvm/llvm-project/commit/d3e045934a3d50411a20bbfdfedadbda83803890
DIFF: https://github.com/llvm/llvm-project/commit/d3e045934a3d50411a20bbfdfedadbda83803890.diff
LOG: Revert "[libc] Add limits.h"
limits.h currently interferes with Clang's limits.h. include_next
emits a warning because it is a GNU extension. Will re add this once
we figure out a good solution.
This reverts commits 13bbca8d694b4ef2ad03ec1805f07da8640c1a31,
002cba03298a7e8f0c1cadcb7996379e9ea5feff, and
0fb3066873fdfbe28dbb6409c58a8bff7cf208c6.
Added:
Modified:
libc/config/linux/x86_64/headers.txt
libc/include/CMakeLists.txt
libc/include/llvm-libc-macros/CMakeLists.txt
libc/spec/posix.td
libc/spec/stdc.td
Removed:
libc/include/limits.h.def
libc/include/llvm-libc-macros/limits-macros.h
################################################################################
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 9201d271c41372..aaa75a9dd08cbd 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -6,7 +6,6 @@ set(TARGET_PUBLIC_HEADERS
libc.include.fcntl
libc.include.fenv
libc.include.inttypes
- libc.include.limits
libc.include.math
libc.include.pthread
libc.include.sched
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 6da512d6272171..ab04b8d2e5ca8c 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -66,15 +66,6 @@ add_gen_header(
.llvm-libc-types.imaxdiv_t
)
-add_gen_header(
- limits
- DEF_FILE limits.h.def
- GEN_HDR limits.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.limits_macros
-)
-
add_gen_header(
math
DEF_FILE math.h.def
diff --git a/libc/include/limits.h.def b/libc/include/limits.h.def
deleted file mode 100644
index 56415377a15ba9..00000000000000
--- a/libc/include/limits.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header limits.h ---------------------------------===//
-//
-// 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_LIMITS_H
-#define LLVM_LIBC_LIMITS_H
-
-#include <__llvm-libc-common.h>
-#include <llvm-libc-macros/limits-macros.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_LIMITS_H
diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt
index 323fa3866e602e..58bbf5e2e43171 100644
--- a/libc/include/llvm-libc-macros/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/CMakeLists.txt
@@ -172,9 +172,3 @@ add_header(
HDR
wchar-macros.h
)
-
-add_header(
- limits_macros
- HDR
- limits-macros.h
-)
diff --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
deleted file mode 100644
index 7179d3963c7383..00000000000000
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __LLVM_LIBC_MACROS_LIMITS_MACROS_H
-#define __LLVM_LIBC_MACROS_LIMITS_MACROS_H
-
-// Normally compiler headers will be prefered over LLVM-libc headers and
-// include_next this header, however, during LLVM-libc build itself the
-// LLVM-libc headers are prefered, and to get C numerical limits we need to
-// include compiler (freestanding) limits.h. The macro checks are here to avoid
-// including limits.h when compiler headers have already been included.
-
-#if !defined _GCC_LIMITS_H_ && !defined __CLANG_LIMITS_H && \
- __has_include_next(<limits.h>)
-#include_next <limits.h>
-#endif
-
-#ifdef __linux__
-#include <linux/limits.h>
-#endif
-
-#ifndef SSIZE_MAX
-#define SSIZE_MAX __LONG_MAX__
-#endif
-
-#endif // __LLVM_LIBC_MACROS_LIMITS_MACROS_H
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index 53146530b102b5..d09c7228549dfc 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -225,16 +225,6 @@ def POSIX : StandardSpec<"POSIX"> {
]
>;
- HeaderSpec Limits = HeaderSpec<
- "limits.h",
- [
- Macro<"SSIZE_MAX">,
- ],
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
HeaderSpec SysMMan = HeaderSpec<
"sys/mman.h",
[
@@ -1405,7 +1395,6 @@ def POSIX : StandardSpec<"POSIX"> {
Dirent,
Errno,
FCntl,
- Limits,
PThread,
Sched,
Signal,
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index f012e112ee5dc7..96668ccb5558b5 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -821,16 +821,6 @@ def StdC : StandardSpec<"stdc"> {
]
>;
- HeaderSpec Limits = HeaderSpec<
- "limits.h",
- [
- Macro<"LONG_MAX">,
- ],
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
HeaderSpec Errno = HeaderSpec<
"errno.h",
[
@@ -1148,7 +1138,6 @@ def StdC : StandardSpec<"stdc"> {
StdIO,
StdLib,
IntTypes,
- Limits,
SetJmp,
Signal,
Threads,
More information about the libc-commits
mailing list