140effc7aSJoseph Huber //===-- GPU Implementation of printf --------------------------------------===// 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/printf.h" 1040effc7aSJoseph Huber 1140effc7aSJoseph Huber #include "src/__support/CPP/string_view.h" 1240effc7aSJoseph Huber #include "src/__support/arg_list.h" 1340effc7aSJoseph Huber #include "src/errno/libc_errno.h" 1440effc7aSJoseph Huber #include "src/stdio/gpu/vfprintf_utils.h" 1540effc7aSJoseph Huber 16c63112a9Slntue #include <stdarg.h> 1740effc7aSJoseph Huber 18*03dcefe0SJoseph Huber namespace LIBC_NAMESPACE_DECL { 1940effc7aSJoseph Huber 2040effc7aSJoseph Huber LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) { 2140effc7aSJoseph Huber va_list vlist; 2240effc7aSJoseph Huber va_start(vlist, format); 2340effc7aSJoseph Huber cpp::string_view str_view(format); 2440effc7aSJoseph Huber int ret_val = vfprintf_internal(stdout, format, str_view.size() + 1, vlist); 2540effc7aSJoseph Huber va_end(vlist); 2640effc7aSJoseph Huber return ret_val; 2740effc7aSJoseph Huber } 2840effc7aSJoseph Huber 29*03dcefe0SJoseph Huber } // namespace LIBC_NAMESPACE_DECL 30