emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 7210f51: * src/emacs-module.h: Fix finalizer type


From: Aurélien Aptel
Subject: [Emacs-diffs] emacs-25 7210f51: * src/emacs-module.h: Fix finalizer typedef for C++11
Date: Mon, 30 Nov 2015 22:58:11 +0000

branch: emacs-25
commit 7210f5130abb909aebcbb09a8a71558100fb9f96
Author: Aurélien Aptel <address@hidden>
Commit: Aurélien Aptel <address@hidden>

    * 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 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/emacs-module.h b/src/emacs-module.h
index dce5301..a3aa501 100644
--- a/src/emacs-module.h
+++ b/src/emacs-module.h
@@ -26,8 +26,19 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #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
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]