[libc-commits] [libc] [libc] Remove the <string.h> header in libc/src and libc/test (PR #113076)
Job Henandez Lara via libc-commits
libc-commits at lists.llvm.org
Sat Oct 19 22:20:55 PDT 2024
https://github.com/Jobhdez updated https://github.com/llvm/llvm-project/pull/113076
>From 026c90cc8ce5379a172d82e8fa8bd47e205dec8b Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Sat, 19 Oct 2024 21:59:40 -0700
Subject: [PATCH 1/4] remove <string.h>
---
libc/hdr/CMakeLists.txt | 14 ++++++++++++++
libc/src/string/CMakeLists.txt | 10 +++++++---
libc/src/string/strcat.h | 2 +-
libc/src/string/strcpy.h | 2 +-
libc/src/string/strdup.h | 2 +-
libc/src/string/strlcat.h | 2 +-
libc/src/string/strlcpy.h | 2 +-
libc/src/string/strlen.h | 2 +-
libc/src/string/strncat.h | 2 +-
libc/src/string/strndup.h | 2 +-
10 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 13dc892978bb87..840dc50fd351b9 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -50,6 +50,7 @@ add_proxy_header_library(
libc.include.llvm-libc-macros.error_number_macros
libc.include.llvm-libc-macros.generic_error_number_macros
)
+
add_proxy_header_library(
fcntl_macros
@@ -92,6 +93,19 @@ add_proxy_header_library(
libc.include.llvm-libc-macros.file_seek_macros
)
+add_header_library(string_overlay HDRS string_overlay.h)
+
+add_proxy_header_library(
+ string_macros
+ HDRS
+ string_macros.h
+ DEPENDS
+ .string_overlay
+ FULL_BUILD_DEPENDS
+ libc.include.string
+ libc.include.llvm-libc-macros.null_macro
+)
+
add_proxy_header_library(
sys_epoll_macros
HDRS
diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt
index 787188ab3beb91..b33cbc5358d60d 100644
--- a/libc/src/string/CMakeLists.txt
+++ b/libc/src/string/CMakeLists.txt
@@ -138,6 +138,7 @@ add_entrypoint_object(
DEPENDS
.strcpy
.string_utils
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -240,6 +241,7 @@ add_entrypoint_object(
.string_utils
libc.include.stdlib
libc.src.errno.errno
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -270,7 +272,7 @@ add_entrypoint_object(
strlcat.h
DEPENDS
.string_utils
- libc.include.string
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -281,7 +283,7 @@ add_entrypoint_object(
strlcpy.h
DEPENDS
.string_utils
- libc.include.string
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -292,7 +294,7 @@ add_entrypoint_object(
strlen.h
DEPENDS
.string_utils
- libc.include.string
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -304,6 +306,7 @@ add_entrypoint_object(
DEPENDS
.strncpy
.string_utils
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
@@ -346,6 +349,7 @@ add_entrypoint_object(
.string_utils
libc.include.stdlib
libc.src.__support.CPP.new
+ libc.include.llvm-libc-types.size_t
)
add_entrypoint_object(
diff --git a/libc/src/string/strcat.h b/libc/src/string/strcat.h
index 90a7fd2e41337e..48a9b1fe0f5824 100644
--- a/libc/src/string/strcat.h
+++ b/libc/src/string/strcat.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRCAT_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strcpy.h b/libc/src/string/strcpy.h
index d4f3e81fdc733a..485393a1f971f9 100644
--- a/libc/src/string/strcpy.h
+++ b/libc/src/string/strcpy.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRCPY_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h
index 45303a3efeb493..d295b0357e31f2 100644
--- a/libc/src/string/strdup.h
+++ b/libc/src/string/strdup.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRDUP_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlcat.h b/libc/src/string/strlcat.h
index ffe97af62a543c..b34ef8482e6355 100644
--- a/libc/src/string/strlcat.h
+++ b/libc/src/string/strlcat.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRLCAT_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlcpy.h b/libc/src/string/strlcpy.h
index 058e7653b1b91f..2a62f58cc67123 100644
--- a/libc/src/string/strlcpy.h
+++ b/libc/src/string/strlcpy.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRLCPY_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlen.h b/libc/src/string/strlen.h
index f07bf73ace3de6..67ef1eba2ffcf9 100644
--- a/libc/src/string/strlen.h
+++ b/libc/src/string/strlen.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRLEN_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strncat.h b/libc/src/string/strncat.h
index 1a130799f39658..966f922604448f 100644
--- a/libc/src/string/strncat.h
+++ b/libc/src/string/strncat.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRNCAT_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h
index 03370cc8d7dce1..2b317ef4574e18 100644
--- a/libc/src/string/strndup.h
+++ b/libc/src/string/strndup.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC_STRING_STRNDUP_H
#include "src/__support/macros/config.h"
-#include <string.h>
+#include "include/llvm-libc-types/size_t.h"
namespace LIBC_NAMESPACE_DECL {
>From 9c15f51e7925f994f3811f1afaa72662b9f04108 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Sat, 19 Oct 2024 22:00:02 -0700
Subject: [PATCH 2/4] format code
---
libc/src/string/strcat.h | 2 +-
libc/src/string/strcpy.h | 2 +-
libc/src/string/strdup.h | 2 +-
libc/src/string/strlcat.h | 2 +-
libc/src/string/strlcpy.h | 2 +-
libc/src/string/strlen.h | 2 +-
libc/src/string/strncat.h | 2 +-
libc/src/string/strndup.h | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libc/src/string/strcat.h b/libc/src/string/strcat.h
index 48a9b1fe0f5824..82860196ce29a2 100644
--- a/libc/src/string/strcat.h
+++ b/libc/src/string/strcat.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCAT_H
#define LLVM_LIBC_SRC_STRING_STRCAT_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strcpy.h b/libc/src/string/strcpy.h
index 485393a1f971f9..9e0c3dbc39ef90 100644
--- a/libc/src/string/strcpy.h
+++ b/libc/src/string/strcpy.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCPY_H
#define LLVM_LIBC_SRC_STRING_STRCPY_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h
index d295b0357e31f2..2744e53d45d475 100644
--- a/libc/src/string/strdup.h
+++ b/libc/src/string/strdup.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRDUP_H
#define LLVM_LIBC_SRC_STRING_STRDUP_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlcat.h b/libc/src/string/strlcat.h
index b34ef8482e6355..9dc8f3a3bc0d18 100644
--- a/libc/src/string/strlcat.h
+++ b/libc/src/string/strlcat.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRLCAT_H
#define LLVM_LIBC_SRC_STRING_STRLCAT_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlcpy.h b/libc/src/string/strlcpy.h
index 2a62f58cc67123..45b2c2a2ec26b4 100644
--- a/libc/src/string/strlcpy.h
+++ b/libc/src/string/strlcpy.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRLCPY_H
#define LLVM_LIBC_SRC_STRING_STRLCPY_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strlen.h b/libc/src/string/strlen.h
index 67ef1eba2ffcf9..093edcf479bcf2 100644
--- a/libc/src/string/strlen.h
+++ b/libc/src/string/strlen.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRLEN_H
#define LLVM_LIBC_SRC_STRING_STRLEN_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strncat.h b/libc/src/string/strncat.h
index 966f922604448f..f37d9a7bc1544a 100644
--- a/libc/src/string/strncat.h
+++ b/libc/src/string/strncat.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRNCAT_H
#define LLVM_LIBC_SRC_STRING_STRNCAT_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h
index 2b317ef4574e18..78cde7b33e13b1 100644
--- a/libc/src/string/strndup.h
+++ b/libc/src/string/strndup.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_STRING_STRNDUP_H
#define LLVM_LIBC_SRC_STRING_STRNDUP_H
-#include "src/__support/macros/config.h"
#include "include/llvm-libc-types/size_t.h"
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
>From 6b34e5b8f30b1605a6ca3d99a7d7573db9edc661 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Sat, 19 Oct 2024 22:16:25 -0700
Subject: [PATCH 3/4] address review
---
libc/hdr/CMakeLists.txt | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 840dc50fd351b9..494d2152ae28ff 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -93,19 +93,6 @@ add_proxy_header_library(
libc.include.llvm-libc-macros.file_seek_macros
)
-add_header_library(string_overlay HDRS string_overlay.h)
-
-add_proxy_header_library(
- string_macros
- HDRS
- string_macros.h
- DEPENDS
- .string_overlay
- FULL_BUILD_DEPENDS
- libc.include.string
- libc.include.llvm-libc-macros.null_macro
-)
-
add_proxy_header_library(
sys_epoll_macros
HDRS
>From 9a9ad9a3dcd4f2241d664e7ca136c4e39fabf9a8 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Sat, 19 Oct 2024 22:20:38 -0700
Subject: [PATCH 4/4] get original file
---
libc/hdr/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 494d2152ae28ff..13dc892978bb87 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -50,7 +50,6 @@ add_proxy_header_library(
libc.include.llvm-libc-macros.error_number_macros
libc.include.llvm-libc-macros.generic_error_number_macros
)
-
add_proxy_header_library(
fcntl_macros
More information about the libc-commits
mailing list