From 7210f5130abb909aebcbb09a8a71558100fb9f96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aur=C3=A9lien=20Aptel?= Date: Mon, 30 Nov 2015 23:53:40 +0100 Subject: [PATCH] * src/emacs-module.h: Fix finalizer typedef for C++11 C++11 standard doesn't allow exception-specification in typedef. The workaround is to declare a dummy function prototype and use decltype on it. --- src/emacs-module.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/emacs-module.h b/src/emacs-module.h index dce5301ab0f..a3aa5017a4e 100644 --- a/src/emacs-module.h +++ b/src/emacs-module.h @@ -26,8 +26,19 @@ along with GNU Emacs. If not, see . */ #if defined __cplusplus && __cplusplus >= 201103L # define EMACS_NOEXCEPT noexcept + +/* Function prototype for module user-pointer finalizers. + + NOTE: C++11 15.4: An exception-specification shall not appear in a + typedef declaration or alias-declaration. + +*/ +void emacs_dummy_finalizer_function (void *) noexcept; +typedef decltype(emacs_dummy_finalizer_function) *emacs_finalizer_function; + #else # define EMACS_NOEXCEPT +typedef void (*emacs_finalizer_function) (void *); #endif #ifdef __cplusplus @@ -64,9 +75,6 @@ typedef int (*emacs_init_function) (struct emacs_runtime *ert); typedef emacs_value (*emacs_subr) (emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data); -/* Function prototype for module user-pointer finalizers. */ -typedef void (*emacs_finalizer_function) (void *) EMACS_NOEXCEPT; - /* Possible Emacs function call outcomes. */ enum emacs_funcall_exit { -- 2.39.2