LibreOffice
LibreOffice 6.0 SDK C/C++ API Reference
|
Go to the documentation of this file.
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 ()
358 #if defined(LIBO_INTERNAL_ONLY) && defined(__COVERITY__)
359 # define COVERITY_NOEXCEPT_FALSE noexcept(false)
361 # define COVERITY_NOEXCEPT_FALSE
366 #define SAL_THROW_EXTERN_C()
383 namespace com {
namespace sun {
namespace star { } } }
389 namespace css = ::com::sun::star;
399 #if defined LIBO_INTERNAL_ONLY
400 #define SAL_DELETED_FUNCTION = delete
402 #define SAL_DELETED_FUNCTION
412 #if defined LIBO_INTERNAL_ONLY
413 #define SAL_OVERRIDE override
424 #if defined LIBO_INTERNAL_ONLY
425 #define SAL_FINAL final
430 #if defined LIBO_INTERNAL_ONLY
431 #if defined __clang__
432 #define SAL_FALLTHROUGH [[clang::fallthrough]]
433 #elif defined __GNUC__ && __GNUC__ >= 7
434 #define SAL_FALLTHROUGH [[fallthrough]]
436 #define SAL_FALLTHROUGH
458 return static_cast< T1
>(n);
477 #define SAL_INT_CAST(type, expr) ((type) (expr))
486 #if HAVE_GCC_DEPRECATED_MESSAGE
487 # define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
488 #elif defined __GNUC__ || defined __clang__
489 # define SAL_DEPRECATED(message) __attribute__((deprecated))
490 #elif defined(_MSC_VER)
491 # define SAL_DEPRECATED(message) __declspec(deprecated(message))
493 # 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
584 #if defined __GNUC__ || defined __clang__
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))
606 #define SAL_WARN_UNUSED
611 #if defined __GNUC__ || defined __clang__
613 # define SAL_DETAIL_BOOLEAN_EXPR(expr) \
615 int sal_boolean_var_; \
617 sal_boolean_var_ = 1; \
619 sal_boolean_var_ = 0; \
633 # define SAL_LIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 1)
645 # define SAL_UNLIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 0)
658 # define SAL_HOT __attribute__((hot))
673 # define SAL_COLD __attribute__((cold))
675 # define SAL_LIKELY(expr) (expr)
676 # define SAL_UNLIKELY(expr) (expr)
693 #ifndef __has_attribute
694 #define __has_attribute(x) 0
697 #if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && __GNUC__ > 4) || (defined __clang__ && __has_attribute(returns_nonnull)))
698 #define SAL_RETURNS_NONNULL __attribute__((returns_nonnull))
700 #define SAL_RETURNS_NONNULL
704 #endif // INCLUDED_SAL_TYPES_H
char sal_Char
A legacy synonym for char.
Definition: types.h:121
sal_Int32 nElements
element count
Definition: types.h:334
char elements[1]
elements array
Definition: types.h:337
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:380
void * sal_Handle
Definition: types.h:145
unsigned char sal_uInt8
Definition: types.h:45
struct _sal_Sequence sal_Sequence
This is the binary specification of a SAL sequence.
unsigned char sal_Bool
Definition: types.h:39
__sal_NoAcquire
Definition: types.h:376
sal_uInt16 sal_Unicode
Definition: types.h:142
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:331
unsigned char sal_uChar
A legacy synonym for unsigned char.
Definition: types.h:133
signed char sal_sChar
A legacy synonym for signed char.
Definition: types.h:127
signed char sal_Int8
Definition: types.h:44
T1 static_int_cast(T2 n)
A static_cast between integral types, to avoid C++ compiler warnings.
Definition: types.h:457
This is the binary specification of a SAL sequence.
Definition: types.h:327