>From 80f8f15b5e9d6776948adedc8b1ab25c2a41df6e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 14 Jun 2017 11:01:02 -0700 Subject: [PATCH] Port cleanup check to Oracle Studio 12.5 * src/conf_post.h (__has_attribute_cleanup): Resurrect. * src/emacs-module.c: Verify __has_attribute (cleanup), but in an #if this time. --- src/conf_post.h | 5 ++++- src/emacs-module.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/conf_post.h b/src/conf_post.h index 18b096e..e1d6a93 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -57,10 +57,13 @@ typedef bool bool_bf; #endif /* Simulate __has_attribute on compilers that lack it. It is used only - on arguments like alloc_size that are handled in this simulation. */ + on arguments like alloc_size that are handled in this simulation. + __has_attribute should be used only in #if expressions, as Oracle + Studio 12.5's __has_attribute does not work in plain code. */ #ifndef __has_attribute # define __has_attribute(a) __has_attribute_##a # define __has_attribute_alloc_size GNUC_PREREQ (4, 3, 0) +# define __has_attribute_cleanup GNUC_PREREQ (3, 4, 0) # define __has_attribute_externally_visible GNUC_PREREQ (4, 1, 0) # define __has_attribute_no_address_safety_analysis false # define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0) diff --git a/src/emacs-module.c b/src/emacs-module.c index de62329..5c413ee 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -170,6 +170,10 @@ static struct emacs_env_private global_env_private; internal_handler_##handlertype, \ internal_cleanup_##handlertype) +#if !__has_attribute (cleanup) + #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC" +#endif + /* It is very important that pushing the handler doesn't itself raise a signal. Install the cleanup only after the handler has been pushed. Use __attribute__ ((cleanup)) to avoid -- 2.9.4