EDT PCD SDK Documentation 6.1.0
edt_portability.h File Reference

(git 0f985b7e, 2023-10-04)

Defines and macros for compiler portability or platform compatibility. More...

This graph shows which files directly or indirectly include this file:

Macros

#define EDT_API_LIBSHARED   1
 
#define EDT_DEALLOCATE_WITH(x)
 
#define EDT_STR_FORMAT_ATTR(archetype, fmt_string_index, first_to_check)    __attribute__((__format__(archetype, fmt_string_index, first_to_check)))
 
#define EDT_CHECK_RETURN   __attribute__((__warn_unused_result__))
 
#define EDT_DEPRECATED_FUNC(as_of_version, explanation)    __attribute__((__deprecated__(EDT_DEPRECATED_FUNC_MSG_(as_of_version, explanation))))
 

Detailed Description

Defines and macros for compiler portability or platform compatibility.

Macro Definition Documentation

◆ EDT_API_LIBSHARED

#define EDT_API_LIBSHARED   1

By default, linking to a shared library is assumed. To link to a static library, users should define EDT_API_LIBSHARED=0 to disable shared library exports in header files.

◆ EDT_DEALLOCATE_WITH

#define EDT_DEALLOCATE_WITH (   x)

The memory allocated by the decorated function should be free'd by calling the function x.

  • GCC function attribute "malloc(<deallocator>)"

◆ EDT_STR_FORMAT_ATTR

#define EDT_STR_FORMAT_ATTR (   archetype,
  fmt_string_index,
  first_to_check 
)     __attribute__((__format__(archetype, fmt_string_index, first_to_check)))

A wrapper for adding the 'format' function attribute to allow the compiler to type-check the format string and variadic arguments.

  • GCC function attribute "format"
Parameters
archetypeStyle of formatting arguments, such as 'printf' or 'scanf'.
fmt_string_indexFunction parameter index of the format string.
first_to_checkFunction parameter index of the first variadic argument. Should be zero (0) for functions where arguments are not available to be checked.

◆ EDT_CHECK_RETURN

#define EDT_CHECK_RETURN   __attribute__((__warn_unused_result__))

The caller should inspect the return value of the decorated function.

Dev note: Both the function declaration and definition should be decorated, for MSVC analysis.

  • GCC function attribute "warn_unused_result"
  • Microsoft Visual Studio property "_Check_return_" and warning C6031

◆ EDT_DEPRECATED_FUNC

#define EDT_DEPRECATED_FUNC (   as_of_version,
  explanation 
)     __attribute__((__deprecated__(EDT_DEPRECATED_FUNC_MSG_(as_of_version, explanation))))

The decorated function is deprecated and may be removed in a future release.

  • GCC function attribute "deprecated"
  • Microsoft Visual Studio "__declspec(deprecated)" and warning C4996