[freerdp,api] GCC/clang optimized IFCALLRESULT

Use statement expressions to add a log message for unset function
pointers
This commit is contained in:
akallabeth
2025-03-04 09:44:07 +01:00
parent 0d4af6deff
commit e2e6e9fd85

View File

@@ -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, ...) \