File tree Expand file tree Collapse file tree 7 files changed +85
-0
lines changed Expand file tree Collapse file tree 7 files changed +85
-0
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,14 @@ add_header_macro(
191191 .inttypes
192192)
193193
194+ add_header_macro(
195+ netinet_in
196+ ../libc/include /netinet/in.yaml
197+ netinet/in.h
198+ DEPENDS
199+ .llvm-libc-macros .netinet_in_macros
200+ )
201+
194202add_header_macro(
195203 assert
196204 ../libc/include /assert.yaml
Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ add_macro_header(
152152 .math_macros
153153)
154154
155+ add_macro_header(
156+ netinet_in_macros
157+ HDR
158+ netinet-in-macros .h
159+ )
160+
155161add_macro_header(
156162 offsetof_macro
157163 HDR
Original file line number Diff line number Diff line change 1+ //===-- Definition of macros from netinet/in.h ----------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ //===----------------------------------------------------------------------===//
8+
9+ #ifndef LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
10+ #define LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
11+
12+ #define IPPROTO_IP 0
13+ #define IPPROTO_ICMP 1
14+ #define IPPROTO_TCP 6
15+ #define IPPROTO_UDP 17
16+ #define IPPROTO_IPV6 41
17+ #define IPPROTO_RAW 255
18+
19+ #endif // LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
Original file line number Diff line number Diff line change 1+ //===-- C standard library header in.h ------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ //===----------------------------------------------------------------------===//
8+
9+ #ifndef LLVM_LIBC_NETINET_IN_H
10+ #define LLVM_LIBC_NETINET_IN_H
11+
12+ #include "../llvm-libc-macros/netinet-in-macros.h"
13+
14+ %%public_api()
15+
16+ #endif // LLVM_LIBC_NETINET_IN_H
Original file line number Diff line number Diff line change 1+ header : netinet/in.h
2+ header_template : in.h.def
3+ macros : []
4+ types : []
5+ enums : []
6+ objects : []
7+ functions : []
Original file line number Diff line number Diff line change @@ -207,6 +207,16 @@ add_libc_test(
207207 libc.include .llvm-libc-macros .math_function_macros
208208)
209209
210+ add_libc_test(
211+ netinet_in_test
212+ SUITE
213+ libc_include_tests
214+ SRCS
215+ netinet_in_test.cpp
216+ DEPENDS
217+ libc.include .llvm-libc-macros .netinet_in_macros
218+ )
219+
210220add_libc_test(
211221 signbit_test
212222 SUITE
Original file line number Diff line number Diff line change 1+ // ===-- Unittests for netinet/in macro ------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " include/llvm-libc-macros/netinet-in-macros.h"
10+ #include " test/UnitTest/Test.h"
11+
12+ TEST (LlvmLibcNetinetInTest, IPPROTOMacro) {
13+ EXPECT_EQ (IPPROTO_IP, 0 );
14+ EXPECT_EQ (IPPROTO_ICMP, 1 );
15+ EXPECT_EQ (IPPROTO_TCP, 6 );
16+ EXPECT_EQ (IPPROTO_UDP, 17 );
17+ EXPECT_EQ (IPPROTO_IPV6, 41 );
18+ EXPECT_EQ (IPPROTO_RAW, 255 );
19+ }
You can’t perform that action at this time.
0 commit comments