LibreOffice Module sal (master) 1
Classes | Macros | Typedefs
types.h File Reference
#include "sal/config.h"
#include <stddef.h>
#include "sal/macros.h"
#include "sal/typesizes.h"
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _sal_Sequence
 This is the binary specification of a SAL sequence. More...
 

Macros

#define sal_False   ((sal_Bool)0)
 
#define sal_True   ((sal_Bool)1)
 
#define SAL_UNICODE_NOTEQUAL_WCHAR_T
 
#define SAL_PRI_SIZET   "z"
 
#define SAL_PRI_PTRDIFFT   "t"
 
#define SAL_MIN_INT8   ((sal_Int8) (-0x7F - 1))
 
#define SAL_MAX_INT8   ((sal_Int8) 0x7F)
 
#define SAL_MAX_UINT8   ((sal_uInt8) 0xFF)
 
#define SAL_MIN_INT16   ((sal_Int16) (-0x7FFF - 1))
 
#define SAL_MAX_INT16   ((sal_Int16) 0x7FFF)
 
#define SAL_MAX_UINT16   ((sal_uInt16) 0xFFFF)
 
#define SAL_MIN_INT32   ((sal_Int32) (-0x7FFFFFFF - 1))
 
#define SAL_MAX_INT32   ((sal_Int32) 0x7FFFFFFF)
 
#define SAL_MAX_UINT32   ((sal_uInt32) 0xFFFFFFFF)
 
#define SAL_MIN_INT64   ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
 
#define SAL_MAX_INT64   ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
 
#define SAL_MAX_UINT64   ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
 
#define SAL_MAX_ENUM   0x7fffffff
 
#define SAL_EXCEPTION_DLLPUBLIC_EXPORT
 Exporting the symbols necessary for exception handling on GCC. More...
 
#define SAL_EXCEPTION_DLLPRIVATE
 
#define SAL_WARN_UNUSED_RESULT
 Use this as markup for functions and methods whose return value must be checked. More...
 
#define SAL_NO_VTABLE
 Use this for pure virtual classes, e.g. More...
 
#define SAL_SEQUENCE_HEADER_SIZE   ((sal_Size) offsetof(sal_Sequence,elements))
 
#define SAL_THROW_EXTERN_C()
 Nothrow specification for C functions. More...
 
#define SAL_INT_CAST(type, expr)   ((type) (expr))
 A cast between integer types, to avoid C compiler warnings. More...
 
#define SAL_DEPRECATED(message)
 Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);. More...
 
#define SAL_DEPRECATED_INTERNAL(message)   SAL_DEPRECATED(message)
 This macro is used in cppumaker-generated include files, to tag entities that are marked as. More...
 
#define SAL_WNODEPRECATED_DECLARATIONS_PUSH
 Use as follows: SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<X> ... SAL_WNODEPRECATED_DECLARATIONS_POP. More...
 
#define SAL_WNODEPRECATED_DECLARATIONS_POP
 
#define SAL_WNOUNREACHABLE_CODE_PUSH
 Use as follows: More...
 
#define SAL_WNOUNREACHABLE_CODE_POP
 
#define SAL_WARN_UNUSED
 Annotate unused but required C++ function parameters. More...
 

Typedefs

typedef unsigned char sal_Bool
 
typedef signed char sal_Int8
 
typedef unsigned char sal_uInt8
 
typedef sal_uInt16 sal_Unicode
 
typedef void * sal_Handle
 
typedef struct _sal_Sequence sal_Sequence
 This is the binary specification of a SAL sequence. More...
 

Macro Definition Documentation

◆ SAL_DEPRECATED

#define SAL_DEPRECATED (   message)

Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.

Definition at line 474 of file types.h.

◆ SAL_DEPRECATED_INTERNAL

#define SAL_DEPRECATED_INTERNAL (   message)    SAL_DEPRECATED(message)

This macro is used in cppumaker-generated include files, to tag entities that are marked as.

Deprecated:
in UNOIDL.

It causes deprecation warnings to be generated in external code, but for now is silenced in internal code. It would need some substantial clean-up of internal code to fix all warnings/errors generated by it. (Once that is done, it can become a synonym for SAL_DEPRECATED under LIBO_INTERNAL_ONLY, too. Completely removing the macro then would be incompatible, in case there are include files still around generated with a cppumaker that emitted it.)

Definition at line 491 of file types.h.

◆ SAL_EXCEPTION_DLLPRIVATE

#define SAL_EXCEPTION_DLLPRIVATE

Definition at line 268 of file types.h.

◆ SAL_EXCEPTION_DLLPUBLIC_EXPORT

#define SAL_EXCEPTION_DLLPUBLIC_EXPORT

Exporting the symbols necessary for exception handling on GCC.

These macros are used for inline declarations of exception classes, as in rtl/malformeduriexception.hxx.

Definition at line 267 of file types.h.

◆ sal_False

#define sal_False   ((sal_Bool)0)

Definition at line 39 of file types.h.

◆ SAL_INT_CAST

#define SAL_INT_CAST (   type,
  expr 
)    ((type) (expr))

A cast between integer types, to avoid C compiler warnings.

In C source code, use SAL_INT_CAST(type, expr) instead of ((type) (expr)) whenever a compiler warning about integer type problems shall be silenced. That way, source code that needs to be modified when the type of any of the expressions involved in the compiler warning is changed can be found more easily.

The argument 'type' must be an integer type and the argument 'expr' must be an integer expression. Both arguments are evaluated exactly once.

Definition at line 456 of file types.h.

◆ SAL_MAX_ENUM

#define SAL_MAX_ENUM   0x7fffffff

Definition at line 205 of file types.h.

◆ SAL_MAX_INT16

#define SAL_MAX_INT16   ((sal_Int16) 0x7FFF)

Definition at line 188 of file types.h.

◆ SAL_MAX_INT32

#define SAL_MAX_INT32   ((sal_Int32) 0x7FFFFFFF)

Definition at line 191 of file types.h.

◆ SAL_MAX_INT64

#define SAL_MAX_INT64   ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))

Definition at line 194 of file types.h.

◆ SAL_MAX_INT8

#define SAL_MAX_INT8   ((sal_Int8) 0x7F)

Definition at line 185 of file types.h.

◆ SAL_MAX_UINT16

#define SAL_MAX_UINT16   ((sal_uInt16) 0xFFFF)

Definition at line 189 of file types.h.

◆ SAL_MAX_UINT32

#define SAL_MAX_UINT32   ((sal_uInt32) 0xFFFFFFFF)

Definition at line 192 of file types.h.

◆ SAL_MAX_UINT64

#define SAL_MAX_UINT64   ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))

Definition at line 195 of file types.h.

◆ SAL_MAX_UINT8

#define SAL_MAX_UINT8   ((sal_uInt8) 0xFF)

Definition at line 186 of file types.h.

◆ SAL_MIN_INT16

#define SAL_MIN_INT16   ((sal_Int16) (-0x7FFF - 1))

Definition at line 187 of file types.h.

◆ SAL_MIN_INT32

#define SAL_MIN_INT32   ((sal_Int32) (-0x7FFFFFFF - 1))

Definition at line 190 of file types.h.

◆ SAL_MIN_INT64

#define SAL_MIN_INT64   ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))

Definition at line 193 of file types.h.

◆ SAL_MIN_INT8

#define SAL_MIN_INT8   ((sal_Int8) (-0x7F - 1))

Definition at line 184 of file types.h.

◆ SAL_NO_VTABLE

#define SAL_NO_VTABLE

Use this for pure virtual classes, e.g.

class SAL_NO_VTABLE Foo { ... This hinders the compiler from setting a generic vtable stating that a pure virtual function was called and thus slightly reduces code size.

Definition at line 294 of file types.h.

◆ SAL_PRI_PTRDIFFT

#define SAL_PRI_PTRDIFFT   "t"

Definition at line 155 of file types.h.

◆ SAL_PRI_SIZET

#define SAL_PRI_SIZET   "z"

Definition at line 154 of file types.h.

◆ SAL_SEQUENCE_HEADER_SIZE

#define SAL_SEQUENCE_HEADER_SIZE   ((sal_Size) offsetof(sal_Sequence,elements))

Definition at line 316 of file types.h.

◆ SAL_THROW_EXTERN_C

#define SAL_THROW_EXTERN_C ( )

Nothrow specification for C functions.

This is a macro so it can expand to nothing in C code.

Definition at line 337 of file types.h.

◆ sal_True

#define sal_True   ((sal_Bool)1)

Definition at line 40 of file types.h.

◆ SAL_UNICODE_NOTEQUAL_WCHAR_T

#define SAL_UNICODE_NOTEQUAL_WCHAR_T

Definition at line 122 of file types.h.

◆ SAL_WARN_UNUSED

#define SAL_WARN_UNUSED

Annotate unused but required C++ function parameters.

An unused parameter is required if the function needs to adhere to a given type (e.g., if its address is assigned to a function pointer of a specific type, or if it is called from template code). This annotation helps static analysis tools suppress false warnings. In the case of virtual functions (where unused required parameters are common, too), the annotation is not required (as static analysis tools can themselves derive the information whether a function is virtual).

Use the annotation in function definitions like

void f(SAL_UNUSED_PARAMETER int) {}

C does not allow unnamed parameters, anyway, so a function definition like the above needs to be written there as

void f(int dummy) { (void) dummy; / * avoid warnings * / }

without a SAL_UNUSED_PARAMETER annotation.

Available since: \n LibreOffice 3.6
Annotate classes where a compiler should warn if an instance is unused.

The compiler cannot warn about unused instances if they have non-trivial or external constructors or destructors. Classes marked with SAL_WARN_UNUSED will be warned about.

Available since: \n LibreOffice 4.0

Definition at line 587 of file types.h.

◆ SAL_WARN_UNUSED_RESULT

#define SAL_WARN_UNUSED_RESULT

Use this as markup for functions and methods whose return value must be checked.

Compilers that support a construct of this nature will emit a compile time warning on unchecked return value.

Definition at line 284 of file types.h.

◆ SAL_WNODEPRECATED_DECLARATIONS_POP

#define SAL_WNODEPRECATED_DECLARATIONS_POP

Definition at line 509 of file types.h.

◆ SAL_WNODEPRECATED_DECLARATIONS_PUSH

#define SAL_WNODEPRECATED_DECLARATIONS_PUSH

Use as follows: SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<X> ... SAL_WNODEPRECATED_DECLARATIONS_POP.

Definition at line 508 of file types.h.

◆ SAL_WNOUNREACHABLE_CODE_POP

#define SAL_WNOUNREACHABLE_CODE_POP

Definition at line 538 of file types.h.

◆ SAL_WNOUNREACHABLE_CODE_PUSH

#define SAL_WNOUNREACHABLE_CODE_PUSH

Use as follows:

SAL_WNOUNREACHABLE_CODE_PUSH

function definition

SAL_WNOUNREACHABLE_CODE_POP

Useful in cases where the compiler is "too clever" like when doing link-time code generation, and noticing that a called function always throws, and fixing the problem cleanly so that it produces no warnings in normal non-LTO compilations either is not easy.

Definition at line 537 of file types.h.

Typedef Documentation

◆ sal_Bool

typedef unsigned char sal_Bool

Definition at line 38 of file types.h.

◆ sal_Handle

typedef void* sal_Handle

Definition at line 126 of file types.h.

◆ sal_Int8

typedef signed char sal_Int8

Definition at line 43 of file types.h.

◆ sal_Sequence

typedef struct _sal_Sequence sal_Sequence

This is the binary specification of a SAL sequence.

◆ sal_uInt8

typedef unsigned char sal_uInt8

Definition at line 44 of file types.h.

◆ sal_Unicode

typedef sal_uInt16 sal_Unicode

Definition at line 123 of file types.h.