[MLton] Two small patches
Wesley W. Terpstra
terpstra@gkec.tu-darmstadt.de
Wed, 8 Dec 2004 01:23:15 +0100
--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Here's one patch to add a pair of easy functions to mingw.
The added cast makes explicit the return cast which happens (and is correct).
I also wonder whether permission changing methods should silently succeed?
Owner checking and getuid, etc might also sensibly return the same constant.
That's what cygwin does under at least Win95.
Another patch moves the CFLAGS from CC as is common convention.
(To allow: make CC=i586-mingw32msvc-gcc TARGET_OS=mingw TARGET_ARCH=x86)
--
Wesley W. Terpstra
--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="proper-cc.patch"
Index: runtime/Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/Makefile,v
retrieving revision 1.92
diff -u -r1.92 Makefile
--- runtime/Makefile 28 Sep 2004 01:11:51 -0000 1.92
+++ runtime/Makefile 8 Dec 2004 00:13:00 -0000
@@ -35,9 +35,9 @@
FLAGS += -b $(TARGET)
endif
-CC = gcc -Wall -I. -Iplatform -D_FILE_OFFSET_BITS=64 $(FLAGS)
-CFLAGS = -O2
-DEBUGFLAGS = -gstabs+ -g2
+CC = gcc
+CFLAGS = -O2 -Wall -I. -Iplatform -D_FILE_OFFSET_BITS=64 $(FLAGS)
+DEBUGFLAGS = $(CFLAGS) -gstabs+ -g2
CFILES = \
$(shell find basis -type f | grep '\.c$$' | grep -v Real/) \
Index: bytecode/Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/bytecode/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- bytecode/Makefile 20 Oct 2004 23:20:02 -0000 1.10
+++ bytecode/Makefile 8 Dec 2004 00:13:00 -0000
@@ -1,15 +1,16 @@
all: interpret.o interpret-gdb.o print-opcodes
-CC = gcc -fomit-frame-pointer -I../runtime -I../include -Wall
+CC = gcc
+CFLAGS = -fomit-frame-pointer -I../runtime -I../include -Wall
interpret.o: interpret.c interpret.h opcode.h
- $(CC) -c -O2 interpret.c
+ $(CC) $(CFLAGS) -c -O2 interpret.c
interpret-gdb.o: interpret.c interpret.h
- $(CC) -c -o $@ -gstabs+ -g2 -DASSERT=1 interpret.c
+ $(CC) $(CFLAGS) -c -o $@ -gstabs+ -g2 -DASSERT=1 interpret.c
print-opcodes: print-opcodes.c opcode.h
- $(CC) -o print-opcodes -I../runtime -L../runtime \
+ $(CC) $(CFLAGS) -o print-opcodes -I../runtime -L../runtime \
print-opcodes.c -lmlton
.PHONY: clean
@@ -18,4 +19,4 @@
.PHONY: exp
exp:
- gcc -E -I../runtime -I../include interpret.c >/tmp/z.exp
+ $(CC) -E -I../runtime -I../include interpret.c >/tmp/z.exp
--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="easy-mingw-fns.patch"
Index: mingw.c
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/platform/mingw.c,v
retrieving revision 1.9
diff -u -r1.9 mingw.c
--- mingw.c 2 Dec 2004 21:07:43 -0000 1.9
+++ mingw.c 8 Dec 2004 00:12:13 -0000
@@ -7,7 +7,7 @@
}
HANDLE fileDesHandle (int fd) {
- return _get_osfhandle (fd);
+ return (HANDLE)_get_osfhandle (fd);
}
int getpagesize (void) {
@@ -207,7 +207,7 @@
}
int ftruncate (int fd, off_t length) {
- die ("ftruncate not implemented");
+ return _chsize(fd, length);
}
int link (const char *oldpath, const char *newpath) {
@@ -248,7 +248,7 @@
}
int fsync (int fd) {
- die ("fsync not implemented");
+ return _commit(fd);
}
int pipe (int filedes[2]) {
--C7zPtVaVf+AK4Oqc--