diff options
| author | Aurélien Aptel | 2015-11-30 23:53:40 +0100 |
|---|---|---|
| committer | Aurélien Aptel | 2015-11-30 23:53:40 +0100 |
| commit | 7210f5130abb909aebcbb09a8a71558100fb9f96 (patch) | |
| tree | 8eeeb46382bdd605ac94f66fcd0f49e96715a38e | |
| parent | ec62f2f5ad37ff5fc7ba77f57e2fc81ac7cdcc9d (diff) | |
| download | emacs-7210f5130abb909aebcbb09a8a71558100fb9f96.tar.gz emacs-7210f5130abb909aebcbb09a8a71558100fb9f96.zip | |
* 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.
| -rw-r--r-- | 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 dce5301ab0f..a3aa5017a4e 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/>. */ | |||
| 26 | 26 | ||
| 27 | #if defined __cplusplus && __cplusplus >= 201103L | 27 | #if defined __cplusplus && __cplusplus >= 201103L |
| 28 | # define EMACS_NOEXCEPT noexcept | 28 | # define EMACS_NOEXCEPT noexcept |
| 29 | |||
| 30 | /* Function prototype for module user-pointer finalizers. | ||
| 31 | |||
| 32 | NOTE: C++11 15.4: An exception-specification shall not appear in a | ||
| 33 | typedef declaration or alias-declaration. | ||
| 34 | |||
| 35 | */ | ||
| 36 | void emacs_dummy_finalizer_function (void *) noexcept; | ||
| 37 | typedef decltype(emacs_dummy_finalizer_function) *emacs_finalizer_function; | ||
| 38 | |||
| 29 | #else | 39 | #else |
| 30 | # define EMACS_NOEXCEPT | 40 | # define EMACS_NOEXCEPT |
| 41 | typedef void (*emacs_finalizer_function) (void *); | ||
| 31 | #endif | 42 | #endif |
| 32 | 43 | ||
| 33 | #ifdef __cplusplus | 44 | #ifdef __cplusplus |
| @@ -64,9 +75,6 @@ typedef int (*emacs_init_function) (struct emacs_runtime *ert); | |||
| 64 | typedef emacs_value (*emacs_subr) (emacs_env *env, ptrdiff_t nargs, | 75 | typedef emacs_value (*emacs_subr) (emacs_env *env, ptrdiff_t nargs, |
| 65 | emacs_value args[], void *data); | 76 | emacs_value args[], void *data); |
| 66 | 77 | ||
| 67 | /* Function prototype for module user-pointer finalizers. */ | ||
| 68 | typedef void (*emacs_finalizer_function) (void *) EMACS_NOEXCEPT; | ||
| 69 | |||
| 70 | /* Possible Emacs function call outcomes. */ | 78 | /* Possible Emacs function call outcomes. */ |
| 71 | enum emacs_funcall_exit | 79 | enum emacs_funcall_exit |
| 72 | { | 80 | { |