KiCad PCB EDA Suite
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright (C) 2020 Ian McInerney <
[email protected]
>
5
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
6
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.TXT for contributors.
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, you may find one here:
20
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21
* or you may search the http://www.gnu.org website for the version 2 license,
22
* or you may write to the Free Software Foundation, Inc.,
23
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24
*/
25
31
#ifndef MACROS_H
32
#define MACROS_H
33
34
#include <wx/string.h>
35
36
#if defined( __has_attribute )
37
#define KI_HAS_ATTRIBUTE( x ) __has_attribute( x )
38
#else
39
#define KI_HAS_ATTRIBUTE( x ) 0
40
#endif
41
42
// Based on the declaration inside the LLVM source code
43
#if defined( __cplusplus ) && defined( __has_cpp_attribute )
44
#define KI_HAS_CPP_ATTRIBUTE( x ) __has_cpp_attribute( x )
45
#else
46
#define KI_HAS_CPP_ATTRIBUTE( x ) 0
47
#endif
48
65
#if __cplusplus >= 201703L
66
// C++ 17 includes this macro on all compilers
67
#define KI_FALLTHROUGH [[fallthrough]]
68
69
#elif KI_HAS_CPP_ATTRIBUTE( clang::fallthrough )
70
// Clang provides this attribute to silence the "-Wimplicit-fallthrough" warning
71
#define KI_FALLTHROUGH [[clang::fallthrough]]
72
73
#elif KI_HAS_CPP_ATTRIBUTE( gnu::fallthrough )
74
// GNU-specific C++ attribute to silencing the warning
75
#define KI_FALLTHROUGH [[gnu::fallthrough]]
76
77
#elif defined( __GNUC__ ) && __GNUC__ >= 7
78
// GCC 7+ includes the "-Wimplicit-fallthrough" warning, and this attribute to silence it
79
#define KI_FALLTHROUGH __attribute__ ((fallthrough))
80
81
#else
82
// In every other case, don't do anything
83
#define KI_FALLTHROUGH ( ( void ) 0 )
84
85
#endif
86
93
#define TO_STR2(x) #x
94
#define TO_STR(x) TO_STR2(x)
95
96
#define UNIMPLEMENTED_FOR( type ) \
97
wxFAIL_MSG( wxString::Format( wxT( "%s: unimplemented for %s"
), __FUNCTION__, type ) )
98
99
#endif
// MACROS_H
src
include
macros.h
Generated on Sun Dec 22 2024 00:05:24 for KiCad PCB EDA Suite by
1.9.6