emacs-diffs
[Top][All Lists]
Advanced

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

master 9bbf175: Improve 'noexcept' support in C++17.


From: Philipp Stephani
Subject: master 9bbf175: Improve 'noexcept' support in C++17.
Date: Sat, 4 Jan 2020 07:57:33 -0500 (EST)

branch: master
commit 9bbf17539826a040eda45e88aabd358ed44fabf7
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Improve 'noexcept' support in C++17.
    
    In C++17, 'noexcept' is part of a function type and may be used in
    typedef declarations, see
    https://en.cppreference.com/w/cpp/language/noexcept_spec.
    
    * src/emacs-module.h.in: Mark function pointer type aliases as
    'noexcept' in C++17.
---
 src/emacs-module.h.in | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index e1bb00a..cd75c09 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -42,6 +42,12 @@ information how to write modules and use this header file.
 # define EMACS_NOEXCEPT
 #endif
 
+#if defined __cplusplus && __cplusplus >= 201703L
+# define EMACS_NOEXCEPT_TYPEDEF noexcept
+#else
+# define EMACS_NOEXCEPT_TYPEDEF
+#endif
+
 #ifdef __has_attribute
 #if __has_attribute(__nonnull__)
 # define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
@@ -88,11 +94,11 @@ struct emacs_runtime
 typedef emacs_value (*emacs_function) (emacs_env *env, ptrdiff_t nargs,
                                        emacs_value *args,
                                        void *data)
-  EMACS_ATTRIBUTE_NONNULL (1);
+  EMACS_NOEXCEPT_TYPEDEF EMACS_ATTRIBUTE_NONNULL (1);
 
 /* Function prototype for module user-pointer and function finalizers.
    These must not throw C++ exceptions.  */
-typedef void (*emacs_finalizer) (void *data);
+typedef void (*emacs_finalizer) (void *data) EMACS_NOEXCEPT_TYPEDEF;
 
 /* Possible Emacs function call outcomes.  */
 enum emacs_funcall_exit



reply via email to

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