xref: /llvm-project/libc/src/stdio/gpu/fprintf.cpp (revision 03dcefe08ecb68a3fedb7e9de6277df77371e9fc)
140effc7aSJoseph Huber //===-- GPU Implementation of fprintf -------------------------------------===//
240effc7aSJoseph Huber //
340effc7aSJoseph Huber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
440effc7aSJoseph Huber // See https://llvm.org/LICENSE.txt for license information.
540effc7aSJoseph Huber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
640effc7aSJoseph Huber //
740effc7aSJoseph Huber //===----------------------------------------------------------------------===//
840effc7aSJoseph Huber 
940effc7aSJoseph Huber #include "src/stdio/fprintf.h"
1040effc7aSJoseph Huber 
11c63112a9Slntue #include "hdr/types/FILE.h"
1240effc7aSJoseph Huber #include "src/__support/CPP/string_view.h"
1340effc7aSJoseph Huber #include "src/__support/arg_list.h"
1440effc7aSJoseph Huber #include "src/errno/libc_errno.h"
1540effc7aSJoseph Huber #include "src/stdio/gpu/vfprintf_utils.h"
1640effc7aSJoseph Huber 
17c63112a9Slntue #include <stdarg.h>
1840effc7aSJoseph Huber 
19*03dcefe0SJoseph Huber namespace LIBC_NAMESPACE_DECL {
2040effc7aSJoseph Huber 
2140effc7aSJoseph Huber LLVM_LIBC_FUNCTION(int, fprintf,
2240effc7aSJoseph Huber                    (::FILE *__restrict stream, const char *__restrict format,
2340effc7aSJoseph Huber                     ...)) {
2440effc7aSJoseph Huber   va_list vlist;
2540effc7aSJoseph Huber   va_start(vlist, format);
2640effc7aSJoseph Huber   cpp::string_view str_view(format);
2740effc7aSJoseph Huber   int ret_val = vfprintf_internal(stream, format, str_view.size() + 1, vlist);
2840effc7aSJoseph Huber   va_end(vlist);
2940effc7aSJoseph Huber   return ret_val;
3040effc7aSJoseph Huber }
3140effc7aSJoseph Huber 
32*03dcefe0SJoseph Huber } // namespace LIBC_NAMESPACE_DECL
33