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()) if (!uiprivCheckInitializedAndThread())
return NULL; return NULL;
if (type == controlTypeID) { if (type == controlTypeID) {
uiprivProgrammerErrorCannotCreateBaseControl(); uiprivProgrammerErrorCannotCreateBaseControl(uiprivFunc);
return NULL; return NULL;
} }
memset(&key, 0, sizeof (struct controlType)); memset(&key, 0, sizeof (struct controlType));

View File

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

View File

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