]> Savannah Git Hosting - gnulib.git/commitdiff
Work around some Oracle Studio attribute bugs
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 30 Jul 2020 16:27:18 +0000 (09:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 30 Jul 2020 16:33:33 +0000 (09:33 -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
m4/gnulib-common.m4

index 9b9f044f9bbbb0a904aba5483f2e5f91076d5eae..cf82ab25488db08b861b17a224646131cd9e7dbd 100644 (file)
--- 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.
index 7449648c6ed63e06b55bd577fb8d2415accbb185..57f3a7801188b194000ea23cfa3849d0900d2fa4 100644 (file)
@@ -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