4 #ifndef INCLUDED_SAL_TYPES_H
5 #define INCLUDED_SAL_TYPES_H
19 # define sal_False ((sal_Bool)0)
20 # define sal_True ((sal_Bool)1)
26 #if SAL_TYPES_SIZEOFSHORT == 2
27 typedef signed short sal_Int16;
28 typedef unsigned short sal_uInt16;
30 #error "Could not find 16-bit type, add support for your architecture"
33 #if SAL_TYPES_SIZEOFLONG == 4
34 typedef signed long sal_Int32;
35 typedef unsigned long sal_uInt32;
36 #define SAL_PRIdINT32 "ld"
37 #define SAL_PRIuUINT32 "lu"
38 #define SAL_PRIxUINT32 "lx"
39 #define SAL_PRIXUINT32 "lX"
40 #elif SAL_TYPES_SIZEOFINT == 4
41 typedef signed int sal_Int32;
42 typedef unsigned int sal_uInt32;
43 #define SAL_PRIdINT32 "d"
44 #define SAL_PRIuUINT32 "u"
45 #define SAL_PRIxUINT32 "x"
46 #define SAL_PRIXUINT32 "X"
48 #error "Could not find 32-bit type, add support for your architecture"
52 typedef __int64 sal_Int64;
53 typedef unsigned __int64 sal_uInt64;
56 #define SAL_CONST_INT64(x) x##i64
57 #define SAL_CONST_UINT64(x) x##ui64
59 #define SAL_PRIdINT64 "I64d"
60 #define SAL_PRIuUINT64 "I64u"
61 #define SAL_PRIxUINT64 "I64x"
62 #define SAL_PRIXUINT64 "I64X"
63 #elif defined (__GNUC__)
64 #if SAL_TYPES_SIZEOFLONG == 8
65 typedef signed long int sal_Int64;
66 typedef unsigned long int sal_uInt64;
70 #define SAL_CONST_INT64(x) x##l
71 #define SAL_CONST_UINT64(x) x##ul
73 #define SAL_PRIdINT64 "ld"
74 #define SAL_PRIuUINT64 "lu"
75 #define SAL_PRIxUINT64 "lx"
76 #define SAL_PRIXUINT64 "lX"
77 #elif SAL_TYPES_SIZEOFLONGLONG == 8
78 typedef signed long long sal_Int64;
79 typedef unsigned long long sal_uInt64;
82 #define SAL_CONST_INT64(x) x##ll
83 #define SAL_CONST_UINT64(x) x##ull
85 #define SAL_PRIdINT64 "lld"
86 #define SAL_PRIuUINT64 "llu"
87 #define SAL_PRIxUINT64 "llx"
88 #define SAL_PRIXUINT64 "llX"
90 #error "Could not find 64-bit type, add support for your architecture"
93 #error "Please define the 64-bit types for your architecture/compiler in include/sal/types.h"
96 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
97 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
102 #define SAL_UNICODE_NOTEQUAL_WCHAR_T
109 #if SAL_TYPES_SIZEOFPOINTER == 4
110 typedef sal_uInt32 sal_Size;
111 typedef sal_Int32 sal_sSize;
112 #elif SAL_TYPES_SIZEOFPOINTER == 8
113 typedef sal_uInt64 sal_Size;
114 typedef sal_Int64 sal_sSize;
116 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
120 #if SAL_TYPES_SIZEOFPOINTER == 4
121 typedef sal_Int32 sal_PtrDiff;
122 #elif SAL_TYPES_SIZEOFPOINTER == 8
123 typedef sal_Int64 sal_PtrDiff;
125 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
130 #if defined(_MSC_VER)
131 #define SAL_PRI_SIZET "I"
132 #define SAL_PRI_PTRDIFFT "I"
134 #define SAL_PRI_SIZET "z"
135 #define SAL_PRI_PTRDIFFT "t"
141 #if SAL_TYPES_SIZEOFPOINTER == 4
142 typedef sal_Int32 sal_IntPtr;
143 typedef sal_uInt32 sal_uIntPtr;
144 #define SAL_PRIdINTPTR SAL_PRIdINT32
145 #define SAL_PRIuUINTPTR SAL_PRIuUINT32
146 #define SAL_PRIxUINTPTR SAL_PRIxUINT32
147 #define SAL_PRIXUINTPTR SAL_PRIXUINT32
148 #elif SAL_TYPES_SIZEOFPOINTER == 8
149 typedef sal_Int64 sal_IntPtr;
150 typedef sal_uInt64 sal_uIntPtr;
151 #define SAL_PRIdINTPTR SAL_PRIdINT64
152 #define SAL_PRIuUINTPTR SAL_PRIuUINT64
153 #define SAL_PRIxUINTPTR SAL_PRIxUINT64
154 #define SAL_PRIXUINTPTR SAL_PRIXUINT64
156 #error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
164 #define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
165 #define SAL_MAX_INT8 ((sal_Int8) 0x7F)
166 #define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
167 #define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
168 #define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
169 #define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
170 #define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
171 #define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
172 #define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
173 #define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
174 #define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
175 #define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
177 #if SAL_TYPES_SIZEOFPOINTER == 4
178 #define SAL_MAX_SSIZE SAL_MAX_INT32
179 #define SAL_MAX_SIZE SAL_MAX_UINT32
180 #elif SAL_TYPES_SIZEOFPOINTER == 8
181 #define SAL_MAX_SSIZE SAL_MAX_INT64
182 #define SAL_MAX_SIZE SAL_MAX_UINT64
185 #define SAL_MAX_ENUM 0x7fffffff
187 #if defined(_MSC_VER)
188 # define SAL_DLLPUBLIC_EXPORT __declspec(dllexport)
189 # define SAL_JNI_EXPORT __declspec(dllexport)
190 # define SAL_DLLPUBLIC_IMPORT __declspec(dllimport)
191 # define SAL_DLLPRIVATE
192 # define SAL_DLLPUBLIC_TEMPLATE
193 # define SAL_DLLPUBLIC_RTTI
194 # define SAL_CALL __cdecl
195 #elif defined SAL_UNX
196 # if defined(__GNUC__)
197 # if defined(DISABLE_DYNLOADING)
198 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
199 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
200 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
201 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
202 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
203 # define SAL_DLLPUBLIC_RTTI
205 # define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
206 # define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
207 # define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("default")))
208 # define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
209 # define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("default")))
210 # if defined __clang__
211 # if __has_attribute(type_visibility)
212 # define SAL_DLLPUBLIC_RTTI __attribute__ ((type_visibility("default")))
214 # define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
217 # define SAL_DLLPUBLIC_RTTI
221 # define SAL_DLLPUBLIC_EXPORT
222 # define SAL_JNI_EXPORT
223 # define SAL_DLLPUBLIC_IMPORT
224 # define SAL_DLLPRIVATE
225 # define SAL_DLLPUBLIC_TEMPLATE
226 # define SAL_DLLPUBLIC_RTTI
230 # error("unknown platform")
239 #if defined(__GNUC__)
240 # if defined(DISABLE_DYNLOADING)
241 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT __attribute__((visibility("default")))
243 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
245 # define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
247 # define SAL_EXCEPTION_DLLPUBLIC_EXPORT
248 # define SAL_EXCEPTION_DLLPRIVATE
257 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
258 #define SAL_WARN_UNUSED_RESULT [[nodiscard]]
259 #elif (defined __GNUC__ \
260 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))) \
262 # define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
264 # define SAL_WARN_UNUSED_RESULT
272 # define SAL_NO_VTABLE __declspec(novtable)
274 # define SAL_NO_VTABLE
278 # pragma pack(push, 8)
296 #define SAL_SEQUENCE_HEADER_SIZE ((sal_Size) offsetof(sal_Sequence,elements))
310 #if defined __cplusplus
311 #if __cplusplus >= 201103L
312 #define SAL_THROW_EXTERN_C() noexcept
314 #define SAL_THROW_EXTERN_C() throw ()
317 #define SAL_THROW_EXTERN_C()
326 #if defined(LIBO_INTERNAL_ONLY) && defined(__COVERITY__)
327 # define COVERITY_NOEXCEPT_FALSE noexcept(false)
329 # define COVERITY_NOEXCEPT_FALSE
339 namespace com {
namespace sun {
namespace star { } } }
345 namespace css = ::com::sun::star;
355 #if defined LIBO_INTERNAL_ONLY
356 #define SAL_DELETED_FUNCTION = delete
358 #define SAL_DELETED_FUNCTION
368 #if defined LIBO_INTERNAL_ONLY
369 #define SAL_OVERRIDE override
381 #if defined LIBO_INTERNAL_ONLY
382 #define SAL_CONSTEXPR constexpr
384 #define SAL_CONSTEXPR
393 #if __cplusplus >= 201103L
394 #define SAL_NOEXCEPT noexcept
396 #define SAL_NOEXCEPT throw ()
417 return static_cast< T1
>(n);
436 #define SAL_INT_CAST(type, expr) ((type) (expr))
445 #if defined __GNUC__ || defined __clang__
446 #if defined LIBO_INTERNAL_ONLY
447 # define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
449 # define SAL_DEPRECATED(message) __attribute__((deprecated))
451 #elif defined(_MSC_VER)
452 # define SAL_DEPRECATED(message) __declspec(deprecated(message))
454 # define SAL_DEPRECATED(message)
468 #ifdef LIBO_INTERNAL_ONLY
469 # define SAL_DEPRECATED_INTERNAL(message)
471 # define SAL_DEPRECATED_INTERNAL(message) SAL_DEPRECATED(message)
481 #if defined LIBO_INTERNAL_ONLY && defined __GNUC__
482 #define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
483 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
484 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
485 #define SAL_WNODEPRECATED_DECLARATIONS_POP \
486 _Pragma(SAL_STRINGIFY_ARG(GCC diagnostic pop))
488 # define SAL_WNODEPRECATED_DECLARATIONS_PUSH
489 # define SAL_WNODEPRECATED_DECLARATIONS_POP
509 #define SAL_WNOUNREACHABLE_CODE_PUSH \
510 __pragma(warning(push)) \
511 __pragma(warning(disable:4702)) \
512 __pragma(warning(disable:4722))
513 #define SAL_WNOUNREACHABLE_CODE_POP \
514 __pragma(warning(pop))
517 #define SAL_WNOUNREACHABLE_CODE_PUSH
518 #define SAL_WNOUNREACHABLE_CODE_POP
544 #if defined __cplusplus
545 #if defined __GNUC__ || defined __clang__
546 #define SAL_UNUSED_PARAMETER __attribute__ ((unused))
548 #define SAL_UNUSED_PARAMETER
564 #if defined LIBO_INTERNAL_ONLY && (defined __GNUC__ || defined __clang__)
565 #define SAL_WARN_UNUSED __attribute__((warn_unused))
567 #define SAL_WARN_UNUSED
572 #if defined __GNUC__ || defined __clang__
574 # define SAL_DETAIL_BOOLEAN_EXPR(expr) \
576 int sal_boolean_var_; \
578 sal_boolean_var_ = 1; \
580 sal_boolean_var_ = 0; \
594 # define SAL_LIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 1)
606 # define SAL_UNLIKELY(expr) __builtin_expect(SAL_DETAIL_BOOLEAN_EXPR((expr)), 0)
619 # define SAL_HOT __attribute__((hot))
634 # define SAL_COLD __attribute__((cold))
636 # define SAL_LIKELY(expr) (expr)
637 # define SAL_UNLIKELY(expr) (expr)
654 #ifndef __has_attribute
655 #define __has_attribute(x) 0
658 #if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && !defined __clang__) || (defined __clang__ && __has_attribute(returns_nonnull)))
659 #define SAL_RETURNS_NONNULL __attribute__((returns_nonnull))
661 #define SAL_RETURNS_NONNULL
665 #if defined LIBO_INTERNAL_ONLY
670 #if defined __clang__
671 #define SAL_LOPLUGIN_ANNOTATE(id) [[clang::annotate("loplugin:" id)]]
673 #define SAL_LOPLUGIN_ANNOTATE(id)
677 #endif // INCLUDED_SAL_TYPES_H
T1 static_int_cast(T2 n)
A static_cast between integral types, to avoid C++ compiler warnings.
Definition: types.h:416
unsigned char sal_Bool
Definition: types.h:18
unsigned char sal_uInt8
Definition: types.h:24
__sal_NoAcquire
Definition: types.h:332
char elements[1]
elements array
Definition: types.h:293
sal_uInt16 sal_Unicode
Definition: types.h:103
struct _sal_Sequence sal_Sequence
This is the binary specification of a SAL sequence.
definition of a no acquire enum for ctors
Definition: types.h:336
This is the binary specification of a SAL sequence.
Definition: types.h:283
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:287
sal_Int32 nElements
element count
Definition: types.h:290
signed char sal_Int8
Definition: types.h:23
void * sal_Handle
Definition: types.h:106