[libc-commits] [libc] [libc] Add netinet/udp.h containing struct udphdr (PR #200839)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Mon Jun 1 08:04:17 PDT 2026


================
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Unittests for netinet/udp.
+///
+//===----------------------------------------------------------------------===//
+
+#include "hdr/types/struct_udphdr.h"
+#include "src/arpa/inet/htons.h"
+#include "src/string/memcmp.h"
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibcNetinetUdpTest, StructUdphdrLayout) {
+  EXPECT_EQ(sizeof(struct udphdr), size_t(8));
----------------
kaladron wrote:

Does this need the cast?  If yes, it should be a static_cast rather than a C-style.

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


More information about the libc-commits mailing list