diag-trace
5.0.0
µ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
6
* for any 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
9
* be 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
37
#endif
// defined(__cplusplus)
38
39
#if __has_include(<micro-os-plus/project-config.h>)
40
#include <micro-os-plus/project-config.h>
41
#elif __has_include(<micro-os-plus/config.h>)
42
#pragma message \
43
"micro-os-plus/config.h is deprecated, rename to micro-os-plus/project-config.h and include it instead of micro-os-plus/config.h"
44
#include <micro-os-plus/config.h>
45
#endif
// __has_include(<micro-os-plus/project-config.h>)
46
47
#if __has_include(<micro-os-plus/diag/trace-defines.h>)
48
#include <micro-os-plus/diag/trace-defines.h>
49
#endif
// __has_include(<micro-os-plus/diag/trace-defines.h>)
50
51
// ----------------------------------------------------------------------------
52
// `putchar()` hack.
53
54
// To be effective, <stdio.h> must be included *before* the putchar patch.
55
#include <stdio.h>
56
57
// This is a very annoying issue, some very old libraries still
58
// define putchar() as a macro. This is abusive, since it prevents
59
// the use of putchar() in other name spaces.
60
#if defined(putchar)
61
#undef putchar
62
#endif
// defined(putchar)
63
64
// ----------------------------------------------------------------------------
65
66
// The headers are included even when tracing is disabled, as they define the
67
// empty inline functions needed for the trace calls to compile without
68
// requiring conditional compilation.
69
70
#include "
trace-cpp-api.h
"
71
#include "
trace-c-api.h
"
72
73
// ----------------------------------------------------------------------------
74
75
#endif
// MICRO_OS_PLUS_DIAG_TRACE_H_
76
77
// ----------------------------------------------------------------------------
trace-c-api.h
C header file with the declarations for the C trace API.
trace-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