20 #ifndef INCLUDED_SAL_TYPES_H
21 #define INCLUDED_SAL_TYPES_H
40 # define sal_False ((sal_Bool)0)
41 # define sal_True ((sal_Bool)1)
47 #if SAL_TYPES_SIZEOFSHORT == 2
48 typedef signed short sal_Int16;
49 typedef unsigned short sal_uInt16;
51 #error "Could not find 16-bit type, add support for your architecture"
54 #if SAL_TYPES_SIZEOFLONG == 4
55 typedef signed long sal_Int32;
56 typedef unsigned long sal_uInt32;
57 #define SAL_PRIdINT32 "ld"
58 #define SAL_PRIuUINT32 "lu"
59 #define SAL_PRIxUINT32 "lx"
60 #define SAL_PRIXUINT32 "lX"
61 #elif SAL_TYPES_SIZEOFINT == 4
62 typedef signed int sal_Int32;
63 typedef unsigned int sal_uInt32;
64 #define SAL_PRIdINT32 "d"
65 #define SAL_PRIuUINT32 "u"
66 #define SAL_PRIxUINT32 "x"
67 #define SAL_PRIXUINT32 "X"
69 #error "Could not find 32-bit type, add support for your architecture"
73 typedef __int64 sal_Int64;
74 typedef unsigned __int64 sal_uInt64;
77 #define SAL_CONST_INT64(x) x##i64
78 #define SAL_CONST_UINT64(x) x##ui64
80 #define SAL_PRIdINT64 "I64d"
81 #define SAL_PRIuUINT64 "I64u"
82 #define SAL_PRIxUINT64 "I64x"
83 #define SAL_PRIXUINT64 "I64X"
84 #elif defined (__GNUC__)
85 #if SAL_TYPES_SIZEOFLONG == 8
86 typedef signed long int sal_Int64;
87 typedef unsigned long int sal_uInt64;
91 #define SAL_CONST_INT64(x) x##l
92 #define SAL_CONST_UINT64(x) x##ul
94 #define SAL_PRIdINT64 "ld"
95 #define SAL_PRIuUINT64 "lu"
96 #define SAL_PRIxUINT64 "lx"
97 #define SAL_PRIXUINT64 "lX"
98 #elif SAL_TYPES_SIZEOFLONGLONG == 8
99 typedef signed long long sal_Int64;
100 typedef unsigned long long sal_uInt64;
103 #define SAL_CONST_INT64(x) x##ll
104 #define SAL_CONST_UINT64(x) x##ull
106 #define SAL_PRIdINT64 "lld"
107 #define SAL_PRIuUINT64 "llu"
108 #define SAL_PRIxUINT64 "llx"
109 #define SAL_PRIXUINT64 "llX"
111 #error "Could not find 64-bit type, add support for your architecture"
114 #error "Please define the 64-bit types for your architecture/compiler in include/sal/types.h"
135 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
136 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
138 #elif defined(SAL_W32)
141 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
148 #if SAL_TYPES_SIZEOFPOINTER == 4
149 typedef sal_uInt32 sal_Size;
150 typedef sal_Int32 sal_sSize;
151 #elif SAL_TYPES_SIZEOFPOINTER == 8
152 typedef sal_uInt64 sal_Size;
153 typedef sal_Int64 sal_sSize;
155 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
159 #if SAL_TYPES_SIZEOFPOINTER == 4
160 typedef sal_Int32 sal_PtrDiff;
161 #elif SAL_TYPES_SIZEOFPOINTER == 8
162 typedef sal_Int64 sal_PtrDiff;
164 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
169 #if defined(_MSC_VER)
170 #define SAL_PRI_SIZET "I"
171 #define SAL_PRI_PTRDIFFT "I"
173 #define SAL_PRI_SIZET "z"
174 #define SAL_PRI_PTRDIFFT "t"
180 #if SAL_TYPES_SIZEOFPOINTER == 4
181 typedef sal_Int32 sal_IntPtr;
182 typedef sal_uInt32 sal_uIntPtr;
183 #define SAL_PRIdINTPTR SAL_PRIdINT32
184 #define SAL_PRIuUINTPTR SAL_PRIuUINT32
185 #define SAL_PRIxUINTPTR SAL_PRIxUINT32
186 #define SAL_PRIXUINTPTR SAL_PRIXUINT32
187 #elif SAL_TYPES_SIZEOFPOINTER == 8
188 typedef sal_Int64 sal_IntPtr;
189 typedef sal_uInt64 sal_uIntPtr;
190 #define SAL_PRIdINTPTR SAL_PRIdINT64
191 #define SAL_PRIuUINTPTR SAL_PRIuUINT64
192 #define SAL_PRIxUINTPTR SAL_PRIxUINT64
193 #define SAL_PRIXUINTPTR SAL_PRIXUINT64
195 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
207 #define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
208 #define SAL_MAX_INT8 ((sal_Int8) 0x7F)
209 #define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
210 #define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
211 #define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
212 #define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
213 #define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
214 #define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
215 #define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
216 #define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
217 #define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
218 #define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
220 #if SAL_TYPES_SIZEOFPOINTER == 4
221 #define SAL_MAX_SSIZE SAL_MAX_INT32
222 #define SAL_MAX_SIZE SAL_MAX_UINT32
223 #elif SAL_TYPES_SIZEOFPOINTER == 8
224 #define SAL_MAX_SSIZE SAL_MAX_INT64
225 #define SAL_MAX_SIZE SAL_MAX_UINT64
228 #define SAL_MAX_ENUM 0x7fffffff
230 #if defined(_MSC_VER)
231 # define SAL_DLLPUBLIC_EXPORT __declspec(dllexport)
232 # define SAL_JNI_EXPORT __declspec(dllexport)
233 # define SAL_DLLPUBLIC_IMPORT __declspec(dllimport)
234 # define SAL_DLLPRIVATE
235 # define SAL_DLLPUBLIC_TEMPLATE
236 # define SAL_DLLPUBLIC_RTTI
237 # define SAL_CALL __cdecl
238 # define SAL_CALL_ELLIPSE __cdecl
239 #elif defined SAL_UNX
240 # if defined(__GNUC__)
241 # if defined(DISABLE_DYNLOADING)
242 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
243 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
244 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
245 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
246 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
247 # define SAL_DLLPUBLIC_RTTI
249 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
250 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
251 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("default")))
252 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
253 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("default")))
254 # if defined __clang__
255 # if __has_attribute(type_visibility)
256 # define SAL_DLLPUBLIC_RTTI __attribute__ ((type_visibility("default")))
258 # define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
261 # define SAL_DLLPUBLIC_RTTI
265 # define SAL_DLLPUBLIC_EXPORT
266 # define SAL_JNI_EXPORT
267 # define SAL_DLLPUBLIC_IMPORT
268 # define SAL_DLLPRIVATE
269 # define SAL_DLLPUBLIC_TEMPLATE
270 # define SAL_DLLPUBLIC_RTTI
273 # define SAL_CALL_ELLIPSE
275 # error("unknown platform")
284 #if defined(__GNUC__)
285 # if defined(DISABLE_DYNLOADING)
286 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT __attribute__((visibility("default")))
288 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
290 # define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
292 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT
293 # define SAL_EXCEPTION_DLLPRIVATE
302 #if (defined __GNUC__ \
303 && (__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) offsetof(sal_Sequence,elements))
342 #if defined( SAL_W32)
346 #if defined __cplusplus
352 #define SAL_THROW_EXTERN_C() throw ()
356 #define SAL_THROW_EXTERN_C()
373 namespace com {
namespace sun {
namespace star { } } }
379 namespace css = ::com::sun::star;
389 #if defined LIBO_INTERNAL_ONLY
390 #define SAL_DELETED_FUNCTION = delete
392 #define SAL_DELETED_FUNCTION
402 #if defined LIBO_INTERNAL_ONLY
403 #define SAL_OVERRIDE override
414 #if defined LIBO_INTERNAL_ONLY
415 #define SAL_FINAL final
420 #if defined LIBO_INTERNAL_ONLY
421 #if defined __clang__
422 #define SAL_FALLTHROUGH [[clang::fallthrough]]
423 #elif defined __GNUC__ && __GNUC__ >= 7
424 #define SAL_FALLTHROUGH [[fallthrough]]
426 #define SAL_FALLTHROUGH
448 return static_cast< T1
>(n);
467 #define SAL_INT_CAST(type, expr) ((type) (expr))
476 #if HAVE_GCC_DEPRECATED_MESSAGE
477 # define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
478 #elif defined __GNUC__ || defined __clang__
479 # define SAL_DEPRECATED(message) __attribute__((deprecated))
480 #elif defined(_MSC_VER)
481 # define SAL_DEPRECATED(message) __declspec(deprecated(message))
483 # define SAL_DEPRECATED(message)
497 #ifdef LIBO_INTERNAL_ONLY
498 # define SAL_DEPRECATED_INTERNAL(message)
500 # define SAL_DEPRECATED_INTERNAL(message) SAL_DEPRECATED(message)
510 #if HAVE_GCC_PRAGMA_OPERATOR
511 #define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
512 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
513 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
514 #define SAL_WNODEPRECATED_DECLARATIONS_POP \
515 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic pop))
517 # define SAL_WNODEPRECATED_DECLARATIONS_PUSH
518 # define SAL_WNODEPRECATED_DECLARATIONS_POP
538 #define SAL_WNOUNREACHABLE_CODE_PUSH \
539 __pragma(warning(push)) \
540 __pragma(warning(disable:4702)) \
541 __pragma(warning(disable:4722))
542 #define SAL_WNOUNREACHABLE_CODE_POP \
543 __pragma(warning(pop))
546 #define SAL_WNOUNREACHABLE_CODE_PUSH
547 #define SAL_WNOUNREACHABLE_CODE_POP
573 #if defined __cplusplus
574 #if defined __GNUC__ || defined __clang__
575 #define SAL_UNUSED_PARAMETER __attribute__ ((unused))
577 #define SAL_UNUSED_PARAMETER
593 #if HAVE_GCC_ATTRIBUTE_WARN_UNUSED
594 #define SAL_WARN_UNUSED __attribute__((warn_unused))
595 #elif defined __clang__
596 #define SAL_WARN_UNUSED __attribute__((annotate("lo_warn_unused")))
598 #define SAL_WARN_UNUSED
603 #if defined __GNUC__ || defined __clang__
605 # define SAL_DETAIL_BOOLEAN_EXPR(expr) \
607 int sal_boolean_var_; \
609 sal_boolean_var_ = 1; \
611 sal_boolean_var_ = 0; \
625 # define SAL_LIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 1)
637 # define SAL_UNLIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 0)
650 # define SAL_HOT __attribute__((hot))
665 # define SAL_COLD __attribute__((cold))
667 # define SAL_LIKELY(expr) (expr)
668 # define SAL_UNLIKELY(expr) (expr)
675 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus && defined SAL_W32
679 inline wchar_t * SAL_W(char16_t * p)
680 {
return reinterpret_cast<wchar_t *
>(p); }
681 inline wchar_t const * SAL_W(char16_t
const * p)
682 {
return reinterpret_cast<wchar_t const *
>(p); }
683 inline char16_t * SAL_U(
wchar_t * p)
684 {
return reinterpret_cast<char16_t *
>(p); }
685 inline char16_t
const * SAL_U(
wchar_t const * p)
686 {
return reinterpret_cast<char16_t
const *
>(p); }
690 #endif // INCLUDED_SAL_TYPES_H
void * sal_Handle
Definition: types.h:145
char sal_Char
A legacy synonym for char.
Definition: types.h:121
unsigned char sal_Bool
Definition: types.h:39
unsigned char sal_uInt8
Definition: types.h:45
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:327
definition of a no acquire enum for ctors
Definition: types.h:370
__sal_NoAcquire
Definition: types.h:366
char elements[1]
elements array
Definition: types.h:337
sal_Int32 nElements
element count
Definition: types.h:334
signed char sal_sChar
A legacy synonym for signed char.
Definition: types.h:127
sal_uInt16 sal_Unicode
Definition: types.h:142
signed char sal_Int8
Definition: types.h:44
unsigned char sal_uChar
A legacy synonym for unsigned char.
Definition: types.h:133
T1 static_int_cast(T2 n)
A static_cast between integral types, to avoid C++ compiler warnings.
Definition: types.h:447
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:331