xref: /llvm-project/libc/src/stdio/baremetal/puts.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1f3fe14faSPetr Hosek //===-- Implementation of puts for baremetal-------------------------------===//
2f3fe14faSPetr Hosek //
3f3fe14faSPetr Hosek // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4f3fe14faSPetr Hosek // See https://llvm.org/LICENSE.txt for license information.
5f3fe14faSPetr Hosek // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6f3fe14faSPetr Hosek //
7f3fe14faSPetr Hosek //===----------------------------------------------------------------------===//
8f3fe14faSPetr Hosek 
9f3fe14faSPetr Hosek #include "src/stdio/puts.h"
10f3fe14faSPetr Hosek #include "src/__support/CPP/string_view.h"
11f3fe14faSPetr Hosek #include "src/__support/OSUtil/io.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
13f3fe14faSPetr Hosek 
14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
15f3fe14faSPetr Hosek 
16f3fe14faSPetr Hosek LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
17f3fe14faSPetr Hosek   cpp::string_view str_view(str);
18f3fe14faSPetr Hosek 
19f3fe14faSPetr Hosek   // TODO: Can we combine these to avoid needing two writes?
20f3fe14faSPetr Hosek   write_to_stderr(str_view);
21f3fe14faSPetr Hosek   write_to_stderr("\n");
22f3fe14faSPetr Hosek 
23f3fe14faSPetr Hosek   return 0;
24f3fe14faSPetr Hosek }
25f3fe14faSPetr Hosek 
26*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
27