20 #ifndef INCLUDED_SAL_TYPES_H
21 #define INCLUDED_SAL_TYPES_H
32 #if defined ( __MINGW32__ ) && !defined ( __USE_MINGW_ANSI_STDIO )
38 #define __USE_MINGW_ANSI_STDIO 1
47 # define sal_False ((sal_Bool)0)
48 # define sal_True ((sal_Bool)1)
54 #if SAL_TYPES_SIZEOFSHORT == 2
55 typedef signed short sal_Int16;
56 typedef unsigned short sal_uInt16;
58 #error "Could not find 16-bit type, add support for your architecture"
61 #if SAL_TYPES_SIZEOFLONG == 4
62 typedef signed long sal_Int32;
63 typedef unsigned long sal_uInt32;
64 #define SAL_PRIdINT32 "ld"
65 #define SAL_PRIuUINT32 "lu"
66 #define SAL_PRIxUINT32 "lx"
67 #define SAL_PRIXUINT32 "lX"
68 #elif SAL_TYPES_SIZEOFINT == 4
69 typedef signed int sal_Int32;
70 typedef unsigned int sal_uInt32;
71 #define SAL_PRIdINT32 "d"
72 #define SAL_PRIuUINT32 "u"
73 #define SAL_PRIxUINT32 "x"
74 #define SAL_PRIXUINT32 "X"
76 #error "Could not find 32-bit type, add support for your architecture"
80 typedef __int64 sal_Int64;
81 typedef unsigned __int64 sal_uInt64;
84 #define SAL_CONST_INT64(x) x##i64
85 #define SAL_CONST_UINT64(x) x##ui64
87 #define SAL_PRIdINT64 "I64d"
88 #define SAL_PRIuUINT64 "I64u"
89 #define SAL_PRIxUINT64 "I64x"
90 #define SAL_PRIXUINT64 "I64X"
91 #elif defined (__GNUC__)
92 #if SAL_TYPES_SIZEOFLONG == 8
93 typedef signed long int sal_Int64;
94 typedef unsigned long int sal_uInt64;
98 #define SAL_CONST_INT64(x) x##l
99 #define SAL_CONST_UINT64(x) x##ul
101 #define SAL_PRIdINT64 "ld"
102 #define SAL_PRIuUINT64 "lu"
103 #define SAL_PRIxUINT64 "lx"
104 #define SAL_PRIXUINT64 "lX"
105 #elif SAL_TYPES_SIZEOFLONGLONG == 8
106 typedef signed long long sal_Int64;
107 typedef unsigned long long sal_uInt64;
110 #define SAL_CONST_INT64(x) x##ll
111 #define SAL_CONST_UINT64(x) x##ull
113 #define SAL_PRIdINT64 "lld"
114 #define SAL_PRIuUINT64 "llu"
115 #define SAL_PRIxUINT64 "llx"
116 #define SAL_PRIXUINT64 "llX"
118 #error "Could not find 64-bit type, add support for your architecture"
121 #error "Please define the 64-bit types for your architecture/compiler in sal/inc/sal/types.h"
142 #if ( defined(SAL_W32) && !defined(__MINGW32__) )
149 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
156 #if SAL_TYPES_SIZEOFPOINTER == 4
157 typedef sal_uInt32 sal_Size;
158 typedef sal_Int32 sal_sSize;
159 #elif SAL_TYPES_SIZEOFPOINTER == 8
160 typedef sal_uInt64 sal_Size;
161 typedef sal_Int64 sal_sSize;
163 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
167 #if SAL_TYPES_SIZEOFPOINTER == 4
168 typedef sal_Int32 sal_PtrDiff;
169 #elif SAL_TYPES_SIZEOFPOINTER == 8
170 typedef sal_Int64 sal_PtrDiff;
172 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
177 #if defined(_MSC_VER)
178 #define SAL_PRI_SIZET "I"
179 #define SAL_PRI_PTRDIFFT "I"
181 #define SAL_PRI_SIZET "z"
182 #define SAL_PRI_PTRDIFFT "t"
188 #if SAL_TYPES_SIZEOFPOINTER == 4
189 typedef sal_Int32 sal_IntPtr;
190 typedef sal_uInt32 sal_uIntPtr;
191 #define SAL_PRIdINTPTR SAL_PRIdINT32
192 #define SAL_PRIuUINTPTR SAL_PRIuUINT32
193 #define SAL_PRIxUINTPTR SAL_PRIxUINT32
194 #define SAL_PRIXUINTPTR SAL_PRIXUINT32
195 #elif SAL_TYPES_SIZEOFPOINTER == 8
196 typedef sal_Int64 sal_IntPtr;
197 typedef sal_uInt64 sal_uIntPtr;
198 #define SAL_PRIdINTPTR SAL_PRIdINT64
199 #define SAL_PRIuUINTPTR SAL_PRIuUINT64
200 #define SAL_PRIxUINTPTR SAL_PRIxUINT64
201 #define SAL_PRIXUINTPTR SAL_PRIXUINT64
203 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
215 #define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
216 #define SAL_MAX_INT8 ((sal_Int8) 0x7F)
217 #define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
218 #define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
219 #define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
220 #define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
221 #define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
222 #define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
223 #define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
224 #define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
225 #define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
226 #define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
228 #if SAL_TYPES_SIZEOFLONG == 4
229 #define SAL_MAX_SSIZE SAL_MAX_INT32
230 #define SAL_MAX_SIZE SAL_MAX_UINT32
231 #elif SAL_TYPES_SIZEOFLONG == 8
232 #define SAL_MAX_SSIZE SAL_MAX_INT64
233 #define SAL_MAX_SIZE SAL_MAX_UINT64
236 #if defined(SAL_W32) || defined(SAL_UNX)
237 # 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_CALL __cdecl
251 # define SAL_CALL_ELLIPSE __cdecl
252 #elif defined SAL_UNX
253 # if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
254 # if defined(DISABLE_DYNLOADING)
255 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
256 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
257 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
258 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
259 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
261 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
262 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
263 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("default")))
264 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
265 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("default")))
268 # define SAL_DLLPUBLIC_EXPORT
269 # define SAL_JNI_EXPORT
270 # define SAL_DLLPUBLIC_IMPORT
271 # define SAL_DLLPRIVATE
272 # define SAL_DLLPUBLIC_TEMPLATE
275 # define SAL_CALL_ELLIPSE
277 # error("unknown platform")
286 #if defined(__GNUC__) && ! defined(__MINGW32__)
287 # if defined(DISABLE_DYNLOADING)
288 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT __attribute__((visibility("default")))
290 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
292 # define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
294 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT
295 # define SAL_EXCEPTION_DLLPRIVATE
304 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
305 # define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
307 # define SAL_WARN_UNUSED_RESULT
315 # define SAL_NO_VTABLE __declspec(novtable)
317 # define SAL_NO_VTABLE
321 # pragma pack(push, 8)
340 #define SAL_SEQUENCE_HEADER_SIZE ((sal_Size)&((sal_Sequence *)0)->elements)
342 #if defined( SAL_W32)
346 #if defined __cplusplus
367 #define SAL_THROW_EXTERN_C() throw ()
374 #define SAL_THROW_EXTERN_C()
391 namespace com {
namespace sun {
namespace star { } } }
397 namespace css = ::com::sun::star;
407 #if HAVE_CXX11_DELETE
408 #define SAL_DELETED_FUNCTION = delete
410 #define SAL_DELETED_FUNCTION
420 #if HAVE_CXX11_OVERRIDE
421 #define SAL_OVERRIDE override
433 #define SAL_FINAL final
456 return static_cast< T1
>(n);
475 #define SAL_INT_CAST(type, expr) ((type) (expr))
484 #if HAVE_GCC_DEPRECATED_MESSAGE
485 # define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
487 # define SAL_DEPRECATED(message) __attribute__((deprecated))
488 #elif defined(_MSC_VER)
489 # define SAL_DEPRECATED(message) __declspec(deprecated(message))
491 # define SAL_DEPRECATED(message)
503 #ifdef LIBO_INTERNAL_ONLY
504 # define SAL_DEPRECATED_INTERNAL(message)
506 # define SAL_DEPRECATED_INTERNAL(message) SAL_DEPRECATED(message)
516 #if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE && HAVE_GCC_PRAGMA_OPERATOR
517 #define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
518 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
519 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
520 #define SAL_WNODEPRECATED_DECLARATIONS_POP \
521 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic pop))
523 # define SAL_WNODEPRECATED_DECLARATIONS_PUSH
524 # define SAL_WNODEPRECATED_DECLARATIONS_POP
544 #define SAL_WNOUNREACHABLE_CODE_PUSH \
545 __pragma(warning(push)) \
546 __pragma(warning(disable:4702))
547 #define SAL_WNOUNREACHABLE_CODE_POP \
548 __pragma(warning(pop))
551 #define SAL_WNOUNREACHABLE_CODE_PUSH
552 #define SAL_WNOUNREACHABLE_CODE_POP
578 #if defined __cplusplus
580 #define SAL_UNUSED_PARAMETER __attribute__ ((unused))
582 #define SAL_UNUSED_PARAMETER
598 #if HAVE_GCC_ATTRIBUTE_WARN_UNUSED
599 #define SAL_WARN_UNUSED __attribute__((warn_unused))
600 #elif defined __clang__
601 #define SAL_WARN_UNUSED __attribute__((annotate("lo_warn_unused")))
603 #define SAL_WARN_UNUSED
606 #endif // INCLUDED_SAL_TYPES_H
signed char sal_sChar
A legacy synonym for signed char.
Definition: types.h:134
unsigned char sal_Bool
Definition: types.h:46
definition of a no acquire enum for ctors
Definition: types.h:388
__sal_NoAcquire
Definition: types.h:384
void * sal_Handle
Definition: types.h:153
unsigned char sal_uInt8
Definition: types.h:52
char sal_Char
A legacy synonym for char.
Definition: types.h:128
unsigned char sal_uChar
A legacy synonym for unsigned char.
Definition: types.h:140
This is the binary specification of a SAL sequence.
Definition: types.h:327
signed char sal_Int8
Definition: types.h:51
char elements[1]
elements array
Definition: types.h:337
sal_Int32 nElements
element count
Definition: types.h:334
T1 static_int_cast(T2 n)
A static_cast between integral types, to avoid C++ compiler warnings.
Definition: types.h:455
struct _sal_Sequence sal_Sequence
This is the binary specification of a SAL sequence.
sal_uInt16 sal_Unicode
Definition: types.h:150
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:331