28 lines · cpp
1//===-- GPU Implementation of puts ----------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/stdio/puts.h"10 11#include "hdr/stdio_macros.h" // for EOF and stdout.12#include "src/__support/CPP/string_view.h"13#include "src/__support/common.h"14#include "src/stdio/gpu/file.h"15 16namespace LIBC_NAMESPACE_DECL {17 18LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {19 cpp::string_view str_view(str);20 auto written = file::write_impl<LIBC_WRITE_TO_STDOUT_NEWLINE>(21 stdout, str, str_view.size());22 if (written != str_view.size() + 1)23 return EOF;24 return 0;25}26 27} // namespace LIBC_NAMESPACE_DECL28