[libc-commits] [libc] [libc] add `in_addr{, _t}` type (PR #162452)
    Connector Switch via libc-commits 
    libc-commits at lists.llvm.org
       
    Wed Oct  8 04:02:00 PDT 2025
    
    
  
https://github.com/c8ef created https://github.com/llvm/llvm-project/pull/162452
These types will be used in `arpa/inet.h` and `netinet/in.h`.
>From 92af9ff2582e3b92603132fa551199cd74181a75 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Wed, 8 Oct 2025 19:00:01 +0800
Subject: [PATCH] [libc] add in_addr{, _t} type
---
 libc/include/llvm-libc-types/CMakeLists.txt |  2 ++
 libc/include/llvm-libc-types/in_addr.h      | 18 ++++++++++++++++++
 libc/include/llvm-libc-types/in_addr_t.h    | 14 ++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 libc/include/llvm-libc-types/in_addr.h
 create mode 100644 libc/include/llvm-libc-types/in_addr_t.h
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 70da983be9090..5f506c4d25c9b 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -39,6 +39,8 @@ add_header(float_t HDR float_t.h)
 add_header(gid_t HDR gid_t.h)
 add_header(uid_t HDR uid_t.h)
 add_header(imaxdiv_t HDR imaxdiv_t.h)
+add_header(in_addr_t HDR in_addr_t.h)
+add_header(in_addr HDR in_addr.h DEPENDS .in_addr_t)
 add_header(ino_t HDR ino_t.h)
 add_header(mbstate_t HDR mbstate_t.h)
 add_header(mode_t HDR mode_t.h)
diff --git a/libc/include/llvm-libc-types/in_addr.h b/libc/include/llvm-libc-types/in_addr.h
new file mode 100644
index 0000000000000..97483c671b8e8
--- /dev/null
+++ b/libc/include/llvm-libc-types/in_addr.h
@@ -0,0 +1,18 @@
+//===-- Definition of in_addr type ----------------------------------------===//
+//
+// 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_TYPES_IN_ADDR_H
+#define LLVM_LIBC_TYPES_IN_ADDR_H
+
+#include "in_addr_t.h"
+
+typedef struct in_addr {
+  in_addr_t s_addr;
+} in_addr;
+
+#endif // LLVM_LIBC_TYPES_IN_ADDR_H
diff --git a/libc/include/llvm-libc-types/in_addr_t.h b/libc/include/llvm-libc-types/in_addr_t.h
new file mode 100644
index 0000000000000..334b073d9ca9c
--- /dev/null
+++ b/libc/include/llvm-libc-types/in_addr_t.h
@@ -0,0 +1,14 @@
+//===-- Definition of in_addr_t type --------------------------------------===//
+//
+// 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_TYPES_IN_ADDR_T_H
+#define LLVM_LIBC_TYPES_IN_ADDR_T_H
+
+typedef __UINT32_TYPE__ in_addr_t;
+
+#endif // LLVM_LIBC_TYPES_IN_ADDR_T_H
    
    
More information about the libc-commits
mailing list