ledger-core
djinni_common.hpp
1 //
2 // Copyright 2015 Dropbox, 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 
17 #pragma once
18 
19 #ifdef _MSC_VER
20  #define DJINNI_WEAK_DEFINITION // weak attribute not supported by MSVC
21  #define DJINNI_NORETURN_DEFINITION __declspec(noreturn)
22  #if _MSC_VER < 1900 // snprintf not implemented prior to VS2015
23  #define DJINNI_SNPRINTF snprintf
24  #define noexcept _NOEXCEPT // work-around for missing noexcept VS2015
25  #define constexpr // work-around for missing constexpr VS2015
26  #else
27  #define DJINNI_SNPRINTF _snprintf
28  #endif
29 #else
30  #define DJINNI_WEAK_DEFINITION __attribute__((weak))
31  #define DJINNI_NORETURN_DEFINITION __attribute__((noreturn))
32  #define DJINNI_SNPRINTF snprintf
33 #endif