20 #ifndef INCLUDED_SAL_TYPES_H
21 #define INCLUDED_SAL_TYPES_H
34 #if defined ( __MINGW32__ ) && !defined ( __USE_MINGW_ANSI_STDIO )
40 #define __USE_MINGW_ANSI_STDIO 1
49 # define sal_False ((sal_Bool)0)
50 # define sal_True ((sal_Bool)1)
56 #if SAL_TYPES_SIZEOFSHORT == 2
57 typedef signed short sal_Int16;
58 typedef unsigned short sal_uInt16;
60 #error "Could not find 16-bit type, add support for your architecture"
63 #if SAL_TYPES_SIZEOFLONG == 4
64 typedef signed long sal_Int32;
65 typedef unsigned long sal_uInt32;
66 #define SAL_PRIdINT32 "ld"
67 #define SAL_PRIuUINT32 "lu"
68 #define SAL_PRIxUINT32 "lx"
69 #define SAL_PRIXUINT32 "lX"
70 #elif SAL_TYPES_SIZEOFINT == 4
71 typedef signed int sal_Int32;
72 typedef unsigned int sal_uInt32;
73 #define SAL_PRIdINT32 "d"
74 #define SAL_PRIuUINT32 "u"
75 #define SAL_PRIxUINT32 "x"
76 #define SAL_PRIXUINT32 "X"
78 #error "Could not find 32-bit type, add support for your architecture"
82 typedef __int64 sal_Int64;
83 typedef unsigned __int64 sal_uInt64;
86 #define SAL_CONST_INT64(x) x##i64
87 #define SAL_CONST_UINT64(x) x##ui64
89 #define SAL_PRIdINT64 "I64d"
90 #define SAL_PRIuUINT64 "I64u"
91 #define SAL_PRIxUINT64 "I64x"
92 #define SAL_PRIXUINT64 "I64X"
93 #elif defined (__GNUC__)
94 #if SAL_TYPES_SIZEOFLONG == 8
95 typedef signed long int sal_Int64;
96 typedef unsigned long int sal_uInt64;
100 #define SAL_CONST_INT64(x) x##l
101 #define SAL_CONST_UINT64(x) x##ul
103 #define SAL_PRIdINT64 "ld"
104 #define SAL_PRIuUINT64 "lu"
105 #define SAL_PRIxUINT64 "lx"
106 #define SAL_PRIXUINT64 "lX"
107 #elif SAL_TYPES_SIZEOFLONGLONG == 8
108 typedef signed long long sal_Int64;
109 typedef unsigned long long sal_uInt64;
112 #define SAL_CONST_INT64(x) x##ll
113 #define SAL_CONST_UINT64(x) x##ull
115 #define SAL_PRIdINT64 "lld"
116 #define SAL_PRIuUINT64 "llu"
117 #define SAL_PRIxUINT64 "llx"
118 #define SAL_PRIXUINT64 "llX"
120 #error "Could not find 64-bit type, add support for your architecture"
123 #error "Please define the 64-bit types for your architecture/compiler in sal/inc/sal/types.h"
144 #if ( defined(SAL_W32) && !defined(__MINGW32__) )
151 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
158 #if SAL_TYPES_SIZEOFPOINTER == 4
159 typedef sal_uInt32 sal_Size;
160 typedef sal_Int32 sal_sSize;
161 #elif SAL_TYPES_SIZEOFPOINTER == 8
162 typedef sal_uInt64 sal_Size;
163 typedef sal_Int64 sal_sSize;
165 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
169 #if SAL_TYPES_SIZEOFPOINTER == 4
170 typedef sal_Int32 sal_PtrDiff;
171 #elif SAL_TYPES_SIZEOFPOINTER == 8
172 typedef sal_Int64 sal_PtrDiff;
174 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
179 #if defined(_MSC_VER)
180 #define SAL_PRI_SIZET "I"
181 #define SAL_PRI_PTRDIFFT "I"
183 #define SAL_PRI_SIZET "z"
184 #define SAL_PRI_PTRDIFFT "t"
190 #if SAL_TYPES_SIZEOFPOINTER == 4
191 typedef sal_Int32 sal_IntPtr;
192 typedef sal_uInt32 sal_uIntPtr;
193 #define SAL_PRIdINTPTR SAL_PRIdINT32
194 #define SAL_PRIuUINTPTR SAL_PRIuUINT32
195 #define SAL_PRIxUINTPTR SAL_PRIxUINT32
196 #define SAL_PRIXUINTPTR SAL_PRIXUINT32
197 #elif SAL_TYPES_SIZEOFPOINTER == 8
198 typedef sal_Int64 sal_IntPtr;
199 typedef sal_uInt64 sal_uIntPtr;
200 #define SAL_PRIdINTPTR SAL_PRIdINT64
201 #define SAL_PRIuUINTPTR SAL_PRIuUINT64
202 #define SAL_PRIxUINTPTR SAL_PRIxUINT64
203 #define SAL_PRIXUINTPTR SAL_PRIXUINT64
205 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
217 #define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
218 #define SAL_MAX_INT8 ((sal_Int8) 0x7F)
219 #define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
220 #define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
221 #define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
222 #define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
223 #define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
224 #define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
225 #define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
226 #define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
227 #define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
228 #define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
230 #if SAL_TYPES_SIZEOFPOINTER == 4
231 #define SAL_MAX_SSIZE SAL_MAX_INT32
232 #define SAL_MAX_SIZE SAL_MAX_UINT32
233 #elif SAL_TYPES_SIZEOFPOINTER == 8
234 #define SAL_MAX_SSIZE SAL_MAX_INT64
235 #define SAL_MAX_SIZE SAL_MAX_UINT64
238 #define SAL_MAX_ENUM 0x7fffffff
240 #if defined(_MSC_VER) || defined(__MINGW32__)
241 # define SAL_DLLPUBLIC_EXPORT __declspec(dllexport)
242 # define SAL_JNI_EXPORT __declspec(dllexport)
243 #if defined(_MSC_VER)
244 # define SAL_DLLPUBLIC_IMPORT __declspec(dllimport)
246 # define SAL_DLLPUBLIC_IMPORT
247 #endif // defined(_MSC_VER)
248 # define SAL_DLLPRIVATE
249 # define SAL_DLLPUBLIC_TEMPLATE
250 # define SAL_DLLPUBLIC_RTTI
251 # define SAL_CALL __cdecl
252 # define SAL_CALL_ELLIPSE __cdecl
253 #elif defined SAL_UNX
254 # if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
255 # if defined(DISABLE_DYNLOADING)
256 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
257 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
258 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
259 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
260 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
261 # define SAL_DLLPUBLIC_RTTI
263 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
264 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
265 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("default")))
266 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
267 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("default")))
268 # if defined __clang__
269 # if __has_attribute(type_visibility)
270 # define SAL_DLLPUBLIC_RTTI __attribute__ ((type_visibility("default")))
272 # define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
275 # define SAL_DLLPUBLIC_RTTI
279 # define SAL_DLLPUBLIC_EXPORT
280 # define SAL_JNI_EXPORT
281 # define SAL_DLLPUBLIC_IMPORT
282 # define SAL_DLLPRIVATE
283 # define SAL_DLLPUBLIC_TEMPLATE
284 # define SAL_DLLPUBLIC_RTTI
287 # define SAL_CALL_ELLIPSE
289 # error("unknown platform")
298 #if defined(__GNUC__) && ! defined(__MINGW32__)
299 # if defined(DISABLE_DYNLOADING)
300 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT __attribute__((visibility("default")))
302 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
304 # define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
306 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT
307 # define SAL_EXCEPTION_DLLPRIVATE
316 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
317 # define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
319 # define SAL_WARN_UNUSED_RESULT
327 # define SAL_NO_VTABLE __declspec(novtable)
329 # define SAL_NO_VTABLE
333 # pragma pack(push, 8)
352 #define SAL_SEQUENCE_HEADER_SIZE ((sal_Size) offsetof(sal_Sequence,elements))
354 #if defined( SAL_W32)
358 #if defined __cplusplus
364 #define SAL_THROW_EXTERN_C() throw ()
368 #define SAL_THROW_EXTERN_C()
385 namespace com {
namespace sun {
namespace star { } } }
391 namespace css = ::com::sun::star;
401 #if HAVE_CXX11_DELETE
402 #define SAL_DELETED_FUNCTION = delete
404 #define SAL_DELETED_FUNCTION
414 #if HAVE_CXX11_OVERRIDE
415 #define SAL_OVERRIDE override
427 #define SAL_FINAL final
436 #if HAVE_CXX11_CONSTEXPR
437 #define SAL_CONSTEXPR constexpr
439 #define SAL_CONSTEXPR
460 return static_cast< T1
>(n);
479 #define SAL_INT_CAST(type, expr) ((type) (expr))
488 #if HAVE_GCC_DEPRECATED_MESSAGE
489 # define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
491 # define SAL_DEPRECATED(message) __attribute__((deprecated))
492 #elif defined(_MSC_VER)
493 # define SAL_DEPRECATED(message) __declspec(deprecated(message))
495 # define SAL_DEPRECATED(message)
507 #ifdef LIBO_INTERNAL_ONLY
508 # define SAL_DEPRECATED_INTERNAL(message)
510 # define SAL_DEPRECATED_INTERNAL(message) SAL_DEPRECATED(message)
520 #if HAVE_GCC_PRAGMA_OPERATOR
521 #define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
522 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
523 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
524 #define SAL_WNODEPRECATED_DECLARATIONS_POP \
525 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic pop))
527 # define SAL_WNODEPRECATED_DECLARATIONS_PUSH
528 # define SAL_WNODEPRECATED_DECLARATIONS_POP
548 #define SAL_WNOUNREACHABLE_CODE_PUSH \
549 __pragma(warning(push)) \
550 __pragma(warning(disable:4702)) \
551 __pragma(warning(disable:4722))
552 #define SAL_WNOUNREACHABLE_CODE_POP \
553 __pragma(warning(pop))
556 #define SAL_WNOUNREACHABLE_CODE_PUSH
557 #define SAL_WNOUNREACHABLE_CODE_POP
583 #if defined __cplusplus
585 #define SAL_UNUSED_PARAMETER __attribute__ ((unused))
587 #define SAL_UNUSED_PARAMETER
603 #if HAVE_GCC_ATTRIBUTE_WARN_UNUSED
604 #define SAL_WARN_UNUSED __attribute__((warn_unused))
605 #elif defined __clang__
606 #define SAL_WARN_UNUSED __attribute__((annotate("lo_warn_unused")))
608 #define SAL_WARN_UNUSED
611 #endif // INCLUDED_SAL_TYPES_H
void * sal_Handle
Definition: types.h:155
char sal_Char
A legacy synonym for char.
Definition: types.h:130
unsigned char sal_Bool
Definition: types.h:48
unsigned char sal_uInt8
Definition: types.h:54
struct _sal_Sequence sal_Sequence
This is the binary specification of a SAL sequence.
This is the binary specification of a SAL sequence.
Definition: types.h:339
definition of a no acquire enum for ctors
Definition: types.h:382
__sal_NoAcquire
Definition: types.h:378
char elements[1]
elements array
Definition: types.h:349
sal_Int32 nElements
element count
Definition: types.h:346
signed char sal_sChar
A legacy synonym for signed char.
Definition: types.h:136
sal_uInt16 sal_Unicode
Definition: types.h:152
signed char sal_Int8
Definition: types.h:53
unsigned char sal_uChar
A legacy synonym for unsigned char.
Definition: types.h:142
T1 static_int_cast(T2 n)
A static_cast between integral types, to avoid C++ compiler warnings.
Definition: types.h:459
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:343