Couchbase C Client  3.3.10
Asynchronous C Client for Couchbase
sysdefs.h
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2010-2020 Couchbase, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
21 #ifndef LCB_SYSDEFS_H
22 #define LCB_SYSDEFS_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #ifdef _WIN32
29 #include <stddef.h>
30 #include <winsock2.h>
31 #include <basetsd.h>
32 
33 /* TODO: consider using pstdint.h from http://www.azillionmonkeys.com/qed/pstdint.h */
34 typedef __int16 int16_t;
35 typedef __int32 int32_t;
36 typedef __int64 int64_t;
37 typedef unsigned __int8 uint8_t;
38 typedef unsigned __int16 uint16_t;
39 typedef unsigned __int32 uint32_t;
40 typedef unsigned __int64 uint64_t;
41 
42 typedef __int64 lcb_int64_t;
43 typedef __int32 lcb_int32_t;
44 typedef SIZE_T lcb_size_t;
45 typedef SSIZE_T lcb_ssize_t;
46 typedef unsigned __int8 lcb_uint8_t;
47 typedef unsigned __int16 lcb_vbucket_t;
48 typedef unsigned __int16 lcb_uint16_t;
49 typedef unsigned __int32 lcb_uint32_t;
50 typedef unsigned __int64 lcb_uint64_t;
51 
53 typedef unsigned __int32 lcb_time_t;
54 #else
55 #include <sys/types.h>
56 #include <stdint.h>
57 #include <time.h>
58 
59 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
60 #include <stddef.h>
61 #endif
62 
63 typedef int64_t lcb_int64_t;
64 typedef int32_t lcb_int32_t;
65 typedef size_t lcb_size_t;
66 typedef ssize_t lcb_ssize_t;
67 typedef uint16_t lcb_vbucket_t;
68 typedef uint8_t lcb_uint8_t;
69 typedef uint16_t lcb_uint16_t;
70 typedef uint32_t lcb_uint32_t;
71 typedef uint64_t lcb_uint64_t;
72 typedef time_t lcb_time_t;
73 #endif
74 
75 typedef lcb_int64_t lcb_S64;
76 typedef lcb_uint64_t lcb_U64;
77 typedef lcb_uint32_t lcb_U32;
78 typedef lcb_int32_t lcb_S32;
79 typedef lcb_uint16_t lcb_U16;
80 typedef lcb_uint8_t lcb_U8;
81 typedef lcb_size_t lcb_SIZE;
82 typedef lcb_ssize_t lcb_SSIZE;
83 typedef lcb_time_t lcb_SECS;
85 #ifdef __GNUC__
86 #define LCB_DEPRECATED(X) X __attribute__((deprecated))
87 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
88 #define LCB_DEPRECATED2(X, reason) X __attribute__((deprecated(reason)))
89 #else
90 #define LCB_DEPRECATED2(X, reason) LCB_DEPRECATED(X)
91 #endif
92 #elif defined(_MSC_VER)
93 #define LCB_DEPRECATED(X) __declspec(deprecated) X
94 #define LCB_DEPRECATED2(X, reason) __declspec(deprecated(reason)) X
95 #else
96 #define LCB_DEPRECATED(X) X
97 #define LCB_DEPRECATED2(X, reason)
98 #endif
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* LCB_SYSDEFS_H */