[libc-commits] [libc] [libc] puts implementation for baremetal (PR #98051)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Mon Jul 8 13:50:52 PDT 2024
================
@@ -0,0 +1,25 @@
+//===-- Implementation of puts for baremetal-------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdio/puts.h"
+#include "src/__support/CPP/string_view.h"
+#include "src/__support/OSUtil/io.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
+ cpp::string_view str_view(str);
+
+ // TODO: Can we combine these to avoid needing two writes?
----------------
michaelrj-google wrote:
I don't think it's possible to combine these without `malloc`ing, unfortunately.
https://github.com/llvm/llvm-project/pull/98051
More information about the libc-commits
mailing list