Guardtime KSI c SDK
common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-2015 Guardtime, Inc.
3  *
4  * This file is part of the Guardtime client SDK.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License").
7  * You may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  * http://www.apache.org/licenses/LICENSE-2.0
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, CONDITIONS, OR OTHER LICENSES OF ANY KIND, either
13  * express or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  * "Guardtime" and "KSI" are trademarks or registered trademarks of
16  * Guardtime, Inc., and no license to trademarks is granted; Guardtime
17  * reserves and retains all trademark rights.
18  */
19 
20 #ifndef COMMON_H_
21 #define COMMON_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
32 #define KSI_IS_VALID_TREE_LEVEL(level) (((level) >= 0) && ((level) <= 0xff))
33 
37 #ifndef __KSI_NO_DEPRECATE__
38 # if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
39 # define KSI_FN_DEPRECATED(decl, comment) decl __attribute__((deprecated))
40 # elif defined(_WIN32)
41 # define KSI_FN_DEPRECATED(decl, comment) __declspec(deprecated) decl
42 # else
43 # define KSI_FN_DEPRECATED(decl, comment) decl
44 # endif
45 #else
46 # define KSI_FN_DEPRECATED(decl, comment) decl;
47 #endif
48 
49 #ifndef __KSI_NO_DEPRECATE__
50 # if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
51 # define KSI_VAR_DEPRECATED(decl) decl __attribute__((deprecated))
52 # elif defined(_WIN32)
53  /* No reasonable way to shown the warning with VS. */
54 # endif
55 #endif
56 
57 
58 #ifndef KSI_VAR_DEPRECATED
59 # define KSI_VAR_DEPRECATED(decl) decl
60 #endif
61 
62 #if defined(_WIN32) && defined(DLL_BUILD) && !(KSI_BUILD)
63 # define KSI_DEFINE_EXTERN(e) __declspec( dllimport ) extern e
64 #else
65 # define KSI_DEFINE_EXTERN(e) extern e
66 #endif
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* COMMON_H_ */