summaryrefslogtreecommitdiff
path: root/src/emacs-module.h.in
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2020-01-04 13:54:29 +0100
committerPhilipp Stephani <phst@google.com>2020-01-04 13:54:29 +0100
commit9bbf17539826a040eda45e88aabd358ed44fabf7 (patch)
tree612cd632a2dd1814f665f347edf634b3b99fb16e /src/emacs-module.h.in
parent8e3868125c902f1864a32d817f34e3dfc4eea9a9 (diff)
downloademacs-9bbf17539826a040eda45e88aabd358ed44fabf7.tar.gz
emacs-9bbf17539826a040eda45e88aabd358ed44fabf7.tar.bz2
emacs-9bbf17539826a040eda45e88aabd358ed44fabf7.zip
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.
Diffstat (limited to 'src/emacs-module.h.in')
-rw-r--r--src/emacs-module.h.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index e1bb00a3df6..cd75c0907e4 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