Cbeam
Loading...
Searching...
No Matches
compiler_compatibility.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2025 acrion innovations GmbH
3Authors: Stefan Zipproth, s.zipproth@acrion.ch
4
5This file is part of Cbeam, see https://github.com/acrion/cbeam and https://cbeam.org
6
7Cbeam is offered under a commercial and under the AGPL license.
8For commercial licensing, contact us at https://acrion.ch/sales. For AGPL licensing, see below.
9
10AGPL licensing:
11
12Cbeam is free software: you can redistribute it and/or modify
13it under the terms of the GNU Affero General Public License as published by
14the Free Software Foundation, either version 3 of the License, or
15(at your option) any later version.
16
17Cbeam is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU Affero General Public License for more details.
21
22You should have received a copy of the GNU Affero General Public License
23along with Cbeam. If not, see <https://www.gnu.org/licenses/>.
24*/
25
26#pragma once
27
35
36// clang-format off
48#if defined(_MSC_VER)
49 // MSVC-specific warning suppression
50 #define CBEAM_SUPPRESS_WARNINGS_PUSH() \
51 __pragma(warning(push, 0))
52#elif defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__) || defined(__MINGW64__)
53 // GCC, Clang, and Mingw-specific warning suppression
54 #define CBEAM_SUPPRESS_WARNINGS_PUSH() \
55 _Pragma("GCC diagnostic push") \
56 _Pragma("GCC diagnostic ignored \"-Wsign-compare\"") \
57 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
58 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
59 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
60 _Pragma("GCC diagnostic ignored \"-Wextra\"") \
61 _Pragma("GCC diagnostic ignored \"-Wnonnull\"") \
62 _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
63#else
64 #define CBEAM_SUPPRESS_WARNINGS_PUSH()
65#endif
66
77#if defined(_MSC_VER)
78 // MSVC-specific warning restoration
79 #define CBEAM_SUPPRESS_WARNINGS_POP() \
80 __pragma(warning(pop))
81#elif defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__) || defined(__MINGW64__)
82 // GCC, Clang, and Mingw-specific warning restoration
83 #define CBEAM_SUPPRESS_WARNINGS_POP() \
84 _Pragma("GCC diagnostic pop")
85#else
86 #define CBEAM_SUPPRESS_WARNINGS_POP()
87#endif
88// clang-format on