From 220f7760b7c41ed88c7960fc70eedd777fb3501e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 21 Jan 2011 16:14:21 -0700 Subject: [PATCH] fix MSVC build regressions --- classpath/java-io.cpp | 6 ++++-- makefile | 3 ++- readme.txt | 2 +- src/finder.cpp | 2 +- src/main.cpp | 8 +++++++- src/process.cpp | 4 ++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 3c4ec00544..abc7684634 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -37,10 +37,12 @@ # define OPEN_MASK O_BINARY # ifdef _MSC_VER -# define S_ISREG(x) ((x) | _S_IFREG) -# define S_ISDIR(x) ((x) | _S_IFDIR) +# define S_ISREG(x) ((x) & _S_IFREG) +# define S_ISDIR(x) ((x) & _S_IFDIR) # define S_IRUSR _S_IREAD # define S_IWUSR _S_IWRITE +# define W_OK 2 +# define R_OK 4 # else # define OPEN _wopen # define CREAT _wcreat diff --git a/makefile b/makefile index ef5fb8b04e..5b34b5051b 100644 --- a/makefile +++ b/makefile @@ -353,7 +353,8 @@ ifdef msvc ld = "$(msvc)/BIN/link.exe" mt = "mt.exe" cflags = -nologo -DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \ - -DUSE_ATOMIC_OPERATIONS \ + -DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \ + -DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \ -Fd$(build)/$(name).pdb -I"$(zlib)/include" -I$(src) -I"$(build)" \ -I"$(windows-java-home)/include" -I"$(windows-java-home)/include/win32" shared = -dll diff --git a/readme.txt b/readme.txt index 6bfc750124..0f0ad44bb7 100644 --- a/readme.txt +++ b/readme.txt @@ -187,7 +187,7 @@ C++ portions of the VM, while the assembly code and helper tools are built using GCC. The MSVC build has been tested with Visual Studio Express Edition -versions 8 and 9. Other versions may also work. +versions 8, 9, and 10. Other versions may also work. To build with MSVC, install Cygwin as described above and set the following environment variables: diff --git a/src/finder.cpp b/src/finder.cpp index 543c45e312..b0e25ef82a 100644 --- a/src/finder.cpp +++ b/src/finder.cpp @@ -458,7 +458,7 @@ class JarIndex { RUNTIME_ARRAY_BODY(n)[length] = '/'; RUNTIME_ARRAY_BODY(n)[length + 1] = 0; - node = findNode(n); + node = findNode(RUNTIME_ARRAY_BODY(n)); if (node) { return System::TypeDirectory; } else { diff --git a/src/main.cpp b/src/main.cpp index 8cdb435dd0..9996e6078d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,7 +62,13 @@ extern "C" void __cxa_pure_virtual(void) { abort(); } // we link against a System implmentation, which requires this at link // time, but it should not be used at runtime: extern "C" uint64_t -vmNativeCall(void*, void*, unsigned, unsigned) { abort(); } +vmNativeCall(void*, void*, unsigned, unsigned) +{ + abort(); + // abort is not declared __declspec(noreturn) on MSVC, so we have to + // pretend it might return to make the compiler happy: + return 0; +} #endif // BOOT_LIBRARY diff --git a/src/process.cpp b/src/process.cpp index 00edbe66b7..4c06794461 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -206,12 +206,12 @@ resolveNativeMethod(Thread* t, object method, const char* prefix, object resolveNativeMethod(Thread* t, object method) { - void* p = ::resolveNativeMethod(t, method, "Avian_", 6, 3); + void* p = resolveNativeMethod(t, method, "Avian_", 6, 3); if (p) { return makeNative(t, p, true); } - p = ::resolveNativeMethod(t, method, "Java_", 5, -1); + p = resolveNativeMethod(t, method, "Java_", 5, -1); if (p) { return makeNative(t, p, false); }