From 07b53741527d456011fcc45d7e385c3c835d5cc2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 30 Jul 2020 09:27:18 -0700 Subject: [PATCH] Work around some Oracle Studio attribute bugs These were discovered when building bleeding-edge Emacs with Oracle Studio. * m4/gnulib-common.m4 (_GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_MAY_ALIAS): Port to Oracle Studio 12.6, which mishandles __attribute__ ((__cold__)) and __attribute__ ((__may_alias__)) even though __has_attribute says they work. --- ChangeLog | 10 ++++++++++ m4/gnulib-common.m4 | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b9f044f9b..cf82ab2548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2020-07-30 Paul Eggert + + Work around some Oracle Studio attribute bugs + These were discovered when building bleeding-edge Emacs with + Oracle Studio. + * m4/gnulib-common.m4 (_GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_MAY_ALIAS): + Port to Oracle Studio 12.6, which mishandles __attribute__ + ((__cold__)) and __attribute__ ((__may_alias__)) even though + __has_attribute says they work. + 2020-07-29 Bruno Haible unicodeio: Fix wrong result on musl libc. diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 7449648c6e..57f3a78011 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -120,9 +120,14 @@ AC_DEFUN([gl_COMMON_BODY], [ #endif /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at - . */ + . + Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ -# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif #else # define _GL_ATTRIBUTE_COLD #endif @@ -176,7 +181,8 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_LEAF #endif -#if _GL_HAS_ATTRIBUTE (may_alias) +/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ +#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) #else # define _GL_ATTRIBUTE_MAY_ALIAS -- 2.39.5