Project

General

Profile

Actions

Bug #12767

closed

Since r56169, compile error of vsnprintf.c with Oracle Solaris Studio 12.x

Added by ngoto (Naohisa Goto) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:49807]

Description

おそらく r56169以降、Solaris 10 上の Oracle Solaris Studio 12.3 では、以下のコンパイルエラーでビルドに失敗します。

cc -errtags=yes  -xO4 -xtarget=sparc64viiplus -m64 -DRUBY_EXPORT -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/9.0.0 -o sprintf.o -c sprintf.c
"vsnprintf.c", line 561: warning: function prototype parameters must have types (E_FUNC_PROTO_REQ_TYPES)
"vsnprintf.c", line 837: undefined symbol: ulval
"vsnprintf.c", line 862: undefined symbol: ulval
"vsnprintf.c", line 980: undefined symbol: ulval
cc: acomp failed for sprintf.c
make: *** [sprintf.o] Error 2

561行目は以下のように ulval を定義しているはずの行ですが、Warningのとおり、関数プロトタイプと見なされてしまっています。
そして、ulval が出現する832行目などで、未定義というエラーが出ています。

	u_long MAYBE_UNUSED(ulval); /* integer arguments %[diouxX] */

./configure 時の MAYBE_UNUSEDなどの結果は以下の通りです。

checking for WARN_UNUSED_RESULT function attribute... x
checking for MAYBE_UNUSED function attribute... x

そして、config.h には WARN_UNUSED_RESULT および MAYBE_UNUSED の定義の行は存在しません。
これは、FUNC_STDCALL など x になっている他の function attribute についても同様で、 configure の仕様の気がします。

このため、internal.h には MAYBE_UNUSED (および WARN_UNUSED_RESULT)の代替実装が必要ですが、r56169 で削除されてしまっています。

Actions #1

Updated by ngoto (Naohisa Goto) over 7 years ago

  • Status changed from Open to Closed

Applied in changeset r56172.


  • internal.h (MAYBE_UNUSED): The fallback definition is needed.
    Fix compile error with some non-GCC compilers such as
    Oracle Solaris Studio 12.3 on Solaris 10.
    [Bug #12767] [ruby-dev:49807]

  • internal.h (WARN_UNUSED_RESULT): ditto.

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

これは完全に考慮漏れでした。ごめんなさい。

Actions

Also available in: Atom PDF

Like0
Like0Like0