[libc-commits] [libc] [libc] Implement fgetpos/fsetpos (PR #221349)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Oct 9 04:04:03 PDT 2026
================
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// Implementation of fgetpos
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/stdio/fgetpos.h"
+#include "hdr/types/FILE.h"
+#include "hdr/types/fpos_t.h"
+#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
+#include "src/string/memory_utils/inline_memcpy.h"
+#include "src/string/memory_utils/inline_memset.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+static_assert(sizeof(mbstate_t) >= sizeof(internal::mbstate),
+ "mbstate_t is too small for internal::mbstate");
+static_assert(alignof(mbstate_t) >= alignof(internal::mbstate),
+ "mbstate_t has insufficient alignment for internal::mbstate");
----------------
kaladron wrote:
Given the memcpy below, we may want a static_assert about trivial copying here for internal::mbstate
https://github.com/llvm/llvm-project/pull/221349
More information about the libc-commits
mailing list