xref: /llvm-project/libc/src/stdio/baremetal/putchar.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
19a1611f9SMichael Jones //===-- Baremetal Implementation of putchar -------------------------------===//
29a1611f9SMichael Jones //
39a1611f9SMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
49a1611f9SMichael Jones // See https://llvm.org/LICENSE.txt for license information.
59a1611f9SMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
69a1611f9SMichael Jones //
79a1611f9SMichael Jones //===----------------------------------------------------------------------===//
89a1611f9SMichael Jones 
99a1611f9SMichael Jones #include "src/stdio/putchar.h"
109a1611f9SMichael Jones #include "src/__support/CPP/string_view.h"
119a1611f9SMichael Jones #include "src/__support/OSUtil/io.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
139a1611f9SMichael Jones 
14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
159a1611f9SMichael Jones 
169a1611f9SMichael Jones LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
179a1611f9SMichael Jones   char uc = static_cast<char>(c);
189a1611f9SMichael Jones 
199a1611f9SMichael Jones   write_to_stderr(cpp::string_view(&uc, 1));
209a1611f9SMichael Jones 
219a1611f9SMichael Jones   return 0;
229a1611f9SMichael Jones }
239a1611f9SMichael Jones 
24*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
25