summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-07-30 09:27:18 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-07-30 09:33:33 -0700
commit07b53741527d456011fcc45d7e385c3c835d5cc2 (patch)
treecdb35fd6e2d9f33bdf576a997cf48ce8d5858fc3 /m4
parent0b273fff2f1bcec210669dad3a4eaaafe1089aba (diff)
downloadgnulib-07b53741527d456011fcc45d7e385c3c835d5cc2.tar.gz
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.
Diffstat (limited to 'm4')
-rw-r--r--m4/gnulib-common.m412
1 files changed, 9 insertions, 3 deletions
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
- <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