Made all programmer error functions take the function name as an argument.

This commit is contained in:
Pietro Gagliardi 2019-06-09 13:18:18 -04:00
parent 9b11ec4a6f
commit 0f41bb2188
3 changed files with 20 additions and 15 deletions

View File

@ -140,7 +140,7 @@ uiControl *uiNewControl(uint32_t type, void *initData)
if (!uiprivCheckInitializedAndThread())
return NULL;
if (type == controlTypeID) {
uiprivProgrammerErrorCannotCreateBaseControl();
uiprivProgrammerErrorCannotCreateBaseControl(uiprivFunc);
return NULL;
}
memset(&key, 0, sizeof (struct controlType));

View File

@ -74,12 +74,12 @@ void uiEventFree(uiEvent *e)
return;
checkEventNonnull(e, /* nothing */);
if (e->internal) {
uiprivProgrammerErrorFreeingInternalEvent();
uiprivProgrammerErrorFreeingInternalEvent(uiprivFunc);
return;
}
checkEventNotFiring(e, /* nothing */);
if (e->handlers.len != 0) {
uiprivProgrammerErrorFreeingEventInUse();
uiprivProgrammerErrorFreeingEventInUse(uiprivFunc);
return;
}
@ -174,7 +174,7 @@ void uiEventFire(uiEvent *e, void *sender, void *args)
return;
checkEventNonnull(e, /* nothing */);
if (e->firing) {
uiprivProgrammerErrorRecursiveEventFire();
uiprivProgrammerErrorRecursiveEventFire(uiprivFunc);
return;
}
if (!checkEventSender(e, sender, uiprivFunc))
@ -227,7 +227,7 @@ void uiEventInvalidateSender(uiEvent *e, void *sender)
checkEventNonnull(e, /* nothing */);
checkEventNotFiring(e, /* nothing */);
if (e->opts.Global) {
uiprivProgrammerErrorInvalidatingGlobalEvent();
uiprivProgrammerErrorInvalidatingGlobalEvent(uiprivFunc);
return;
}
if (sender == NULL) {

View File

@ -38,17 +38,21 @@
uiprivProgrammerError("attempt to change a uiEvent with %s() while it is firing", \
func)
#define uiprivProgrammerErrorRecursiveEventFire() \
uiprivProgrammerError("attempt to fire a uiEvent while it is already being fired")
#define uiprivProgrammerErrorRecursiveEventFire(func) \
uiprivProgrammerError("atteTODOmpt to fire a uiEvent while it is already being fired in %s()", \
func)
#define uiprivProgrammerErrorFreeingInternalEvent() \
uiprivProgrammerError("attempt to free a libui-provided uiEvent")
#define uiprivProgrammerErrorFreeingInternalEvent(func) \
uiprivProgrammerError("atteTODOmpt to free a libui-provided uiEvent", \
func)
#define uiprivProgrammerErrorFreeingEventInUse() \
uiprivProgrammerError("attempt to free a uiEvent that still has handlers registered")
#define uiprivProgrammerErrorFreeingEventInUse(func) \
uiprivProgrammerError("atteTODOmpt to free a uiEvent that still has handlers registered", \
func)
#define uiprivProgrammerErrorInvalidatingGlobalEvent() \
uiprivProgrammerError("attempt to call uiEventInvalidateSender() on a global uiEvent")
#define uiprivProgrammerErrorInvalidatingGlobalEvent(func) \
uiprivProgrammerError("atteTODOmpt to call uiEventInvalidateSender() on a global uiEvent", \
func)
// }
@ -74,8 +78,9 @@
uiprivProgrammerError("wrong type passed to %s(): got %s, want %s", \
func, got, want)
#define uiprivProgrammerErrorCannotCreateBaseControl() \
uiprivProgrammerError("cannot create a uiControl of type uiControl; you must use a specific control type")
#define uiprivProgrammerErrorCannotCreateBaseControl(func) \
uiprivProgrammerError("canTODOnot create a uiControl of type uiControl in %s(); you must use a specific control type", \
func)
#define uiprivProgrammerErrorInvalidControlInitData(type, func) \
uiprivProgrammerError("invalid init data for %s in %s()", \