Skip to content

Commit

Permalink
[libc] move src/network to src/arpa/inet
Browse files Browse the repository at this point in the history
So that docgen can find our implementations.

Fixes: #119272
  • Loading branch information
nickdesaulniers committed Dec 9, 2024
1 parent a4e2927 commit 98696c3
Show file tree
Hide file tree
Showing 22 changed files with 98 additions and 96 deletions.
10 changes: 5 additions & 5 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,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
Expand Down
10 changes: 5 additions & 5 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,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
Expand Down
10 changes: 5 additions & 5 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -888,11 +888,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
Expand Down
4 changes: 2 additions & 2 deletions libc/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,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)
1 change: 1 addition & 0 deletions libc/src/arpa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(inet)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/network/htonl.h → libc/src/arpa/inet/htonl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/network/htons.h → libc/src/arpa/inet/htons.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/network/ntohl.h → libc/src/arpa/inet/ntohl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/network/ntohs.h → libc/src/arpa/inet/ntohs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
4 changes: 2 additions & 2 deletions libc/test/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,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)
Expand Down
1 change: 1 addition & 0 deletions libc/test/src/arpa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(inet)
53 changes: 53 additions & 0 deletions libc/test/src/arpa/inet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
53 changes: 0 additions & 53 deletions libc/test/src/network/CMakeLists.txt

This file was deleted.

0 comments on commit 98696c3

Please sign in to comment.