diag-trace
5.0.1
µOS++ Tracing Infrastructure
Toggle main menu visibility
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1
/*
2
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3
* Copyright (c) 2015-2026 Liviu Ionescu. All rights reserved.
4
*
5
* Permission to use, copy, modify, and/or distribute this software for any
6
* purpose is hereby granted, under the terms of the MIT license.
7
*
8
* If a copy of the license was not distributed with this file, it can be
9
* obtained from https://opensource.org/licenses/mit.
10
*/
11
12
// ----------------------------------------------------------------------------
13
25
26
// ----------------------------------------------------------------------------
27
28
#ifndef MICRO_OS_PLUS_DIAG_TRACE_H_
29
#define MICRO_OS_PLUS_DIAG_TRACE_H_
30
31
// ----------------------------------------------------------------------------
32
33
#if defined(__cplusplus)
34
#if !(__cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L))
35
#error "C++20 or higher is required"
36
#endif
// !(__cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L))
37
#endif
// defined(__cplusplus)
38
39
#if __has_include("micro-os-plus/project-config.h")
40
#include "micro-os-plus/project-config.h"
41
#endif
// __has_include("micro-os-plus/project-config.h")
42
43
#if __has_include("micro-os-plus/diag/trace-defines.h")
44
#include "micro-os-plus/diag/trace-defines.h"
45
#endif
// __has_include("micro-os-plus/diag/trace-defines.h")
46
47
// ----------------------------------------------------------------------------
48
49
#if defined(__DOXYGEN__)
50
// Present here solely for Doxygen, to document the macros.
51
#define MICRO_OS_PLUS_DIAG_TRACE_ENABLED
52
#endif
// defined(__DOXYGEN__)
53
54
#if !defined(MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER)
55
#define MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER (200)
56
#endif
// !defined(MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER)
57
58
// ----------------------------------------------------------------------------
59
// `putchar()` hack.
60
61
// To be effective, <stdio.h> must be included *before* the putchar patch.
62
#include <stdio.h>
63
64
// This is a very annoying issue, some very old libraries still
65
// define putchar() as a macro. This is abusive, since it prevents
66
// the use of putchar() in other name spaces.
67
#if defined(putchar)
68
#undef putchar
69
#endif
// defined(putchar)
70
71
// ----------------------------------------------------------------------------
72
73
// The headers are included even when tracing is disabled, as they define the
74
// empty inline functions needed for the trace calls to compile without
75
// requiring conditional compilation.
76
77
#include "
trace/cpp-api.h
"
78
#include "
trace/c-api.h
"
79
80
// ----------------------------------------------------------------------------
81
82
#endif
// MICRO_OS_PLUS_DIAG_TRACE_H_
83
84
// ----------------------------------------------------------------------------
c-api.h
C header file with the declarations for the C trace API.
cpp-api.h
C++ header file with the declarations for the C++ trace API.
include
micro-os-plus
diag
trace.h
Generated by
1.17.0