[libc-commits] [libc] 1d7d005 - [libc] move src/network to src/arpa/inet (#119273)
via libc-commits
libc-commits at lists.llvm.org
Tue Dec 10 08:59:42 PST 2024
Author: Nick Desaulniers
Date: 2024-12-10T08:59:39-08:00
New Revision: 1d7d0051f95811f42b2c1886455dfc0f70e1e4aa
URL: https://github.com/llvm/llvm-project/commit/1d7d0051f95811f42b2c1886455dfc0f70e1e4aa
DIFF: https://github.com/llvm/llvm-project/commit/1d7d0051f95811f42b2c1886455dfc0f70e1e4aa.diff
LOG: [libc] move src/network to src/arpa/inet (#119273)
So that docgen can find our implementations.
Fixes: #119272
Added:
libc/src/arpa/CMakeLists.txt
libc/src/arpa/inet/CMakeLists.txt
libc/src/arpa/inet/htonl.cpp
libc/src/arpa/inet/htonl.h
libc/src/arpa/inet/htons.cpp
libc/src/arpa/inet/htons.h
libc/src/arpa/inet/ntohl.cpp
libc/src/arpa/inet/ntohl.h
libc/src/arpa/inet/ntohs.cpp
libc/src/arpa/inet/ntohs.h
libc/test/src/arpa/CMakeLists.txt
libc/test/src/arpa/inet/CMakeLists.txt
libc/test/src/arpa/inet/htonl_test.cpp
libc/test/src/arpa/inet/htons_test.cpp
libc/test/src/arpa/inet/ntohl_test.cpp
libc/test/src/arpa/inet/ntohs_test.cpp
Modified:
libc/config/linux/aarch64/entrypoints.txt
libc/config/linux/riscv/entrypoints.txt
libc/config/linux/x86_64/entrypoints.txt
libc/src/CMakeLists.txt
libc/test/src/CMakeLists.txt
Removed:
libc/src/network/CMakeLists.txt
libc/src/network/htonl.cpp
libc/src/network/htonl.h
libc/src/network/htons.cpp
libc/src/network/htons.h
libc/src/network/ntohl.cpp
libc/src/network/ntohl.h
libc/src/network/ntohs.cpp
libc/src/network/ntohs.h
libc/test/src/network/CMakeLists.txt
libc/test/src/network/htonl_test.cpp
libc/test/src/network/htons_test.cpp
libc/test/src/network/ntohl_test.cpp
libc/test/src/network/ntohs_test.cpp
################################################################################
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index f7e08548de5fa1..c2179938b40d18 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -811,11 +811,11 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.dirent.opendir
libc.src.dirent.readdir
- # network.h entrypoints
- libc.src.network.htonl
- libc.src.network.htons
- libc.src.network.ntohl
- libc.src.network.ntohs
+ # arpa/inet.h entrypoints
+ libc.src.arpa.inet.htonl
+ libc.src.arpa.inet.htons
+ libc.src.arpa.inet.ntohl
+ libc.src.arpa.inet.ntohs
# pthread.h entrypoints
libc.src.pthread.pthread_atfork
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 5d9e1fee13adf3..8c68797edfae90 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -752,11 +752,11 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.dirent.opendir
libc.src.dirent.readdir
- # network.h entrypoints
- libc.src.network.htonl
- libc.src.network.htons
- libc.src.network.ntohl
- libc.src.network.ntohs
+ # arpa/inet.h entrypoints
+ libc.src.arpa.inet.htonl
+ libc.src.arpa.inet.htons
+ libc.src.arpa.inet.ntohl
+ libc.src.arpa.inet.ntohs
# pthread.h entrypoints
libc.src.pthread.pthread_atfork
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index c6162ac217a69f..68d0501d3d3587 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -895,11 +895,11 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.dirent.opendir
libc.src.dirent.readdir
- # network.h entrypoints
- libc.src.network.htonl
- libc.src.network.htons
- libc.src.network.ntohl
- libc.src.network.ntohs
+ # arpa/inet.h entrypoints
+ libc.src.arpa.inet.htonl
+ libc.src.arpa.inet.htons
+ libc.src.arpa.inet.ntohl
+ libc.src.arpa.inet.ntohs
# pthread.h entrypoints
libc.src.pthread.pthread_atfork
diff --git a/libc/src/CMakeLists.txt b/libc/src/CMakeLists.txt
index 8dad08b9fbfd0f..9fc331ad18a391 100644
--- a/libc/src/CMakeLists.txt
+++ b/libc/src/CMakeLists.txt
@@ -34,12 +34,12 @@ if(NOT LLVM_LIBC_FULL_BUILD)
return()
endif()
+add_subdirectory(arpa)
add_subdirectory(assert)
add_subdirectory(compiler)
-add_subdirectory(network)
+add_subdirectory(locale)
add_subdirectory(search)
add_subdirectory(setjmp)
add_subdirectory(signal)
add_subdirectory(spawn)
add_subdirectory(threads)
-add_subdirectory(locale)
diff --git a/libc/src/arpa/CMakeLists.txt b/libc/src/arpa/CMakeLists.txt
new file mode 100644
index 00000000000000..5c89828860ff87
--- /dev/null
+++ b/libc/src/arpa/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(inet)
diff --git a/libc/src/network/CMakeLists.txt b/libc/src/arpa/inet/CMakeLists.txt
similarity index 100%
rename from libc/src/network/CMakeLists.txt
rename to libc/src/arpa/inet/CMakeLists.txt
diff --git a/libc/src/network/htonl.cpp b/libc/src/arpa/inet/htonl.cpp
similarity index 95%
rename from libc/src/network/htonl.cpp
rename to libc/src/arpa/inet/htonl.cpp
index 681786adea68a7..fb0404a26a2446 100644
--- a/libc/src/network/htonl.cpp
+++ b/libc/src/arpa/inet/htonl.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/network/htonl.h"
+#include "src/arpa/inet/htonl.h"
#include "src/__support/common.h"
#include "src/__support/endian_internal.h"
#include "src/__support/macros/config.h"
diff --git a/libc/src/network/htonl.h b/libc/src/arpa/inet/htonl.h
similarity index 81%
rename from libc/src/network/htonl.h
rename to libc/src/arpa/inet/htonl.h
index 14217310a2271d..e444972c771ea2 100644
--- a/libc/src/network/htonl.h
+++ b/libc/src/arpa/inet/htonl.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_NETWORK_HTONL_H
-#define LLVM_LIBC_SRC_NETWORK_HTONL_H
+#ifndef LLVM_LIBC_SRC_ARPA_INET_HTONL_H
+#define LLVM_LIBC_SRC_ARPA_INET_HTONL_H
#include "src/__support/macros/config.h"
#include <stdint.h>
@@ -18,4 +18,4 @@ uint32_t htonl(uint32_t hostlong);
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC_NETWORK_HTONL_H
+#endif // LLVM_LIBC_SRC_ARPA_INET_HTONL_H
diff --git a/libc/src/network/htons.cpp b/libc/src/arpa/inet/htons.cpp
similarity index 95%
rename from libc/src/network/htons.cpp
rename to libc/src/arpa/inet/htons.cpp
index 675f53cf4a0ad6..1fcbbdf67deb01 100644
--- a/libc/src/network/htons.cpp
+++ b/libc/src/arpa/inet/htons.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/network/htons.h"
+#include "src/arpa/inet/htons.h"
#include "src/__support/common.h"
#include "src/__support/endian_internal.h"
#include "src/__support/macros/config.h"
diff --git a/libc/src/network/htons.h b/libc/src/arpa/inet/htons.h
similarity index 81%
rename from libc/src/network/htons.h
rename to libc/src/arpa/inet/htons.h
index 8f5c68a0a60a88..35c2acdcfae452 100644
--- a/libc/src/network/htons.h
+++ b/libc/src/arpa/inet/htons.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_NETWORK_HTONS_H
-#define LLVM_LIBC_SRC_NETWORK_HTONS_H
+#ifndef LLVM_LIBC_SRC_ARPA_INET_HTONS_H
+#define LLVM_LIBC_SRC_ARPA_INET_HTONS_H
#include "src/__support/macros/config.h"
#include <stdint.h>
@@ -18,4 +18,4 @@ uint16_t htons(uint16_t hostshort);
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC_NETWORK_HTONS_H
+#endif // LLVM_LIBC_SRC_ARPA_INET_HTONS_H
diff --git a/libc/src/network/ntohl.cpp b/libc/src/arpa/inet/ntohl.cpp
similarity index 95%
rename from libc/src/network/ntohl.cpp
rename to libc/src/arpa/inet/ntohl.cpp
index 6a309e97fca79b..d472107a1988cd 100644
--- a/libc/src/network/ntohl.cpp
+++ b/libc/src/arpa/inet/ntohl.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/network/ntohl.h"
+#include "src/arpa/inet/ntohl.h"
#include "src/__support/common.h"
#include "src/__support/endian_internal.h"
#include "src/__support/macros/config.h"
diff --git a/libc/src/network/ntohl.h b/libc/src/arpa/inet/ntohl.h
similarity index 81%
rename from libc/src/network/ntohl.h
rename to libc/src/arpa/inet/ntohl.h
index c325951948062a..40079650d6fd1f 100644
--- a/libc/src/network/ntohl.h
+++ b/libc/src/arpa/inet/ntohl.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_NETWORK_NTOHL_H
-#define LLVM_LIBC_SRC_NETWORK_NTOHL_H
+#ifndef LLVM_LIBC_SRC_ARPA_INET_NTOHL_H
+#define LLVM_LIBC_SRC_ARPA_INET_NTOHL_H
#include "src/__support/macros/config.h"
#include <stdint.h>
@@ -18,4 +18,4 @@ uint32_t ntohl(uint32_t netlong);
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC_NETWORK_NTOHL_H
+#endif // LLVM_LIBC_SRC_ARPA_INET_NTOHL_H
diff --git a/libc/src/network/ntohs.cpp b/libc/src/arpa/inet/ntohs.cpp
similarity index 95%
rename from libc/src/network/ntohs.cpp
rename to libc/src/arpa/inet/ntohs.cpp
index b51ecb93241cac..9082ed928778eb 100644
--- a/libc/src/network/ntohs.cpp
+++ b/libc/src/arpa/inet/ntohs.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/network/ntohs.h"
+#include "src/arpa/inet/ntohs.h"
#include "src/__support/common.h"
#include "src/__support/endian_internal.h"
#include "src/__support/macros/config.h"
diff --git a/libc/src/network/ntohs.h b/libc/src/arpa/inet/ntohs.h
similarity index 81%
rename from libc/src/network/ntohs.h
rename to libc/src/arpa/inet/ntohs.h
index f55591415f764c..5fe3ebcb62520c 100644
--- a/libc/src/network/ntohs.h
+++ b/libc/src/arpa/inet/ntohs.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_NETWORK_NTOHS_H
-#define LLVM_LIBC_SRC_NETWORK_NTOHS_H
+#ifndef LLVM_LIBC_SRC_ARPA_INET_NTOHS_H
+#define LLVM_LIBC_SRC_ARPA_INET_NTOHS_H
#include "src/__support/macros/config.h"
#include <stdint.h>
@@ -18,4 +18,4 @@ uint16_t ntohs(uint16_t netshort);
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC_NETWORK_NTOHS_H
+#endif // LLVM_LIBC_SRC_ARPA_INET_NTOHS_H
diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index 8e3db0825a51ad..31008508d64928 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -77,14 +77,14 @@ if(NOT LLVM_LIBC_FULL_BUILD)
return()
endif()
+add_subdirectory(arpa)
add_subdirectory(assert)
add_subdirectory(compiler)
add_subdirectory(dirent)
-add_subdirectory(network)
+add_subdirectory(locale)
add_subdirectory(setjmp)
add_subdirectory(signal)
add_subdirectory(spawn)
-add_subdirectory(locale)
if(${LIBC_TARGET_OS} STREQUAL "linux")
add_subdirectory(pthread)
diff --git a/libc/test/src/arpa/CMakeLists.txt b/libc/test/src/arpa/CMakeLists.txt
new file mode 100644
index 00000000000000..5c89828860ff87
--- /dev/null
+++ b/libc/test/src/arpa/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(inet)
diff --git a/libc/test/src/arpa/inet/CMakeLists.txt b/libc/test/src/arpa/inet/CMakeLists.txt
new file mode 100644
index 00000000000000..6e78e3a50e6122
--- /dev/null
+++ b/libc/test/src/arpa/inet/CMakeLists.txt
@@ -0,0 +1,53 @@
+add_custom_target(libc_arpa_inet_unittests)
+
+add_libc_unittest(
+ htonl
+ SUITE
+ libc_arpa_inet_unittests
+ SRCS
+ htonl_test.cpp
+ CXX_STANDARD
+ 20
+ DEPENDS
+ libc.src.arpa.inet.htonl
+ libc.src.arpa.inet.ntohl
+)
+
+add_libc_unittest(
+ htons
+ SUITE
+ libc_arpa_inet_unittests
+ SRCS
+ htons_test.cpp
+ CXX_STANDARD
+ 20
+ DEPENDS
+ libc.src.arpa.inet.htons
+ libc.src.arpa.inet.ntohs
+)
+
+add_libc_unittest(
+ ntohl
+ SUITE
+ libc_arpa_inet_unittests
+ SRCS
+ ntohl_test.cpp
+ CXX_STANDARD
+ 20
+ DEPENDS
+ libc.src.arpa.inet.htonl
+ libc.src.arpa.inet.ntohl
+)
+
+add_libc_unittest(
+ ntohs
+ SUITE
+ libc_arpa_inet_unittests
+ SRCS
+ ntohs_test.cpp
+ CXX_STANDARD
+ 20
+ DEPENDS
+ libc.src.arpa.inet.htons
+ libc.src.arpa.inet.ntohs
+)
diff --git a/libc/test/src/network/htonl_test.cpp b/libc/test/src/arpa/inet/htonl_test.cpp
similarity index 93%
rename from libc/test/src/network/htonl_test.cpp
rename to libc/test/src/arpa/inet/htonl_test.cpp
index f2e2541312c31a..4cc1e4cb4e8862 100644
--- a/libc/test/src/network/htonl_test.cpp
+++ b/libc/test/src/arpa/inet/htonl_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/__support/endian_internal.h"
-#include "src/network/htonl.h"
-#include "src/network/ntohl.h"
+#include "src/arpa/inet/htonl.h"
+#include "src/arpa/inet/ntohl.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcHtonl, SmokeTest) {
diff --git a/libc/test/src/network/htons_test.cpp b/libc/test/src/arpa/inet/htons_test.cpp
similarity index 93%
rename from libc/test/src/network/htons_test.cpp
rename to libc/test/src/arpa/inet/htons_test.cpp
index 9668162523ce5d..6a95ec5587e953 100644
--- a/libc/test/src/network/htons_test.cpp
+++ b/libc/test/src/arpa/inet/htons_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/__support/endian_internal.h"
-#include "src/network/htons.h"
-#include "src/network/ntohs.h"
+#include "src/arpa/inet/htons.h"
+#include "src/arpa/inet/ntohs.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcHtons, SmokeTest) {
diff --git a/libc/test/src/network/ntohl_test.cpp b/libc/test/src/arpa/inet/ntohl_test.cpp
similarity index 93%
rename from libc/test/src/network/ntohl_test.cpp
rename to libc/test/src/arpa/inet/ntohl_test.cpp
index b72456b7200e58..42562486d5c00b 100644
--- a/libc/test/src/network/ntohl_test.cpp
+++ b/libc/test/src/arpa/inet/ntohl_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/__support/endian_internal.h"
-#include "src/network/htonl.h"
-#include "src/network/ntohl.h"
+#include "src/arpa/inet/htonl.h"
+#include "src/arpa/inet/ntohl.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcNtohl, SmokeTest) {
diff --git a/libc/test/src/network/ntohs_test.cpp b/libc/test/src/arpa/inet/ntohs_test.cpp
similarity index 93%
rename from libc/test/src/network/ntohs_test.cpp
rename to libc/test/src/arpa/inet/ntohs_test.cpp
index 1104356076b94b..38b2c8d8fe40f9 100644
--- a/libc/test/src/network/ntohs_test.cpp
+++ b/libc/test/src/arpa/inet/ntohs_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/__support/endian_internal.h"
-#include "src/network/htons.h"
-#include "src/network/ntohs.h"
+#include "src/arpa/inet/htons.h"
+#include "src/arpa/inet/ntohs.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcNtohs, SmokeTest) {
diff --git a/libc/test/src/network/CMakeLists.txt b/libc/test/src/network/CMakeLists.txt
deleted file mode 100644
index 222205dfe247a6..00000000000000
--- a/libc/test/src/network/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-add_custom_target(libc_network_unittests)
-
-add_libc_unittest(
- htonl
- SUITE
- libc_network_unittests
- SRCS
- htonl_test.cpp
- CXX_STANDARD
- 20
- DEPENDS
- libc.src.network.htonl
- libc.src.network.ntohl
-)
-
-add_libc_unittest(
- htons
- SUITE
- libc_network_unittests
- SRCS
- htons_test.cpp
- CXX_STANDARD
- 20
- DEPENDS
- libc.src.network.htons
- libc.src.network.ntohs
-)
-
-add_libc_unittest(
- ntohl
- SUITE
- libc_network_unittests
- SRCS
- ntohl_test.cpp
- CXX_STANDARD
- 20
- DEPENDS
- libc.src.network.htonl
- libc.src.network.ntohl
-)
-
-add_libc_unittest(
- ntohs
- SUITE
- libc_network_unittests
- SRCS
- ntohs_test.cpp
- CXX_STANDARD
- 20
- DEPENDS
- libc.src.network.htons
- libc.src.network.ntohs
-)
More information about the libc-commits
mailing list