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.
This commit is contained in:
Paul Eggert 2017-06-14 11:01:02 -07:00
parent b657de7f7a
commit d715e6d8c6
2 changed files with 8 additions and 1 deletions

View file

@ -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)

View file

@ -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