|
39 | 39 | #define BSON_BEGIN_IGNORE_DEPRECATIONS \
|
40 | 40 | _Pragma ("clang diagnostic push") _Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"")
|
41 | 41 | #define BSON_END_IGNORE_DEPRECATIONS _Pragma ("clang diagnostic pop")
|
| 42 | +#elif defined(_MSC_VER) |
| 43 | +#define BSON_BEGIN_IGNORE_DEPRECATIONS __pragma (warning (push)) __pragma (warning (disable : 4996)) |
| 44 | +#define BSON_END_IGNORE_DEPRECATIONS __pragma (warning (pop)) |
42 | 45 | #else
|
43 | 46 | #define BSON_BEGIN_IGNORE_DEPRECATIONS
|
44 | 47 | #define BSON_END_IGNORE_DEPRECATIONS
|
@@ -70,25 +73,29 @@ BSON_BEGIN_DECLS
|
70 | 73 | * recommended.
|
71 | 74 | */
|
72 | 75 |
|
73 |
| -#define BSON_CMP_SET(op, ss, uu, su, us) \ |
74 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_cmp_, op, _ss) (int64_t t, int64_t u) \ |
75 |
| - { \ |
76 |
| - return (ss); \ |
77 |
| - } \ |
78 |
| - \ |
79 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_cmp_, op, _uu) (uint64_t t, uint64_t u) \ |
80 |
| - { \ |
81 |
| - return (uu); \ |
82 |
| - } \ |
83 |
| - \ |
84 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_cmp_, op, _su) (int64_t t, uint64_t u) \ |
85 |
| - { \ |
86 |
| - return (su); \ |
87 |
| - } \ |
88 |
| - \ |
89 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_cmp_, op, _us) (uint64_t t, int64_t u) \ |
90 |
| - { \ |
91 |
| - return (us); \ |
| 76 | +#define BSON_CMP_SET(op, ss, uu, su, us) \ |
| 77 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 78 | + bson_cmp_, op, _ss) (int64_t t, int64_t u) \ |
| 79 | + { \ |
| 80 | + return (ss); \ |
| 81 | + } \ |
| 82 | + \ |
| 83 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 84 | + bson_cmp_, op, _uu) (uint64_t t, uint64_t u) \ |
| 85 | + { \ |
| 86 | + return (uu); \ |
| 87 | + } \ |
| 88 | + \ |
| 89 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 90 | + bson_cmp_, op, _su) (int64_t t, uint64_t u) \ |
| 91 | + { \ |
| 92 | + return (su); \ |
| 93 | + } \ |
| 94 | + \ |
| 95 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 96 | + bson_cmp_, op, _us) (uint64_t t, int64_t u) \ |
| 97 | + { \ |
| 98 | + return (us); \ |
92 | 99 | }
|
93 | 100 |
|
94 | 101 | BSON_CMP_SET (equal, t == u, t == u, t < 0 ? false : (uint64_t) (t) == u, u < 0 ? false : t == (uint64_t) (u))
|
@@ -121,28 +128,32 @@ BSON_CMP_SET (greater_equal,
|
121 | 128 |
|
122 | 129 | /* Return true if the given value is within the range of the corresponding
|
123 | 130 | * signed type. The suffix must match the signedness of the given value. */
|
124 |
| -#define BSON_IN_RANGE_SET_SIGNED(Type, min, max) \ |
125 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_in_range, _##Type, _signed) (int64_t value) \ |
126 |
| - { \ |
127 |
| - return bson_cmp_greater_equal_ss (value, min) && bson_cmp_less_equal_ss (value, max); \ |
128 |
| - } \ |
129 |
| - \ |
130 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_in_range, _##Type, _unsigned) (uint64_t value) \ |
131 |
| - { \ |
132 |
| - return bson_cmp_greater_equal_us (value, min) && bson_cmp_less_equal_us (value, max); \ |
| 131 | +#define BSON_IN_RANGE_SET_SIGNED(Type, min, max) \ |
| 132 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 133 | + bson_in_range, _##Type, _signed) (int64_t value) \ |
| 134 | + { \ |
| 135 | + return bson_cmp_greater_equal_ss (value, min) && bson_cmp_less_equal_ss (value, max); \ |
| 136 | + } \ |
| 137 | + \ |
| 138 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 139 | + bson_in_range, _##Type, _unsigned) (uint64_t value) \ |
| 140 | + { \ |
| 141 | + return bson_cmp_greater_equal_us (value, min) && bson_cmp_less_equal_us (value, max); \ |
133 | 142 | }
|
134 | 143 |
|
135 | 144 | /* Return true if the given value is within the range of the corresponding
|
136 | 145 | * unsigned type. The suffix must match the signedness of the given value. */
|
137 |
| -#define BSON_IN_RANGE_SET_UNSIGNED(Type, max) \ |
138 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_in_range, _##Type, _signed) (int64_t value) \ |
139 |
| - { \ |
140 |
| - return bson_cmp_greater_equal_su (value, 0u) && bson_cmp_less_equal_su (value, max); \ |
141 |
| - } \ |
142 |
| - \ |
143 |
| - static BSON_INLINE bool BSON_GNUC_DEPRECATED BSON_CONCAT3 (bson_in_range, _##Type, _unsigned) (uint64_t value) \ |
144 |
| - { \ |
145 |
| - return bson_cmp_less_equal_uu (value, max); \ |
| 146 | +#define BSON_IN_RANGE_SET_UNSIGNED(Type, max) \ |
| 147 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 148 | + bson_in_range, _##Type, _signed) (int64_t value) \ |
| 149 | + { \ |
| 150 | + return bson_cmp_greater_equal_su (value, 0u) && bson_cmp_less_equal_su (value, max); \ |
| 151 | + } \ |
| 152 | + \ |
| 153 | + static BSON_INLINE BSON_DEPRECATED ("<bson/bson-cmp.h> APIs are deprecated") bool BSON_CONCAT3 ( \ |
| 154 | + bson_in_range, _##Type, _unsigned) (uint64_t value) \ |
| 155 | + { \ |
| 156 | + return bson_cmp_less_equal_uu (value, max); \ |
146 | 157 | }
|
147 | 158 |
|
148 | 159 | BSON_IN_RANGE_SET_SIGNED (signed_char, SCHAR_MIN, SCHAR_MAX)
|
|
0 commit comments