mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[freerdp,api] GCC/clang optimized IFCALLRESULT
Use statement expressions to add a log message for unset function pointers
This commit is contained in:
@@ -90,13 +90,14 @@
|
||||
WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == NULL"); \
|
||||
} while (0)
|
||||
|
||||
#if 0 // defined(__GNUC__)
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define IFCALLRESULT(_default_return, _cb, ...) \
|
||||
({ \
|
||||
(_cb != NULL) ? _cb(__VA_ARGS__) : ({ \
|
||||
__extension__({ \
|
||||
if (_cb == NULL) \
|
||||
{ \
|
||||
WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == NULL"); \
|
||||
(_default_return); \
|
||||
}); \
|
||||
} \
|
||||
((_cb != NULL) ? _cb(__VA_ARGS__) : (_default_return)); \
|
||||
})
|
||||
#else
|
||||
#define IFCALLRESULT(_default_return, _cb, ...) \
|
||||
|
||||
Reference in New Issue
Block a user