MongoDB C++ Driver  legacy-1.1.2
compiler_msvc.h
1 /*
2  * Copyright 2012 10gen 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 
23 #pragma once
24 
25 #define MONGO_COMPILER_NORETURN __declspec(noreturn)
26 
27 #define MONGO_COMPILER_VARIABLE_UNUSED
28 
29 #define MONGO_COMPILER_ALIGN_TYPE(ALIGNMENT) __declspec(align(ALIGNMENT))
30 
31 #define MONGO_COMPILER_ALIGN_VARIABLE(ALIGNMENT) __declspec(align(ALIGNMENT))
32 
33 #define MONGO_COMPILER_API_EXPORT __declspec(dllexport)
34 #define MONGO_COMPILER_API_IMPORT __declspec(dllimport)
35 
36 #ifdef _M_IX86
37 // 32-bit x86 supports multiple of calling conventions. We build supporting the cdecl convention
38 // (most common). By labeling our exported and imported functions as such, we do a small favor to
39 // 32-bit Windows developers.
40 #define MONGO_COMPILER_API_CALLING_CONVENTION __cdecl
41 #else
42 #define MONGO_COMPILER_API_CALLING_CONVENTION
43 #endif
44 
45 #define MONGO_COMPILER_API_DEPRECATED(MSG) __declspec(deprecated(MSG))
46 
47 #define MONGO_likely(x) bool(x)
48 #define MONGO_unlikely(x) bool(x)