[ruby-dev:49773] [Ruby trunk Bug#12701] compile error about ALWAYS_INLINE

From: ngotogenome@...
Date: 2016-08-24 10:59:56 UTC
List: ruby-dev #49773
Issue #12701 has been reported by Naohisa Goto.

----------------------------------------
Bug #12701: compile error about ALWAYS_INLINE
https://bugs.ruby-lang.org/issues/12701

* Author: Naohisa Goto
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
遅くとも r55884 以降、Solaris 10上の古い Fujitsu C Compiler (fcc) にて、以下のコンパイルエラーが発生します。

```
fcc -O2 -KV9 -KVIS2  -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/8.0.0 -o vm.o -c vm.c
(中略)
"./vm_insnhelper.c", line 864: error: invalid storage class specifier `static' specified for `vm_getivar' at parameter scope
"./vm_insnhelper.c", line 864: warning: external declaration has no declaration specifier
(中略)
make: *** [vm.o] Error 1
```

ALWAYS_INLINE 未定義時の代替実装が欠けていたのが原因で、以下のパッチで治りました。

```
--- include/ruby/defines.h      (revision 55996)
+++ include/ruby/defines.h      (working copy)
@@ -45,6 +45,9 @@
 #ifndef NOINLINE
 # define NOINLINE(x) x
 #endif
+#ifndef ALWAYS_INLINE
+# define ALWAYS_INLINE(x) x
+#endif
 #ifndef ERRORFUNC
 # define HAVE_ATTRIBUTE_ERRORFUNC 0
 # define ERRORFUNC(mesg, x) x
```

逆に、以前どうしてコンパイルが通っていたのか不思議なくらいです。どうやら、偶然にも、文法的にエラーにならない範囲内だったようです。
r55884 では、それ以前に ALWAYS_INLINE を使っていた所と異なり、プロトタイプ宣言が引数の名前を含めず型だけを宣言するスタイルだったため、いよいよ破綻してエラーになったということのようです。




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

In This Thread

Prev Next