trace-cpp-api-inlines.h File
C++ header file with the inline implementations for the tracer class template. More...
#include <cstring>
#include <algorithm>
Namespaces Index
Functions Index
| void | dump_args (int argc, char *argv[], const char *name="main") noexcept |
|
Send the argv[] array to the trace output channel. More...
|
|
| void | flush (void) noexcept |
|
Flush the trace output channel. More...
|
|
| void | initialise (void) noexcept |
|
Initialise the trace output channel. More...
|
|
| int | printf (const char *format,...) noexcept |
|
Write a formatted string to the trace output channel. More...
|
|
| int | putchar (int c) noexcept |
|
Write the single character to the trace output channel. More...
|
|
| int | puts (const char *s="") noexcept |
|
Write the string and a line terminator to the trace output channel. More...
|
|
| int | vprintf (const char *format, std::va_list arguments) noexcept |
|
Write a formatted variable arguments list to the trace output channel. More...
|
|
| ssize_t | write (const void *buf, std::size_t nbyte) noexcept |
|
Write the given number of bytes to the trace output channel. More...
|
|
Macro Definitions Index
Description
C++ header file with the inline implementations for the tracer class template.
Class definitions are located in trace-cpp-api.h. Inline methods are separated into this file to improve project structure and maintainability.
Macro Definitions
MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER
| #define MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER (200) |
|
File Listing
The file content with the documentation metadata removed is:
27#if !defined(MICRO_OS_PLUS_DIAG_TRACE_H_)
28#error "Do not include this file directly; use <micro-os-plus/diag/trace.h>."
33#ifndef MICRO_OS_PLUS_DIAG_TRACE_CPP_API_INLINES_H_
34#define MICRO_OS_PLUS_DIAG_TRACE_CPP_API_INLINES_H_
42#if defined(MICRO_OS_PLUS_DIAG_TRACE_ENABLED)
51#ifndef MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER
52#define MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER (200)
57#pragma GCC diagnostic push
59#pragma clang diagnostic ignored "-Wc++98-compat"
60#pragma clang diagnostic ignored "-Wpre-c++17-compat"
77 template <trace_policy T>
81 std::va_list arguments;
82 va_start (arguments, format);
84#pragma GCC diagnostic push
86#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
88 int ret = vprintf (format, arguments);
89#pragma GCC diagnostic pop
95 template <trace_policy T>
106#pragma GCC diagnostic push
107#pragma GCC diagnostic ignored "-Wformat-nonliteral"
108#if defined(__clang__)
109#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
111 ssize_t ret = ::vsnprintf (buf, sizeof (buf), format, arguments);
112#pragma GCC diagnostic pop
121 static_cast<size_t> (std::min (
122 ret, static_cast<ssize_t> (sizeof (buf) - 1))));
124#pragma GCC diagnostic push
125#if defined(__GNUC__) && !defined(__clang__)
126#pragma GCC diagnostic ignored "-Wuseless-cast"
129 return static_cast<int> (ret);
130#pragma GCC diagnostic pop
133 template <trace_policy T>
137#pragma GCC diagnostic push
138#if defined(__clang__)
139#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
141 ssize_t ret = write (s, std::strlen (s));
142#pragma GCC diagnostic pop
145 ssize_t ret2 = write ("\n", 1);
157#pragma GCC diagnostic push
158#if defined(__GNUC__) && !defined(__clang__)
159#pragma GCC diagnostic ignored "-Wuseless-cast"
162 return static_cast<int> (ret);
163#pragma GCC diagnostic pop
171 template <trace_policy T>
175 char ch = static_cast<char> (c);
176 ssize_t ret = write (&ch, 1);
187#pragma GCC diagnostic push
188#if defined(__clang__)
189#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
191 template <trace_policy T>
195 printf ("%s(argc=%d, argv=[", name, argc);
196 for (int i = 0; i < argc; ++i)
202 printf ("\"%s\"", argv[i]);
206#pragma GCC diagnostic pop
223 write (const void* buf, std::size_t nbyte) noexcept
235 printf (const char* format, ...) noexcept
237 std::va_list arguments;
238 va_start (arguments, format);
239#pragma GCC diagnostic push
240#if defined(__clang__)
241#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
245#pragma GCC diagnostic pop
251 vprintf (const char* format, std::va_list arguments) noexcept
253#pragma GCC diagnostic push
254#if defined(__clang__)
255#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
258#pragma GCC diagnostic pop
264#pragma GCC diagnostic push
265#if defined(__clang__)
266#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
269#pragma GCC diagnostic pop
279 dump_args (int argc, char* argv[], const char* name) noexcept
286#pragma GCC diagnostic pop
294#pragma GCC diagnostic push
295#if defined(__clang__)
296#pragma clang diagnostic ignored "-Wc++98-compat"
297#pragma clang diagnostic ignored "-Wpre-c++17-compat"
305 inline __attribute__ ((always_inline)) void
310 inline __attribute__ ((always_inline)) ssize_t
311 write (const void* , std::size_t nbyte) noexcept
313 return static_cast<ssize_t> (nbyte);
316 inline __attribute__ ((always_inline)) void
317 flush (void) noexcept
323 inline __attribute__ ((always_inline)) int
324 printf (const char* , ...) noexcept
329 inline __attribute__ ((always_inline)) int
330 vprintf (const char* , std::va_list ) noexcept
335 inline __attribute__ ((always_inline)) int
336 puts (const char* ) noexcept
341 inline __attribute__ ((always_inline)) int
347 inline __attribute__ ((always_inline)) void
349 const char* ) noexcept
355#pragma GCC diagnostic pop
Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.17.0.