bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Work around some Oracle Studio attribute bugs


From: Paul Eggert
Subject: [PATCH] Work around some Oracle Studio attribute bugs
Date: Thu, 30 Jul 2020 09:33:49 -0700

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 9b9f044f9..cf82ab254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-07-30  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <bruno@clisp.org>
 
        unicodeio: Fix wrong result on musl libc.
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 7449648c6..57f3a7801 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
-   <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. */
+   <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
+   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.25.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]