Issue #15293 has been reported by ngoto (Naohisa Goto).

----------------------------------------
Bug #15293: Since r64852, on Solaris with Oracle Developer Studio 12.4, syntax error
https://bugs.ruby-lang.org/issues/15293

* Author: ngoto (Naohisa Goto)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
r64852以降、Solaris 10 上の Oracle Developer Studio 12.6 にてコンパイルすると、以下のエラーで array.c のコンパイルに失敗します。(r65641 にて確認)

~~~
cc -errtags=yes  -xO4 -xtarget=sparc64xplus -m64 -DRUBY_DEVEL=1 -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -D_XOPEN_SOURCE=500   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0  -o array.o -c array.c
"array.c", line 2977: warning: implicit function declaration: __extension__ (E_NO_IMPLICIT_DECL_ALLOWED)
"array.c", line 2977: syntax error before or at: {
"array.c", line 2977: undefined symbol: rb_intern_id_cache
"array.c", line 2977: undefined symbol: rb_intern_id_cache
"array.c", line 2977: syntax error before or at: )
"array.c", line 2977: warning: old-style declaration or incorrect type for: rb_intern (E_OLD_STYLE_DECL_OR_BAD_TYPE)
"array.c", line 2977: identifier redeclared: rb_intern
	current : function() returning int
	previous: function(pointer to const char) returning unsigned long : "./include/ruby/ruby.h", line 1792
"array.c", line 2977: warning: old-style declaration or incorrect type for: sort_by_i (E_OLD_STYLE_DECL_OR_BAD_TYPE)
"array.c", line 2977: identifier redeclared: sort_by_i
	current : int
	previous: function(unsigned long, unsigned long, int, pointer to const unsigned long, unsigned long) returning unsigned long : "array.c", line 2949
"array.c", line 2977: warning: syntax error:  empty declaration (E_EMPTY_DECLARATION)
"array.c", line 2978: warning: function prototype parameters must have types (E_FUNC_PROTO_REQ_TYPES)
"array.c", line 2978: warning: old-style declaration or incorrect type for: rb_ary_replace (E_OLD_STYLE_DECL_OR_BAD_TYPE)
"array.c", line 2978: identifier redeclared: rb_ary_replace
	current : function() returning int
	previous: function(unsigned long, unsigned long) returning unsigned long : "./include/ruby/intern.h", line 96
"array.c", line 2979: syntax error before or at: return
"array.c", line 2979: warning: old-style declaration or incorrect type for: ary (E_OLD_STYLE_DECL_OR_BAD_TYPE)
"array.c", line 3760: identifier redeclared: rb_ary_replace
	current : function(unsigned long, unsigned long) returning unsigned long
	previous: function() returning int : "array.c", line 2978
"array.c", line 6363: warning: statement not reached (E_STATEMENT_NOT_REACHED)
"array.c", line 6409: warning: statement not reached (E_STATEMENT_NOT_REACHED)
cc: acomp failed for array.c
make: *** [array.o] Error 2
~~~

理由は、[Bug #12397] と同じです。
Oracle Solaris Studio 12.4 には、`__builtin_constant_p()` は存在するため、`HAVE_BUILTIN___BUILTIN_CONSTANT_P` は 1 になります。しかし、`__extension__` は存在しません。(GCC拡張?)
このため、`__extension__` が普通の関数と見なされ、syntax error が発生しています。

つまり、r64582 だけでは条件を網羅できておらず不完全であり、`__extension__` の有無と(直下のコメント行に書かれているように)statement expression の有無に関する条件も追加する必要があると思います。

[Bug #12397] にも少し書いたように、configure で `__extension__` や statement expression の有無をチェックするようにするのがベストとは思います。



-- 
https://bugs.ruby-lang.org/