gcl latest が intel macでビルドエラーになる件
gclの最新がリリースされたらしいのでビルドしようとしてみた。
git clone https://git.savannah.gnu.org/git/gcl.git cd gcl/gcl ./configure --prefix=$HOME/gcl make
Too many errors
エラーが多い。
o/format.c:1956:3: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 1956 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:1956:3: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 1956 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:1967:3: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 1967 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:1967:3: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 1967 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:1980:3: error: incompatible function pointer types assigning to 'object (*)(void)' (aka 'union lispunion *(*)(void)') from 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') [-Wincompatible-function-pointer-types] 1980 | fmt_restore; | ^~~~~~~~~~~ o/format.c:194:15: note: expanded from macro 'fmt_restore' 194 | fmt_advance=old_fmt_advance ; \ | ^~~~~~~~~~~~~~~~ o/format.c:1980:3: error: incompatible function pointer types assigning to 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') from 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 1980 | fmt_restore; | ^~~~~~~~~~~ o/format.c:195:10: note: expanded from macro 'fmt_restore' 195 | fmt_lt=old_fmt_lt ; \ | ^~~~~~~~~~~ o/format.c:2262:3: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 2262 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:2262:3: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2262 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:2282:3: error: incompatible function pointer types assigning to 'object (*)(void)' (aka 'union lispunion *(*)(void)') from 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') [-Wincompatible-function-pointer-types] 2282 | fmt_restore; | ^~~~~~~~~~~ o/format.c:194:15: note: expanded from macro 'fmt_restore' 194 | fmt_advance=old_fmt_advance ; \ | ^~~~~~~~~~~~~~~~ o/format.c:2282:3: error: incompatible function pointer types assigning to 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') from 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2282 | fmt_restore; | ^~~~~~~~~~~ o/format.c:195:10: note: expanded from macro 'fmt_restore' 195 | fmt_lt=old_fmt_lt ; \ | ^~~~~~~~~~~ o/format.c:2285:3: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 2285 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:2285:3: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2285 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:2310:3: error: incompatible function pointer types assigning to 'object (*)(void)' (aka 'union lispunion *(*)(void)') from 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') [-Wincompatible-function-pointer-types] 2310 | fmt_restore; | ^~~~~~~~~~~ o/format.c:194:15: note: expanded from macro 'fmt_restore' 194 | fmt_advance=old_fmt_advance ; \ | ^~~~~~~~~~~~~~~~ o/format.c:2310:3: error: incompatible function pointer types assigning to 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') from 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2310 | fmt_restore; | ^~~~~~~~~~~ o/format.c:195:10: note: expanded from macro 'fmt_restore' 195 | fmt_lt=old_fmt_lt ; \ | ^~~~~~~~~~~ o/format.c:2312:3: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 2312 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:2312:3: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2312 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:2337:4: error: incompatible function pointer types assigning to 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') from 'object (*)(void)' (aka 'union lispunion *(*)(void)') [-Wincompatible-function-pointer-types] 2337 | fmt_save; | ^~~~~~~~ o/format.c:180:19: note: expanded from macro 'fmt_save' 180 | old_fmt_advance=fmt_advance ; \ | ^~~~~~~~~~~~ o/format.c:2337:4: error: incompatible function pointer types assigning to 'volatile void (*)(volatile bool, bool)' (aka 'volatile void (*)(volatile int, int)') from 'void (*)(volatile bool, bool)' (aka 'void (*)(volatile int, int)') [-Wincompatible-function-pointer-types] 2337 | fmt_save; | ^~~~~~~~ o/format.c:181:14: note: expanded from macro 'fmt_save' 181 | old_fmt_lt=fmt_lt ; \ | ^~~~~~~ o/format.c:2345:5: error: incompatible function pointer types assigning to 'object (*)(void)' (aka 'union lispunion *(*)(void)') from 'volatile object (*)(void)' (aka 'union lispunion *volatile (*)(void)') [-Wincompatible-function-pointer-types] 2345 | fmt_restore; | ^~~~~~~~~~~ o/format.c:194:15: note: expanded from macro 'fmt_restore' 194 | fmt_advance=old_fmt_advance ; \ | ^~~~~~~~~~~~~~~~ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
この種類のエラーは単純に明示的にキャストしてOKだろう。
まじめに直す
git branch -C my-fix git checkout my-fix
diff --git a/gcl/o/format.c b/gcl/o/format.c index ceb218c9d..58b805f22 100644 --- a/gcl/o/format.c +++ b/gcl/o/format.c @@ -166,7 +166,7 @@ object sSAindent_formatted_outputA; VOL object(*old_fmt_advance)(void) ; \ VOL void (*old_fmt_lt)(volatile bool,bool) ; \ VOL format_parameter *old_fmt_paramp -#define fmt_save old_fmt_stream = fmt_stream; \ +#define fmt_save old_fmt_stream = (typeof(old_fmt_stream))fmt_stream; \ old_ctl_origin = ctl_origin; \ old_ctl_index = ctl_index; \ old_ctl_end = ctl_end; \ @@ -177,10 +177,10 @@ object sSAindent_formatted_outputA; old_fmt_jmp_bufp = fmt_jmp_bufp; \ old_fmt_indents = fmt_indents; \ old_fmt_string = fmt_string ; \ - old_fmt_advance=fmt_advance ; \ - old_fmt_lt=fmt_lt ; \ + old_fmt_advance=(typeof(old_fmt_advance))fmt_advance ; \ + old_fmt_lt=(typeof(old_fmt_lt))fmt_lt ; \ old_fmt_paramp = fmt_paramp -#define fmt_restore fmt_stream = old_fmt_stream; \ +#define fmt_restore fmt_stream =(typeof(fmt_stream)) old_fmt_stream; \ ctl_origin = old_ctl_origin; \ ctl_index = old_ctl_index; \ ctl_end = old_ctl_end; \ @@ -191,8 +191,8 @@ object sSAindent_formatted_outputA; fmt_jmp_bufp = old_fmt_jmp_bufp; \ fmt_indents = old_fmt_indents; \ fmt_string = old_fmt_string ; \ - fmt_advance=old_fmt_advance ; \ - fmt_lt=old_fmt_lt ; \ + fmt_advance=(typeof(fmt_advance))old_fmt_advance ; \ + fmt_lt=(typeof(fmt_lt))old_fmt_lt ; \ fmt_paramp = old_fmt_paramp #define fmt_old1 VOL object old_fmt_stream; \
確認
make
上のエラーが解決した。 一回コミットする。
次のエラー
depbase=`echo o/nfunlink.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -I./h -I h -I /usr/include/tirpc -fsigned-char -pipe -fcommon -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC -fno-pic -std=gnu17 -Wall -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign -Wno-unused-but-set-variable -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wno-incomplete-setjmp-declaration -m64 -O3 -fomit-frame-pointer -I o -MT o/nfunlink.o -MD -MP -MF $depbase.Tpo -c -o o/nfunlink.o o/nfunlink.c &&\ mv -f $depbase.Tpo $depbase.Po depbase=`echo o/usig.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -I./h -I h -I /usr/include/tirpc -fsigned-char -pipe -fcommon -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC -fno-pic -std=gnu17 -Wall -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign -Wno-unused-but-set-variable -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wno-incomplete-setjmp-declaration -m64 -O3 -fomit-frame-pointer -I o -MT o/usig.o -MD -MP -MF $depbase.Tpo -c -o o/usig.o o/usig.c &&\ mv -f $depbase.Tpo $depbase.Po o/usig.c:237:36: error: incompatible pointer to integer conversion initializing 'fixnum' (aka 'long') with an expression of type 'object' (aka 'union lispunion *') [-Wint-conversion] 237 | ifuncall3(sSfloating_point_error,FPE_CODE(i,v),FPE_ADDR(i,v),FPE_CTXT(v)); | ^~~~~~~~~~~~~ ./h/config.h:176:25: note: expanded from macro 'FPE_CODE' 176 | #define FPE_CODE(i_,v_) make_fixnum(FFN(fSfpe_code)(*(fixnum *)&UC(v_)->uc_mcontext->__fs.__fpu_fsw,UC(v_)->uc_mcontext->__fs.__fpu_mxcsr)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./h/../h/fixnum.h:36:44: note: expanded from macro 'make_fixnum' 36 | #define make_fixnum(a_) ({register fixnum _q1=(a_);register object _q3;\ | ^ ~~~~ 1 error generated. make[1]: *** [o/usig.o] Error 1 make: *** [all] Error 2
このエラーは関数の引数の型が宣言と呼出しで合っていないというエラー。ただこのコードを読むと最後がマクロになっている。マクロを読むと最後の値が object
型のようになってはいるんだが、うーん。
#define make_fixnum(a_) ({register fixnum _q1=(a_);register object _q3;\ _q3=is_imm_fix(_q1) ? make_imm_fixnum(_q1) : make_fixnum1(_q1);_q3;}) #define CMPmake_fixnum(a_) make_fixnum(a_)/*FIXME*/