From: Paul Eggert Date: Wed, 14 Jun 2017 18:01:02 +0000 (-0700) Subject: Port cleanup check to Oracle Studio 12.5 X-Git-Tag: emacs-26.0.90~521^2~70 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d715e6d8c6a7f3507f4faca0961ac87d58fbfab8;p=emacs.git 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. --- diff --git a/src/conf_post.h b/src/conf_post.h index 18b096e2cf6..e1d6a9397d3 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 de62329b3b8..5c413ee0556 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