Macros
API attributes
-
ULIB_BEGIN_DECLS
Marks the beginning of declarations.
-
ULIB_END_DECLS
Marks the end of declarations.
-
ULIB_API
Marks public API, whose symbols should be exported.
-
ULIB_INLINE
Marks inline function definitions.
-
ULIB_PURE
Marks pure functions.
A pure function is a function that has no effect on the state of the program other than returning a value.
Note
This lets the compiler sometimes produce more optimized code.
-
ULIB_CONST
Marks const functions.
A const function is a pure function whose return value is not affected by changes to the state of the program.
Note
This lets the compiler sometimes produce more optimized code.
Warning
Should not be used on functions that accept pointer arguments, unless the contents of the pointed-to memory never change between successive invocations.
-
ULIB_DEPRECATED(msg)
Marks deprecated APIs.
Deprecated APIs are usually replaced by alternatives, and will be removed in later major versions of the library.
- Parameters:
msg – Deprecation message.
-
ULIB_DEPRECATED_MACRO
Marks deprecated macros.
Deprecated macros are usually replaced by alternatives, and will be removed in later major versions of the library.
Warning suppression
-
ulib_unused
Suppresses unused variable warnings.
-
ULIB_SUPPRESS_BEGIN(compiler)
Begins the suppression of compiler warnings.
- Parameters:
compiler – The compiler for which the warnings are being suppressed. Allowed values: GCC, CLANG, GNUC, MSVC.
-
ULIB_SUPPRESS(compiler, warning)
Suppresses the specified compiler warning.
- Parameters:
compiler – The compiler for which the warnings are being suppressed. Allowed values: GCC, CLANG, GNUC, MSVC.
warning – The warning to suppress.
-
ULIB_SUPPRESS_END(compiler)
Ends the suppression of compiler warnings.
- Parameters:
compiler – The compiler for which the warnings are being suppressed. Allowed values: GCC, CLANG, GNUC, MSVC.
-
ULIB_SUPPRESS_ONE(compiler, warning)
Begins the suppression of the specified compiler warning.
- Parameters:
compiler – The compiler for which the warnings are being suppressed. Allowed values: GCC, CLANG, GNUC, MSVC.
warning – The warning to suppress.
Utilities
-
ulib_swap(T, x, y)
Swaps the contents of two variables.
- Parameters:
T – Variable type.
x – First variable.
y – Second variable.
-
ulib_array_count(array)
Returns the number of elements of an array.
- Parameters:
array – The array.
- Returns:
Number of elements.
-
ulib_struct_init
C and C++ compatible struct initializer.
-
ulib_analyzer_assert(exp)
Give hints to static analyzers, asserting that
exp
is true.- Parameters:
exp –
boolean expression
Boolean expression.
-
ULIB_MACRO_CONCAT(a, b)
Concatenates the
a
andb
tokens, allowinga
andb
to be macro-expanded.- Parameters:
a –
token
First token.b –
token
Second token.
-
ULIB_PRAGMA(msg)
Pragma directive that allows macro expansion.
- Parameters:
msg – Pragma directive.