C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
cpprest_compat.h
1 /***
2 * ==++==
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
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 * 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 * ==--==
17 * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
18 *
19 * Standard macros and definitions.
20 * This header has minimal dependency on windows headers and is safe for use in the public API
21 *
22 * For the latest on this and related APIs, please see http://casablanca.codeplex.com.
23 *
24 * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
25 ****/
26 
27 #pragma once
28 
29 #if defined(_WIN32) // Settings specific to Windows
30 
31 #if _MSC_VER >= 1900
32 #define CPPREST_NOEXCEPT noexcept
33 #else
34 #define CPPREST_NOEXCEPT
35 #endif
36 
37 #define CASABLANCA_UNREFERENCED_PARAMETER(x) (x)
38 
39 #include <sal.h>
40 
41 #else // End settings specific to Windows
42 
43 // Settings common to all but Windows
44 
45 #define __declspec(x) __attribute__ ((x))
46 #define dllimport
47 #define novtable /* no novtable equivalent */
48 #define __assume(x) do { if (!(x)) __builtin_unreachable(); } while (false)
49 #define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x
50 #define CPPREST_NOEXCEPT noexcept
51 
52 #include <assert.h>
53 #define _ASSERTE(x) assert(x)
54 
55 // No SAL on non Windows platforms
56 #include "cpprest/details/nosal.h"
57 
58 #if not defined __cdecl
59 #if defined cdecl
60 #define __cdecl __attribute__ ((cdecl))
61 #else
62 #define __cdecl
63 #endif
64 
65 #if defined(__ANDROID__)
66 // This is needed to disable the use of __thread inside the boost library.
67 // Android does not support thread local storage -- if boost is included
68 // without this macro defined, it will create references to __tls_get_addr
69 // which (while able to link) will not be available at runtime and prevent
70 // the .so from loading.
71 #define BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION
72 #endif
73 
74 #ifdef __clang__
75 #include <cstdio>
76 #endif
77 
78 #endif // defined(__APPLE__)
79 
80 #endif
81 
82 
83 #ifdef _NO_ASYNCRTIMP
84 #define _ASYNCRTIMP
85 #else
86 #ifdef _ASYNCRT_EXPORT
87 #define _ASYNCRTIMP __declspec(dllexport)
88 #else
89 #define _ASYNCRTIMP __declspec(dllimport)
90 #endif
91 #endif
92 
93 #ifdef CASABLANCA_DEPRECATION_NO_WARNINGS
94 #define CASABLANCA_DEPRECATED(x)
95 #else
96 #define CASABLANCA_DEPRECATED(x) __declspec(deprecated(x))
97 #endif