ISARA Quantum Resistant Toolkit  Version 1.1
Quantum resistant cryptographic primitives and algorithms.
iqr_api.h
Go to the documentation of this file.
1 
67 #ifndef IQR_API_H
68 #define IQR_API_H
69 
70 #include <limits.h>
71 
74 /* Compatibility check. */
75 #if CHAR_BIT != 8
76 # error "This library assumes 8-bit byte sizes."
77 #endif
78 
79 /* User defined overrides. */
80 #if defined(IQR_UNENFORCED_RETURNS)
81 # define IQR_MUST_CHECK
82 #endif
83 
84 #if defined(IQR_IGNORE_DEPRECATED)
85 # define IQR_DEPRECATED
86 # define IQR_DEPRECATED_MSG
87 #endif
88 
89 /* Function Decorator Macros */
90 #if defined(__GNUC__) || defined(__clang__)
91 # if defined(_WIN32) || defined(_WIN64)
92 # define IQR_EXPORT __attribute__((dllexport))
93 # define IQR_IMPORT __attribute__((dllimport))
94 # else
95 # define IQR_EXPORT __attribute__((visibility("default")))
96 # define IQR_IMPORT
97 # endif
98 # if !defined(IQR_UNENFORCED_RETURNS)
99 # define IQR_MUST_CHECK __attribute__((warn_unused_result))
100 # endif
101 # if !defined(IQR_IGNORE_DEPRECATED)
102 # define IQR_DEPRECATED __attribute__((deprecated))
103 # define IQR_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
104 # endif
105 #elif defined(_MSC_VER) || defined(__VISUAL_C__)
106 # define IQR_EXPORT __declspec(dllexport)
107 # define IQR_IMPORT __declspec(dllimport)
108 # if !defined(IQR_UNENFORCED_RETURNS)
109 # define IQR_MUST_CHECK _Check_return_
110 # endif
111 # if !defined(IQR_IGNORE_DEPRECATED)
112 # define IQR_DEPRECATED __declspec(deprecated)
113 # define IQR_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
114 # endif
115 #elif defined(CPPCHECK)
116 # define IQR_EXPORT
117 # define IQR_IMPORT
118 # define IQR_MUST_CHECK
119 # define IQR_DEPRECATED
120 # define IQR_DEPRECATED_MSG(msg)
121 #else
122 # error "Unsupported compiler suite!"
123 #endif
124 
125 /* API */
126 #if defined(IQR_ISARA_BUILD)
127 # define IQR_API IQR_EXPORT IQR_MUST_CHECK
128 # define IQR_API_UNENFORCED_RETURN IQR_EXPORT
129 # define IQR_EXTERN IQR_EXPORT extern
130 #else
131 # define IQR_API IQR_MUST_CHECK
132 # define IQR_API_UNENFORCED_RETURN
133 # if defined(IQR_DLL)
134 # define IQR_EXTERN IQR_IMPORT extern
135 # else
136 # define IQR_EXTERN extern
137 # endif
138 #endif
139 
142 #endif /* IQR_API_H */