Replace ui_create_dialog specialization with helper

Rename ui_create_dialog<void *> specialization with free function
untyped_ui_create_dialog.  GCC 4.6 incorrectly considers a
specialization to be a redundant declaration, causing a
-Wredundant-decls failure with the specialization form.

Fixes: be041a9cfc ("Add type checking for ui_create_dialog")
This commit is contained in:
Kp 2015-04-02 02:36:52 +00:00
parent 66806e1f34
commit 92b6cd3883
2 changed files with 4 additions and 6 deletions

View file

@ -256,10 +256,12 @@ public:
class unused_ui_userdata_t;
static unused_ui_userdata_t *const unused_ui_userdata = nullptr;
UI_DIALOG *untyped_ui_create_dialog(short x, short y, short w, short h, enum dialog_flags flags, ui_subfunction_t<void>::type callback, void *userdata, const void *createdata);
template <typename T1, typename T2 = const void>
UI_DIALOG * ui_create_dialog( short x, short y, short w, short h, enum dialog_flags flags, typename ui_subfunction_t<T1>::type callback, T1 *userdata, T2 *createdata = nullptr)
{
return ui_create_dialog(x, y, w, h, flags, reinterpret_cast<ui_subfunction_t<void>::type>(callback), static_cast<void *>(userdata), static_cast<const void *>(createdata));
return untyped_ui_create_dialog(x, y, w, h, flags, reinterpret_cast<ui_subfunction_t<void>::type>(callback), static_cast<void *>(userdata), static_cast<const void *>(createdata));
}
template <typename T1, typename T2 = const void>
@ -270,9 +272,6 @@ UI_DIALOG *ui_create_dialog(short x, short y, short w, short h, enum dialog_flag
return r;
}
template <>
UI_DIALOG * ui_create_dialog( short x, short y, short w, short h, enum dialog_flags flags, ui_subfunction_t<void>::type callback, void *userdata, const void *createdata);
extern struct window *ui_dialog_get_window(UI_DIALOG *dlg);
extern void ui_dialog_set_current_canvas(UI_DIALOG *dlg);
extern void ui_close_dialog( UI_DIALOG * dlg );

View file

@ -218,8 +218,7 @@ static window_event_result ui_dialog_handler(window *wind,const d_event &event,
}
}
template <>
UI_DIALOG * ui_create_dialog( short x, short y, short w, short h, enum dialog_flags flags, ui_subfunction_t<void>::type callback, void *userdata, const void *createdata)
UI_DIALOG *untyped_ui_create_dialog( short x, short y, short w, short h, enum dialog_flags flags, ui_subfunction_t<void>::type callback, void *userdata, const void *createdata)
{
int sw, sh, req_w, req_h;