cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
macros.hpp
Go to the documentation of this file.
1/*
2* cpp-terminal
3* C++ library for writing multi-platform terminal applications.
4*
5* SPDX-FileCopyrightText: 2019-2024 cpp-terminal
6*
7* SPDX-License-Identifier: MIT
8*/
9
10#pragma once
11
12#if __cplusplus >= 201703L
13
14 #if defined(__GNUC__) && (__GNUC__ > 7)
15 #define CPP_TERMINAL_NODISCARD [[nodiscard]]
16 #elif defined(__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 8))
17 #define CPP_TERMINAL_NODISCARD [[nodiscard]]
18 #else
19 #define CPP_TERMINAL_NODISCARD
20 #endif
21
22 #if defined(__GNUC__) && (__GNUC__ > 5)
23 #define CPP_TERMINAL_FALLTHROUGH [[fallthrough]]
24 #elif defined(__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 5))
25 #define CPP_TERMINAL_FALLTHROUGH [[fallthrough]]
26 #else
27 #define CPP_TERMINAL_FALLTHROUGH
28 #endif
29
30 #if defined(__GNUC__) && (__GNUC__ > 5)
31 #define CPP_TERMINAL_MAYBE_UNUSED [[maybe_unused]]
32 #elif defined(__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 5))
33 #define CPP_TERMINAL_MAYBE_UNUSED [[maybe_unused]]
34 #else
35 #define CPP_TERMINAL_MAYBE_UNUSED
36 #endif
37
38#else
39 #define CPP_TERMINAL_NODISCARD
40 #define CPP_TERMINAL_FALLTHROUGH
41 #define CPP_TERMINAL_MAYBE_UNUSED
42#endif