From 0fa9396ab234804be4685792e484721354184510 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 4 Oct 2017 11:57:53 +0200 Subject: [PATCH] Make the _hook_use aliases emit a deprecation warning Turn `event_handler_hook_use` and `loop_hook_use` into real functions, so that we can apply a `deprecated` attribute, which in turn will emit a compile-time warning when either of these functions are used. Signed-off-by: Gergely Nagy --- src/Kaleidoscope.cpp | 10 ++++++++++ src/Kaleidoscope.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Kaleidoscope.cpp b/src/Kaleidoscope.cpp index 525dfe44..33fd00be 100644 --- a/src/Kaleidoscope.cpp +++ b/src/Kaleidoscope.cpp @@ -134,3 +134,13 @@ Kaleidoscope_::focusHook(const char *command) { } Kaleidoscope_ Kaleidoscope; + +/* Deprecated functions */ + +void event_handler_hook_use(Kaleidoscope_::eventHandlerHook hook) { + Kaleidoscope.useEventHandlerHook(hook); +} + +void loop_hook_use(Kaleidoscope_::loopHook hook) { + Kaleidoscope.useLoopHook(hook); +} diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index 55b98046..85ae047c 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -121,5 +121,5 @@ extern Kaleidoscope_ Kaleidoscope; /* -- DEPRECATED aliases; remove them when there are no more users. -- */ -#define event_handler_hook_use(hook) Kaleidoscope.useEventHandlerHook(hook); -#define loop_hook_use(hook) Kaleidoscope.useLoopHook(hook) +void event_handler_hook_use(Kaleidoscope_::eventHandlerHook hook) __attribute__((deprecated)); +void loop_hook_use(Kaleidoscope_::loopHook hook) __attribute__((deprecated));