micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
exceptions.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) 2021-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 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1.0 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
38
39#ifndef MICRO_TEST_PLUS_EXCEPTIONS_H_
40#define MICRO_TEST_PLUS_EXCEPTIONS_H_
41
42// ----------------------------------------------------------------------------
43
44#ifdef __cplusplus
45
46// ----------------------------------------------------------------------------
47
48#if defined(__GNUC__)
49#pragma GCC diagnostic push
50#pragma GCC diagnostic ignored "-Waggregate-return"
51#if defined(__clang__)
52#pragma clang diagnostic ignored "-Wc++98-compat"
53#endif
54#endif
55
56// ============================================================================
57
59{
60 // --------------------------------------------------------------------------
61
62#if defined(__cpp_exceptions)
63
74 template <class Exception_T, class Callable_T>
75 [[nodiscard]] constexpr auto
76 throws (const Callable_T& func);
77
87 template <class Callable_T>
88 [[nodiscard]] constexpr auto
89 throws (const Callable_T& func);
90
99 template <class Callable_T>
100 [[nodiscard]] constexpr auto
101 nothrow (const Callable_T& func);
102
103#endif
104
105 // --------------------------------------------------------------------------
106} // namespace micro_os_plus::micro_test_plus
107
108#if defined(__GNUC__)
109#pragma GCC diagnostic pop
110#endif
111
112// ----------------------------------------------------------------------------
113
114#endif // __cplusplus
115
116// ============================================================================
117// Templates & constexpr implementations.
118
120
121// ----------------------------------------------------------------------------
122
123#endif // MICRO_TEST_PLUS_EXCEPTIONS_H_
124
125// ----------------------------------------------------------------------------
C++ header file with inline implementations for the µTest++ exceptions comparators.
constexpr auto nothrow(const Callable_T &func)
Check if a callable does not throw an exception.
Primary namespace for the µTest++ testing framework.