tcc: support tcc on Windows
parent
c874a22b3b
commit
5f21b152a7
|
@ -61,6 +61,7 @@ fns.txt
|
||||||
cachegrind.out.*
|
cachegrind.out.*
|
||||||
.gdb_history
|
.gdb_history
|
||||||
*.dSYM
|
*.dSYM
|
||||||
|
*.def
|
||||||
|
|
||||||
# ignore system files
|
# ignore system files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -71,6 +71,9 @@ fn print_backtrace_skipping_top_frames(skipframes int) bool {
|
||||||
$if msvc {
|
$if msvc {
|
||||||
return print_backtrace_skipping_top_frames_msvc(skipframes)
|
return print_backtrace_skipping_top_frames_msvc(skipframes)
|
||||||
}
|
}
|
||||||
|
$if tinyc {
|
||||||
|
return print_backtrace_skipping_top_frames_tcc(skipframes)
|
||||||
|
}
|
||||||
$if mingw {
|
$if mingw {
|
||||||
return print_backtrace_skipping_top_frames_mingw(skipframes)
|
return print_backtrace_skipping_top_frames_mingw(skipframes)
|
||||||
}
|
}
|
||||||
|
@ -141,6 +144,16 @@ fn print_backtrace_skipping_top_frames_mingw(skipframes int) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn C.tcc_backtrace(fmt charptr, other ...charptr) int
|
||||||
|
fn print_backtrace_skipping_top_frames_tcc(skipframes int) bool {
|
||||||
|
$if tinyc {
|
||||||
|
C.tcc_backtrace("Backtrace")
|
||||||
|
return false
|
||||||
|
} $else {
|
||||||
|
eprintln('print_backtrace_skipping_top_frames_tcc must be called only when the compiler is tcc')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO copypaste from os
|
//TODO copypaste from os
|
||||||
// we want to be able to use this here without having to `import os`
|
// we want to be able to use this here without having to `import os`
|
||||||
|
@ -198,7 +211,14 @@ fn C.IsDebuggerPresent() bool
|
||||||
fn C.__debugbreak()
|
fn C.__debugbreak()
|
||||||
|
|
||||||
fn break_if_debugger_attached() {
|
fn break_if_debugger_attached() {
|
||||||
|
$if tinyc {
|
||||||
|
unsafe {
|
||||||
|
ptr := &voidptr(0)
|
||||||
|
*ptr = 0
|
||||||
|
}
|
||||||
|
} $else {
|
||||||
if C.IsDebuggerPresent() {
|
if C.IsDebuggerPresent() {
|
||||||
C.__debugbreak()
|
C.__debugbreak()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
module time
|
module time
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sysinfoapi.h>
|
// #include <sysinfoapi.h>
|
||||||
|
|
||||||
struct C.tm {
|
struct C.tm {
|
||||||
tm_year int
|
tm_year int
|
||||||
|
|
|
@ -44,7 +44,7 @@ const (
|
||||||
#define __IRQHANDLER
|
#define __IRQHANDLER
|
||||||
#undef TCCSKIP
|
#undef TCCSKIP
|
||||||
#define TCCSKIP(x)
|
#define TCCSKIP(x)
|
||||||
#include <byteswap.h>
|
// #include <byteswap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for __offset_of
|
// for __offset_of
|
||||||
|
|
Loading…
Reference in New Issue