LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
compiler_attributes.hpp
1/* Copyright 2021 - 2024 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_COMPILER_ATTR_H
16#define LIEF_COMPILER_ATTR_H
17
18#if !defined(_MSC_VER)
19# if __cplusplus >= 201103L
20# define LIEF_CPP11
21# if __cplusplus >= 201402L
22# define LIEF_CPP14
23# if __cplusplus >= 201703L
24# define LIEF_CPP17
25# if __cplusplus >= 202002L
26# define LIEF_CPP20
27# endif
28# endif
29# endif
30# endif
31#elif defined(_MSC_VER)
32# if _MSVC_LANG >= 201103L
33# define LIEF_CPP11
34# if _MSVC_LANG >= 201402L
35# define LIEF_CPP14
36# if _MSVC_LANG > 201402L
37# define LIEF_CPP17
38# if _MSVC_LANG >= 202002L
39# define LIEF_CPP20
40# endif
41# endif
42# endif
43# endif
44#endif
45
46#if defined(__MINGW32__)
47# define LIEF_DEPRECATED(reason)
48#elif defined(LIEF_CPP14)
49# define LIEF_DEPRECATED(reason) [[deprecated(reason)]]
50#else
51# define LIEF_DEPRECATED(reason) __attribute__((deprecated(reason)))
52#endif
53
54#endif