34 lines · cpp
1//===-- GPU Implementation of fprintf -------------------------------------===//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/fprintf.h"10 11#include "hdr/types/FILE.h"12#include "src/__support/CPP/string_view.h"13#include "src/__support/arg_list.h"14#include "src/__support/common.h"15#include "src/__support/libc_errno.h"16#include "src/stdio/gpu/vfprintf_utils.h"17 18#include <stdarg.h>19 20namespace LIBC_NAMESPACE_DECL {21 22LLVM_LIBC_FUNCTION(int, fprintf,23 (::FILE *__restrict stream, const char *__restrict format,24 ...)) {25 va_list vlist;26 va_start(vlist, format);27 cpp::string_view str_view(format);28 int ret_val = vfprintf_internal(stream, format, str_view.size() + 1, vlist);29 va_end(vlist);30 return ret_val;31}32 33} // namespace LIBC_NAMESPACE_DECL34