diff options
| author | Philipp Stephani | 2020-01-04 13:54:29 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2020-01-04 13:54:29 +0100 |
| commit | 9bbf17539826a040eda45e88aabd358ed44fabf7 (patch) | |
| tree | 612cd632a2dd1814f665f347edf634b3b99fb16e | |
| parent | 8e3868125c902f1864a32d817f34e3dfc4eea9a9 (diff) | |
| download | emacs-9bbf17539826a040eda45e88aabd358ed44fabf7.tar.gz 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.
| -rw-r--r-- | src/emacs-module.h.in | 10 |
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. | |||
| 42 | # define EMACS_NOEXCEPT | 42 | # define EMACS_NOEXCEPT |
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #if defined __cplusplus && __cplusplus >= 201703L | ||
| 46 | # define EMACS_NOEXCEPT_TYPEDEF noexcept | ||
| 47 | #else | ||
| 48 | # define EMACS_NOEXCEPT_TYPEDEF | ||
| 49 | #endif | ||
| 50 | |||
| 45 | #ifdef __has_attribute | 51 | #ifdef __has_attribute |
| 46 | #if __has_attribute(__nonnull__) | 52 | #if __has_attribute(__nonnull__) |
| 47 | # define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) | 53 | # define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) |
| @@ -88,11 +94,11 @@ struct emacs_runtime | |||
| 88 | typedef emacs_value (*emacs_function) (emacs_env *env, ptrdiff_t nargs, | 94 | typedef emacs_value (*emacs_function) (emacs_env *env, ptrdiff_t nargs, |
| 89 | emacs_value *args, | 95 | emacs_value *args, |
| 90 | void *data) | 96 | void *data) |
| 91 | EMACS_ATTRIBUTE_NONNULL (1); | 97 | EMACS_NOEXCEPT_TYPEDEF EMACS_ATTRIBUTE_NONNULL (1); |
| 92 | 98 | ||
| 93 | /* Function prototype for module user-pointer and function finalizers. | 99 | /* Function prototype for module user-pointer and function finalizers. |
| 94 | These must not throw C++ exceptions. */ | 100 | These must not throw C++ exceptions. */ |
| 95 | typedef void (*emacs_finalizer) (void *data); | 101 | typedef void (*emacs_finalizer) (void *data) EMACS_NOEXCEPT_TYPEDEF; |
| 96 | 102 | ||
| 97 | /* Possible Emacs function call outcomes. */ | 103 | /* Possible Emacs function call outcomes. */ |
| 98 | enum emacs_funcall_exit | 104 | enum emacs_funcall_exit |