diff --git a/vm/code_block.cpp b/vm/code_block.cpp old mode 100644 new mode 100755 index d27460853d..bb3481904e --- a/vm/code_block.cpp +++ b/vm/code_block.cpp @@ -329,7 +329,6 @@ void *get_rel_symbol(array *literals, cell index) return sym; else { - printf("%s\n",name); return (void *)undefined_symbol; } } diff --git a/vm/code_gc.cpp b/vm/code_gc.cpp index 721c3f3a7a..59110d13f8 100755 --- a/vm/code_gc.cpp +++ b/vm/code_gc.cpp @@ -303,7 +303,7 @@ cell heap_size(heap *heap) } /* Compute where each block is going to go, after compaction */ - cell compute_heap_forwarding(heap *heap, std::tr1::unordered_map<heap_block *,char *> &forwarding) + cell compute_heap_forwarding(heap *heap, unordered_map<heap_block *,char *> &forwarding) { heap_block *scan = first_block(heap); char *address = (char *)first_block(heap); @@ -324,7 +324,7 @@ cell heap_size(heap *heap) return (cell)address - heap->seg->start; } - void compact_heap(heap *heap, std::tr1::unordered_map<heap_block *,char *> &forwarding) + void compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding) { heap_block *scan = first_block(heap); diff --git a/vm/code_gc.hpp b/vm/code_gc.hpp index 1ad68f46fd..ebd6349ab9 100755 --- a/vm/code_gc.hpp +++ b/vm/code_gc.hpp @@ -25,8 +25,8 @@ void unmark_marked(heap *heap); void free_unmarked(heap *heap, heap_iterator iter); void heap_usage(heap *h, cell *used, cell *total_free, cell *max_free); cell heap_size(heap *h); -cell compute_heap_forwarding(heap *h, std::tr1::unordered_map<heap_block *,char *> &forwarding); -void compact_heap(heap *h, std::tr1::unordered_map<heap_block *,char *> &forwarding); +cell compute_heap_forwarding(heap *h, unordered_map<heap_block *,char *> &forwarding); +void compact_heap(heap *h, unordered_map<heap_block *,char *> &forwarding); inline static heap_block *next_block(heap *h, heap_block *block) { diff --git a/vm/code_heap.cpp b/vm/code_heap.cpp index db1fd8f880..77c78ad533 100755 --- a/vm/code_heap.cpp +++ b/vm/code_heap.cpp @@ -119,7 +119,7 @@ PRIMITIVE(code_room) dpush(tag_fixnum(max_free / 1024)); } -static std::tr1::unordered_map<heap_block *,char *> forwarding; +static unordered_map<heap_block *,char *> forwarding; code_block *forward_xt(code_block *compiled) { diff --git a/vm/data_heap.cpp b/vm/data_heap.cpp old mode 100644 new mode 100755 index 0045539549..9c84a993c8 --- a/vm/data_heap.cpp +++ b/vm/data_heap.cpp @@ -241,7 +241,7 @@ cell unaligned_object_size(object *pointer) return callstack_size(untag_fixnum(((callstack *)pointer)->length)); default: critical_error("Invalid header",(cell)pointer); - return -1; /* can't happen */ + return 0; /* can't happen */ } } @@ -283,7 +283,7 @@ cell binary_payload_start(object *pointer) return sizeof(wrapper); default: critical_error("Invalid header",(cell)pointer); - return -1; /* can't happen */ + return 0; /* can't happen */ } } diff --git a/vm/dispatch.cpp b/vm/dispatch.cpp old mode 100644 new mode 100755 index bbcf20c57b..847a19d738 --- a/vm/dispatch.cpp +++ b/vm/dispatch.cpp @@ -103,7 +103,7 @@ static cell lookup_hairy_method(cell obj, cell methods) break; default: critical_error("Bad methods array",methods); - return -1; + return 0; } } } diff --git a/vm/inline_cache.cpp b/vm/inline_cache.cpp old mode 100644 new mode 100755 index 23c4b27c47..259a3e0c77 --- a/vm/inline_cache.cpp +++ b/vm/inline_cache.cpp @@ -70,7 +70,7 @@ static cell determine_inline_cache_type(array *cache_entries) if(!seen_hi_tag && !seen_tuple) return PIC_TAG; critical_error("Oops",0); - return -1; + return 0; } static void update_pic_count(cell type) diff --git a/vm/layouts.hpp b/vm/layouts.hpp index 114b88b925..8c96cf3187 100755 --- a/vm/layouts.hpp +++ b/vm/layouts.hpp @@ -93,6 +93,9 @@ class object; struct header { cell value; + /* Default ctor to make gcc 3.x happy */ + header() { abort(); } + header(cell value_) : value(value_ << TAG_BITS) {} void check_header() { diff --git a/vm/master.hpp b/vm/master.hpp old mode 100644 new mode 100755 index 65d17fab4b..6409d65494 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -22,7 +22,15 @@ #include <sys/param.h> /* C++ headers */ -#include <tr1/unordered_map> +#if __GNUC__ == 4 + #include <tr1/unordered_map> + #define unordered_map std::tr1::unordered_map +#elif __GNUC__ == 3 + #include <boost/unordered_map.hpp> + #define unordered_map boost::unordered_map +#else + #error Factor requires GCC 3.x or later +#endif /* Factor headers */ #include "layouts.hpp" diff --git a/vm/math.cpp b/vm/math.cpp old mode 100644 new mode 100755 index 37768f5542..7a2abe7463 --- a/vm/math.cpp +++ b/vm/math.cpp @@ -377,7 +377,7 @@ VM_C_API fixnum to_fixnum(cell tagged) return bignum_to_fixnum(untag<bignum>(tagged)); default: type_error(FIXNUM_TYPE,tagged); - return -1; /* can't happen */ + return 0; /* can't happen */ } } @@ -444,7 +444,7 @@ VM_C_API s64 to_signed_8(cell obj) return bignum_to_long_long(untag<bignum>(obj)); default: type_error(BIGNUM_TYPE,obj); - return -1; + return 0; } } @@ -466,7 +466,7 @@ VM_C_API u64 to_unsigned_8(cell obj) return bignum_to_ulong_long(untag<bignum>(obj)); default: type_error(BIGNUM_TYPE,obj); - return -1; + return 0; } } diff --git a/vm/os-windows-nt.cpp b/vm/os-windows-nt.cpp index f07fdaeb87..c4349f243b 100755 --- a/vm/os-windows-nt.cpp +++ b/vm/os-windows-nt.cpp @@ -11,7 +11,7 @@ s64 current_micros() - EPOCH_OFFSET) / 10; } -long exception_handler(PEXCEPTION_POINTERS pe) +FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe) { PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord; CONTEXT *c = (CONTEXT*)pe->ContextRecord; @@ -43,10 +43,10 @@ long exception_handler(PEXCEPTION_POINTERS pe) void c_to_factor_toplevel(cell quot) { - if(!AddVectoredExceptionHandler(0, exception_handler)) + if(!AddVectoredExceptionHandler(0, (PVECTORED_EXCEPTION_HANDLER)exception_handler)) fatal_error("AddVectoredExceptionHandler failed", 0); c_to_factor(quot); - RemoveVectoredExceptionHandler((void*)exception_handler); + RemoveVectoredExceptionHandler((void *)exception_handler); } void open_console() diff --git a/vm/os-windows-nt.hpp b/vm/os-windows-nt.hpp index 551a798b45..4371771c13 100755 --- a/vm/os-windows-nt.hpp +++ b/vm/os-windows-nt.hpp @@ -17,8 +17,10 @@ typedef char symbol_char; #define FACTOR_DLL L"factor.dll" #define FACTOR_DLL_NAME "factor.dll" +#define FACTOR_STDCALL __attribute__((stdcall)) + void c_to_factor_toplevel(cell quot); -long exception_handler(PEXCEPTION_POINTERS pe); +FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe); void open_console(); } diff --git a/vm/os-windows.cpp b/vm/os-windows.cpp index bd87c96155..7db19ff560 100755 --- a/vm/os-windows.cpp +++ b/vm/os-windows.cpp @@ -94,7 +94,6 @@ const vm_char *vm_executable_path() PRIMITIVE(existsp) { vm_char *path = untag_check<byte_array>(dpop())->data<vm_char>(); - wprintf(L"existsp: path is %s\n",path); box_boolean(windows_stat(path)); }