Rui Ueyama
rui31****@gmail*****
2007年 8月 9日 (木) 16:17:20 JST
GaucheをLinux/AMD64でコンパイルすると、void*とintを変換 している旨の警告がでるのですが、intptr_tを経由してキャスト するようにしてその警告が出ないようにしてみました。 添付のパッチを参照してください。簡単なパッチなので見れば すぐわかりますが、プログラムの動作やAPIに影響はないつもり です。 -- 植山 類 -------------- next part -------------- Index: src/class.c =================================================================== RCS file: /cvsroot/gauche/Gauche/src/class.c,v retrieving revision 1.152 diff -u -r1.152 class.c --- src/class.c 22 May 2007 10:23:47 -0000 1.152 +++ src/class.c 9 Aug 2007 07:04:27 -0000 @@ -1363,7 +1363,7 @@ */ static ScmObj slot_ref_cc(ScmObj result, void **data) { - return Scm_VMSlotRef(SCM_OBJ(data[0]), SCM_OBJ(data[1]), (int)data[2]); + return Scm_VMSlotRef(SCM_OBJ(data[0]), SCM_OBJ(data[1]), (intptr_t)data[2]); } ScmObj Scm_VMSlotRef(ScmObj obj, ScmObj slot, int boundp) @@ -1375,7 +1375,7 @@ if (!SCM_FALSEP(klass->redefined)) { data[0] = obj; data[1] = slot; - data[2] = (void*)boundp; + data[2] = (void*)(intptr_t)boundp; Scm_VMPushCC(slot_ref_cc, data, 3); return instance_class_redefinition(obj, klass); } Index: src/port.c =================================================================== RCS file: /cvsroot/gauche/Gauche/src/port.c,v retrieving revision 1.140 diff -u -r1.140 port.c --- src/port.c 7 Aug 2007 10:42:14 -0000 1.140 +++ src/port.c 9 Aug 2007 07:04:27 -0000 @@ -811,7 +811,7 @@ static int file_filler(ScmPort *p, int cnt) { int nread = 0, r; - int fd = (int)p->src.buf.data; + int fd = (intptr_t)p->src.buf.data; char *datptr = p->src.buf.end; SCM_ASSERT(fd >= 0); while (nread == 0) { @@ -835,7 +835,7 @@ { int nwrote = 0, r; int datsiz = SCM_PORT_BUFFER_AVAIL(p); - int fd = (int)p->src.buf.data; + int fd = (intptr_t)p->src.buf.data; char *datptr = p->src.buf.buffer; SCM_ASSERT(fd >= 0); @@ -856,26 +856,26 @@ static void file_closer(ScmPort *p) { - int fd = (int)p->src.buf.data; + int fd = (intptr_t)p->src.buf.data; SCM_ASSERT(fd >= 0); close(fd); } static int file_ready(ScmPort *p) { - int fd = (int)p->src.buf.data; + int fd = (intptr_t)p->src.buf.data; SCM_ASSERT(fd >= 0); return Scm_FdReady(fd, SCM_PORT_DIR(p)); } static int file_filenum(ScmPort *p) { - return (int)p->src.buf.data; + return (intptr_t)p->src.buf.data; } static off_t file_seeker(ScmPort *p, off_t offset, int whence) { - return lseek((int)p->src.buf.data, offset, whence); + return lseek((intptr_t)p->src.buf.data, offset, whence); } ScmObj Scm_OpenFilePort(const char *path, int flags, int buffering, int perm) @@ -907,7 +907,7 @@ bufrec.ready = file_ready; bufrec.filenum = file_filenum; bufrec.seeker = file_seeker; - bufrec.data = (void*)fd; + bufrec.data = (void*)(intptr_t)fd; p = Scm_MakeBufferedPort(SCM_CLASS_PORT, SCM_MAKE_STR_COPYING(path), dir, TRUE, &bufrec); return p; @@ -935,7 +935,7 @@ bufrec.ready = file_ready; bufrec.filenum = file_filenum; bufrec.seeker = NULL; - bufrec.data = (void*)fd; + bufrec.data = (void*)(intptr_t)fd; p = Scm_MakeBufferedPort(SCM_CLASS_PORT, name, direction, ownerp, &bufrec); return p; Index: src/vm.c =================================================================== RCS file: /cvsroot/gauche/Gauche/src/vm.c,v retrieving revision 1.271 diff -u -r1.271 vm.c --- src/vm.c 23 Jun 2007 06:47:14 -0000 1.271 +++ src/vm.c 9 Aug 2007 07:04:27 -0000 @@ -3030,7 +3030,7 @@ vm->handlers = prev; d[0] = (void*)result; - d[1] = (void*)vm->numVals; + d[1] = (void*)(intptr_t)vm->numVals; if (vm->numVals > 1) { ScmObj *array = SCM_NEW_ARRAY(ScmObj, (vm->numVals-1)); memcpy(array, vm->vals, sizeof(ScmObj)*(vm->numVals-1)); @@ -3043,7 +3043,7 @@ static ScmObj dynwind_after_cc(ScmObj result, void **data) { ScmObj val0 = SCM_OBJ(data[0]); - int nvals = (int)data[1]; + int nvals = (intptr_t)data[1]; ScmVM *vm = theVM; vm->numVals = nvals; @@ -3686,7 +3686,7 @@ ScmObj cp; ScmVM *vm = theVM; - vm->numVals = (int)data[0]; + vm->numVals = (intptr_t)data[0]; vm->val0 = data[1]; if (vm->numVals > 1) { cp = SCM_OBJ(data[2]); @@ -3703,7 +3703,7 @@ void *data[3]; /* preserve the current continuation */ - data[0] = (void*)vm->numVals; + data[0] = (void*)(intptr_t)vm->numVals; data[1] = vm->val0; if (vm->numVals > 1) { int i;