bit7z
4.0.0
A C++ library for interfacing with the 7-zip shared libs.
Loading...
Searching...
No Matches
bitdefines.hpp
1
/*
2
* bit7z - A C++ static library to interface with the 7-zip shared libraries.
3
* Copyright (c) 2014-2023 Riccardo Ostani - All Rights Reserved.
4
*
5
* This Source Code Form is subject to the terms of the Mozilla Public
6
* License, v. 2.0. If a copy of the MPL was not distributed with this
7
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
*/
9
10
#ifndef BITDEFINES_HPP
11
#define BITDEFINES_HPP
12
13
/* Uncomment the following macros if you don't want to define them yourself in your project files,
14
* and you can't enable them via CMake. */
15
//#define BIT7Z_AUTO_FORMAT
16
//#define BIT7Z_AUTO_PREFIX_LONG_PATHS
17
//#define BIT7Z_REGEX_MATCHING
18
//#define BIT7Z_USE_STD_BYTE
19
//#define BIT7Z_USE_NATIVE_STRING
20
21
#if ( defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L ) || ( defined( __cplusplus ) && __cplusplus >= 201703L )
22
# define BIT7Z_CPP_STANDARD 17
23
#elif ( defined( _MSVC_LANG ) && _MSVC_LANG >= 201402L ) || ( defined( __cplusplus ) && __cplusplus >= 201402L )
24
# define BIT7Z_CPP_STANDARD 14
25
#else
26
# define BIT7Z_CPP_STANDARD 11
27
#endif
28
29
#if defined( __cpp_lib_filesystem )
30
# define BIT7Z_USE_STANDARD_FILESYSTEM
31
#elif BIT7Z_CPP_STANDARD >= 17 && defined( __has_include )
32
# if __has_include( <filesystem> )
33
# define BIT7Z_USE_STANDARD_FILESYSTEM
34
# endif
35
#endif
36
37
/* Macro defines for [[nodiscard]] and [[maybe_unused]] attributes. */
38
#if defined( __has_cpp_attribute )
39
# if __has_cpp_attribute( nodiscard )
40
# define BIT7Z_NODISCARD [[nodiscard]]
41
# endif
42
# if __has_cpp_attribute( maybe_unused )
43
# define BIT7Z_MAYBE_UNUSED [[maybe_unused]]
44
# endif
45
# if __has_cpp_attribute( deprecated )
46
# define BIT7Z_DEPRECATED [[deprecated]]
47
# define BIT7Z_DEPRECATED_MSG( msg ) [[deprecated( msg )]]
48
# endif
49
#endif
50
51
/* The compiler doesn't support __has_cpp_attribute, but it is using the C++17 standard. */
52
#if !defined( BIT7Z_NODISCARD ) && BIT7Z_CPP_STANDARD >= 17
53
# define BIT7Z_NODISCARD [[nodiscard]]
54
#endif
55
56
#if !defined( BIT7Z_MAYBE_UNUSED ) && BIT7Z_CPP_STANDARD >= 17
57
# define BIT7Z_MAYBE_UNUSED [[maybe_unused]]
58
#endif
59
60
#if !defined( BIT7Z_DEPRECATED ) && BIT7Z_CPP_STANDARD >= 14
61
# define BIT7Z_DEPRECATED [[deprecated]]
62
# define BIT7Z_DEPRECATED_MSG( msg ) [[deprecated( msg )]]
63
#endif
64
65
/* Compiler is using at most the C++14 standard, so we use the compiler-specific attributes/defines were possible. */
66
#ifndef BIT7Z_NODISCARD
67
# if defined( __GNUC__ ) || defined(__clang__)
68
# define BIT7Z_NODISCARD __attribute__(( warn_unused_result ))
69
# elif defined( _Check_return_ )
// Old MSVC versions
70
# define BIT7Z_NODISCARD _Check_return_
71
# else
72
# define BIT7Z_NODISCARD
73
# endif
74
#endif
75
#ifndef BIT7Z_MAYBE_UNUSED
76
# if defined( __GNUC__ ) || defined(__clang__)
77
# define BIT7Z_MAYBE_UNUSED __attribute__(( unused ))
78
# else
79
# define BIT7Z_MAYBE_UNUSED
80
# endif
81
#endif
82
83
/* Compiler is using the C++11 standard, so we use the compiler-specific attributes were possible.
84
* Note: these macros are used in the public API, so we cannot assume that we are always using a C++14 compiler.*/
85
#ifndef BIT7Z_DEPRECATED
86
# if defined( __GNUC__ ) || defined( __clang__ )
87
# define BIT7Z_DEPRECATED __attribute__(( __deprecated__ ))
88
# define BIT7Z_DEPRECATED_MSG( msg ) __attribute__(( __deprecated__( msg ) ))
89
# elif defined( _MSC_VER )
90
# define BIT7Z_DEPRECATED __declspec( deprecated )
91
# define BIT7Z_DEPRECATED_MSG( msg ) __declspec( deprecated( msg ) )
92
# else
93
# define BIT7Z_DEPRECATED
94
# define BIT7Z_DEPRECATED_MSG( msg )
95
# endif
96
#endif
97
98
#ifndef BIT7Z_DEPRECATED_ENUMERATOR
99
// Before v6.0, GCC didn't support deprecating single enumerators.
100
# if defined( __GNUC__ ) && !defined( __clang__ ) && __GNUC__ < 6
101
# define BIT7Z_DEPRECATED_ENUMERATOR( deprecated_value, new_value, msg ) deprecated_value = new_value
102
# else
103
# define BIT7Z_DEPRECATED_ENUMERATOR( deprecated_value, new_value, msg ) \
104
deprecated_value BIT7Z_DEPRECATED_MSG( msg ) = new_value
105
# endif
106
#endif
107
108
#endif
//BITDEFINES_HPP
include
bit7z
bitdefines.hpp
Generated by
1.9.8