14#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
15#include <micro-os-plus/config.h>
18#if defined(MICRO_OS_PLUS_TRACE) || defined(MICRO_OS_PLUS_TRACE_TESTING)
28#ifndef MICRO_OS_PLUS_INTEGER_TRACE_PRINTF_BUFFER_ARRAY_SIZE
29#define MICRO_OS_PLUS_INTEGER_TRACE_PRINTF_BUFFER_ARRAY_SIZE (200)
35#pragma clang diagnostic ignored "-Wunknown-warning-option"
36#pragma clang diagnostic ignored "-Wc++98-c++11-c++14-compat"
40namespace micro_os_plus::MICRO_OS_PLUS_TRACE_NAME_TESTING(
trace)
48 std::va_list arguments;
49 va_start (arguments, format);
51#pragma GCC diagnostic push
53#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
55 int ret =
vprintf (format, arguments);
56#pragma GCC diagnostic pop
63 vprintf (
const char* format, std::va_list arguments)
72#pragma GCC diagnostic push
73#pragma GCC diagnostic ignored "-Wformat-nonliteral"
75#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
77 ssize_t ret = ::vsnprintf (buf,
sizeof (buf), format, arguments);
78#pragma GCC diagnostic pop
82 ret =
write (buf,
static_cast<size_t> (ret));
84#pragma GCC diagnostic push
85#if defined(__GNUC__) && !defined(__clang__)
86#pragma GCC diagnostic ignored "-Wuseless-cast"
89 return static_cast<int> (ret);
90#pragma GCC diagnostic pop
96#pragma GCC diagnostic push
98#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
100 ssize_t ret =
write (s, strlen (s));
101#pragma GCC diagnostic pop
104 ret =
write (
"\n", 1);
108#pragma GCC diagnostic push
109#if defined(__GNUC__) && !defined(__clang__)
110#pragma GCC diagnostic ignored "-Wuseless-cast"
113 return static_cast<int> (ret);
114#pragma GCC diagnostic pop
125 ssize_t ret =
write (
reinterpret_cast<const char*
> (&c), 1);
141#pragma GCC diagnostic push
142#if defined(__clang__)
143#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
148 printf (
"%s(argc=%d, argv=[", name, argc);
149 for (
int i = 0; i < argc; ++i)
155 printf (
"\"%s\"", argv[i]);
159#pragma GCC diagnostic pop
179 const void* buf, std::size_t nbyte)
197 const char* format, ...)
199 std::va_list arguments;
200 va_start (arguments, format);
202#pragma GCC diagnostic push
203#if defined(__clang__)
204#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
208#pragma GCC diagnostic pop
216 const char* format, va_list arguments)
218#pragma GCC diagnostic push
219#if defined(__clang__)
220#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
223#pragma GCC diagnostic pop
229#pragma GCC diagnostic push
230#if defined(__clang__)
231#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
234#pragma GCC diagnostic pop
240#pragma GCC diagnostic push
241#if defined(__clang__)
242#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
245#pragma GCC diagnostic pop
252#pragma GCC diagnostic push
253#if defined(__clang__)
254#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
257#pragma GCC diagnostic pop
void micro_os_plus_trace_initialize(void)
Initialize the trace output channel.
ssize_t micro_os_plus_trace_write(const void *buf, size_t nbyte)
Write the given number of bytes to the trace output channel.
void micro_os_plus_trace_flush(void)
Flush the trace output channel.
int micro_os_plus_trace_printf(const char *format,...)
Write a formatted string to the trace output channel.
int micro_os_plus_trace_puts(const char *s)
Write the string and a line terminator to the trace output channel.
int micro_os_plus_trace_vprintf(const char *format, va_list arguments)
Write a formatted variable arguments list to the trace output channel.
int micro_os_plus_trace_putchar(int c)
Write the single character to the trace output channel.
ssize_t write(const void *buf, std::size_t nbyte)
Write the given number of bytes to the trace output channel.
int printf(const char *format,...)
Write a formatted string to the trace output channel.
int putchar(int c)
Write the single character to the trace output channel.
int puts(const char *s="")
Write the string and a line terminator to the trace output channel.
int vprintf(const char *format, std::va_list arguments)
Write a formatted variable arguments list to the trace output channel.
Tracing support namespace.
#define MICRO_OS_PLUS_INTEGER_TRACE_PRINTF_BUFFER_ARRAY_SIZE
#define MICRO_OS_PLUS_TRACE_NAME_TESTING(name)