-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
p44utils_minimal.hpp
87 lines (78 loc) · 2.44 KB
/
p44utils_minimal.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// SPDX-License-Identifier: GPL-3.0-or-later
//
// Copyright (c) 2014-2023 plan44.ch / Lukas Zeller, Zurich, Switzerland
//
// Author: Lukas Zeller <luz@plan44.ch>
//
// This file is part of p44utils.
//
// p44utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// p44utils is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with p44utils. If not, see <http://www.gnu.org/licenses/>.
//
/// This header file introduces no dependencies on code, just defines the
/// bare minimum for using independent p44utils routines and types
#ifndef __p44utils__minimal__
#define __p44utils__minimal__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef ESP_PLATFORM
#include "sdkconfig.h"
#endif
#if __cplusplus >= 201103L
// we have C++ 11
#define P44_FINAL final
#define P44_OVERRIDE override
#define P44_MUST_USE_RESULT __attribute__((warn_unused_result))
#define P44_CPP11_FEATURE 1
#if __cplusplus >= 201703L
// we have C++ 17
#define P44_CPP17_FEATURE 1
#if __cplusplus >= 202002L
// we have C++ 20
#define P44_CPP20_FEATURE 1
#else
#define P44_CPP20_FEATURE 0
#endif
#else
#define P44_CPP17_FEATURE 0
#define P44_CPP20_FEATURE 0
#endif
#else
#define P44_FINAL
#define P44_OVERRIDE
#define P44_MUST_USE_RESULT
#define P44_CPP11_FEATURE 0
#define P44_CPP17_FEATURE 0
#define P44_CPP20_FEATURE 0
#endif
#ifndef __printflike
// old compilers not having printflike at all
#define __printflike(...)
// these do not have mechanism for strftime, either -> define it empty
#define __strftimelike(arg)
#endif
#ifdef ESP_PLATFORM
#define __printflike_template(...)
#else
#define __printflike_template(...) __printflike(__VA_ARGS__)
#endif
// not all platforms that have __printflike also have __strftimelike
#ifndef __strftimelike
#define __strftimelike(argno) __attribute__((format (strftime, argno, 0)))
#endif
#include "p44utils_config.hpp"
// some minimal defs
#include <stddef.h>
#include <stdint.h>
#endif /* __p44utils__minimal__ */