Backport #8227
closedaddr2line.c compile error on Solaris since r39887
Description
r39887以降、Solarisで以下のようなコンパイルエラーが発生します。
Solaris では、quad_t は別の意味の構造体が割り当てられており、u_quad_t は定義されおらず、
また、__inline は、GCC か Sun Studio 12 Update 1 以降でないと使えないためです。
(GCCは未確認)
fcc -O -KV9 -KVIS2 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/u
sr/local/64/include -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -o
addr2line.o -c addr2line.c
"addr2line.c", line 691: error: syntax error near int' "addr2line.c", line 691: error: function type is required for
__inline'
"addr2line.c", line 915: error: assignment from int' to
quad_t': operator =' "addr2line.c", line 988: error: undeclared identifier
u_quad_t'
"addr2line.c", line 988: error: syntax error near )' "addr2line.c", line 988: error: syntax error near
)'
"addr2line.c", line 1006: error: assignment from quad_t' to
uintmax_t': operator `='
以下のようなパッチでコンパイルは通るようになります。
===================================================================
--- addr2line.c (revision 40156)
+++ addr2line.c (working copy)
@@ -646,6 +646,19 @@
free(lines);
}
+#if defined(__sun)
+/* Solaris has different quad_t and does not have u_quad_t /
+# include "ruby/defines.h"
+# define quad_t LONG_LONG
+# define u_quad_t unsigned LONG_LONG
+/ __inline can only be used with GCC or Sun Studio 12 Update 1 or later /
+# if defined(GNUC)
+# elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+# else
+# define __inline inline
+# endif
+#endif / defined(__sun) /
+
/ From FreeBSD's lib/libstand/printf.c /
/-
- Copyright (c) 1986, 1988, 1991, 1993
===================================================================