Dev Essential
Loading...
Searching...
No Matches
preprocessor functionality

Macros

#define A_UTIL_CURRENT_FUNCTION   BOOST_CURRENT_FUNCTION
 
#define DEV_ESSENTIAL_DEPRECATED(msg)
 
#define DEV_ESSENTIAL_DEPRECATED_MACRO(macro_name, reason)
 
#define A_UTIL_DISABLE_COMPILER_WARNINGS
 
#define A_UTIL_ENABLE_COMPILER_WARNINGS
 
#define A_UTIL_DLL_EXPORT
 Macro for switching between export / import.
 
#define A_UTIL_TO_STRING(expression)
 

Detailed Description

Component for common preprocessor functionality and macros - applicable using

#include <a_util/preprocessor.h>

Macro Definition Documentation

◆ A_UTIL_CURRENT_FUNCTION

#define A_UTIL_CURRENT_FUNCTION   BOOST_CURRENT_FUNCTION

Resolves to the name of the function this macro is used in.

◆ A_UTIL_DISABLE_COMPILER_WARNINGS

#define A_UTIL_DISABLE_COMPILER_WARNINGS

Disables all compiler warnings until A_UTIL_ENABLE_COMPILER_WARNINGS is found.

Might be used to disable warnings for third-party includes that cannot be changed. Example:

// disables ALL wanings
#include <some/thirdparty/header.h>
// must be called to restore the previous warning state
#define A_UTIL_DISABLE_COMPILER_WARNINGS
Definition disable_warnings.h:46
#define A_UTIL_ENABLE_COMPILER_WARNINGS
Definition disable_warnings.h:47
Note
For internal usage only

◆ A_UTIL_DLL_EXPORT

#define A_UTIL_DLL_EXPORT

Macro for switching between export / import.

Defines standard exporting rules for symbol visibility.

◆ A_UTIL_ENABLE_COMPILER_WARNINGS

#define A_UTIL_ENABLE_COMPILER_WARNINGS

Restores the compiler warning level to the state before A_UTIL_DISABLE_COMPILER_WARNINGS.

For an example, see A_UTIL_DISABLE_COMPILER_WARNINGS.

Note
For internal usage only

◆ A_UTIL_TO_STRING

#define A_UTIL_TO_STRING ( expression)
Value:
A_UTIL_STRINGIFY(expression)

Converts an expression to its string representation during preprocessing.

Parameters
[in]expressionThe expression evaluating to the string representation.

◆ DEV_ESSENTIAL_DEPRECATED

#define DEV_ESSENTIAL_DEPRECATED ( msg)
Value:
[[deprecated(msg " To disable this warning, define " \
"DEV_ESSENTIAL_DISABLE_DEPRECATED_WARNINGS.")]]

Adds [[deprecated("msg")]] to allowed declarations

Parameters
[in]msgText explaining the rationale for deprecation and/or to suggest a replacing entity
Remarks
Might be disabled by defining preprocessor define DEV_ESSENTIAL_DISABLE_DEPRECATED_WARNINGS.
Allowed declarations are listed here: https://en.cppreference.com/w/cpp/language/attributes/deprecated#Explanation.

◆ DEV_ESSENTIAL_DEPRECATED_MACRO

#define DEV_ESSENTIAL_DEPRECATED_MACRO ( macro_name,
reason )
Value:
DEV_ESSENTIAL_INTERNAL_PRAGMA_WARNING( \
#macro_name is deprecated and will be removed in an upcoming version. Reason: reason \
Compile with -DDEV_ESSENTIAL_DISABLE_DEPRECATED_WARNINGS to disable this warning.)

A function like macro usable inside other macro definitions to warn about their deprecation. Example:

// First parameter of DEV_ESSENTIAL_DEPRECATED_MACRO() is not a string!
// Also do not forget the dot ',' concluding the reason.
#define MY_FANCY_MACRO(x) \
DEV_ESSENTIAL_DEPRECATED_MACRO(MY_FANCY_MACRO, "Use MY_EVEN_FANCIER_MACRO instead.") \
doFancyStuff(x)
Parameters
[in]macro_nameName of the macro that shall be marked deprecated (not a string!)
[in]reasonA string explaining the reason of deprecation.
Remarks
For Visual Studio the emitted string is a simple message. For other compilers (e.g. GCC, clang) the emitted string is treated as warning. To silence the message/warning, DEV_ESSENTIAL_DISABLE_DEPRECATED_WARNINGS can be defined.