[libc-commits] [libc] [libc] Remove the <string.h> header in libc/src and libc/test (PR #113076)

via libc-commits libc-commits at lists.llvm.org
Sat Oct 19 22:02:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Job Henandez Lara (Jobhdez)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/113076.diff


10 Files Affected:

- (modified) libc/hdr/CMakeLists.txt (+14) 
- (modified) libc/src/string/CMakeLists.txt (+7-3) 
- (modified) libc/src/string/strcat.h (+1-1) 
- (modified) libc/src/string/strcpy.h (+1-1) 
- (modified) libc/src/string/strdup.h (+1-1) 
- (modified) libc/src/string/strlcat.h (+1-1) 
- (modified) libc/src/string/strlcpy.h (+1-1) 
- (modified) libc/src/string/strlen.h (+1-1) 
- (modified) libc/src/string/strncat.h (+1-1) 
- (modified) libc/src/string/strndup.h (+1-1) 


``````````diff
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..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strcpy.h b/libc/src/string/strcpy.h
index d4f3e81fdc733a..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h
index 45303a3efeb493..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strlcat.h b/libc/src/string/strlcat.h
index ffe97af62a543c..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strlcpy.h b/libc/src/string/strlcpy.h
index 058e7653b1b91f..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strlen.h b/libc/src/string/strlen.h
index f07bf73ace3de6..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strncat.h b/libc/src/string/strncat.h
index 1a130799f39658..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h
index 03370cc8d7dce1..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 "include/llvm-libc-types/size_t.h"
 #include "src/__support/macros/config.h"
-#include <string.h>
 
 namespace LIBC_NAMESPACE_DECL {
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/113076


More information about the libc-commits mailing list