libmongocrypt
Loading...
Searching...
No Matches
mongocrypt-compat.h
1/*
2 * Copyright 2018-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef MONGOCRYPT_COMPAT_H
17#define MONGOCRYPT_COMPAT_H
18
19/* Utilities for cross-platform and C89 compatibility */
20
21/* Copied from bson-compat.h from the C driver. */
22#include <stdbool.h>
23#include <stdint.h>
24#ifdef MONGOCRYPT_HAVE_STDBOOL_H
25/*
26 TODO - check for stdbool.h if we need to support older compilers and reconile
27 with kms-message's rules for including stdbool.h
28*/
29#elif !defined(__bool_true_false_are_defined)
30#ifndef __cplusplus
31typedef signed char bool;
32#define false 0
33#define true 1
34#endif
35#define __bool_true_false_are_defined 1
36#endif
37
38#ifdef __GNUC__
39#define MONGOCRYPT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
40#else
41#define MONGOCRYPT_WARN_UNUSED_RESULT
42#endif
43
44#endif /* MONGOCRYPT_COMPAT_H */