mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
all: change //go:export to //export
This is the kind that is used in Go (actually CGo) for exporting functions. I think it's best to use //export instead of our custom //go:export pragma, for consistency (they are equivalent in TinyGo). Therefore I've updated all instances to the standard format (except for two that are updated in https://github.com/tinygo-org/tinygo/pull/1024). No smoke tests changed (when comparing the output hash), except for some wasm tests that include DWARF debug info and tend to be flaky anyway.
This commit is contained in:
@@ -14,7 +14,7 @@ const TargetBits = 32
|
||||
//go:extern __heap_base
|
||||
var heapStartSymbol [0]byte
|
||||
|
||||
//go:export llvm.wasm.memory.size.i32
|
||||
//export llvm.wasm.memory.size.i32
|
||||
func wasm_memory_size(index int32) int32
|
||||
|
||||
var (
|
||||
|
||||
+6
-6
@@ -63,7 +63,7 @@ func math_Ceil(x float64) float64 {
|
||||
return math_ceil(x)
|
||||
}
|
||||
|
||||
//go:export llvm.ceil.f64
|
||||
//export llvm.ceil.f64
|
||||
func llvm_ceil(x float64) float64
|
||||
|
||||
//go:linkname math_ceil math.ceil
|
||||
@@ -119,7 +119,7 @@ func math_Floor(x float64) float64 {
|
||||
return math_floor(x)
|
||||
}
|
||||
|
||||
//go:export llvm.floor.f64
|
||||
//export llvm.floor.f64
|
||||
func llvm_floor(x float64) float64
|
||||
|
||||
//go:linkname math_floor math.floor
|
||||
@@ -175,7 +175,7 @@ func math_Max(x, y float64) float64 {
|
||||
return math_max(x, y)
|
||||
}
|
||||
|
||||
//go:export llvm.maximum.f64
|
||||
//export llvm.maximum.f64
|
||||
func llvm_maximum(x, y float64) float64
|
||||
|
||||
//go:linkname math_max math.max
|
||||
@@ -189,7 +189,7 @@ func math_Min(x, y float64) float64 {
|
||||
return math_min(x, y)
|
||||
}
|
||||
|
||||
//go:export llvm.minimum.f64
|
||||
//export llvm.minimum.f64
|
||||
func llvm_minimum(x, y float64) float64
|
||||
|
||||
//go:linkname math_min math.min
|
||||
@@ -239,7 +239,7 @@ func math_Sqrt(x float64) float64 {
|
||||
return math_sqrt(x)
|
||||
}
|
||||
|
||||
//go:export llvm.sqrt.f64
|
||||
//export llvm.sqrt.f64
|
||||
func llvm_sqrt(x float64) float64
|
||||
|
||||
//go:linkname math_sqrt math.sqrt
|
||||
@@ -265,7 +265,7 @@ func math_Trunc(x float64) float64 {
|
||||
return math_trunc(x)
|
||||
}
|
||||
|
||||
//go:export llvm.trunc.f64
|
||||
//export llvm.trunc.f64
|
||||
func llvm_trunc(x float64) float64
|
||||
|
||||
//go:linkname math_trunc math.trunc
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime
|
||||
|
||||
// trap is a compiler hint that this function cannot be executed. It is
|
||||
// translated into either a trap instruction or a call to abort().
|
||||
//go:export llvm.trap
|
||||
//export llvm.trap
|
||||
func trap()
|
||||
|
||||
// Builtin function panic(msg), used as a compiler intrinsic.
|
||||
|
||||
@@ -33,7 +33,7 @@ var _edata [0]byte
|
||||
func postinit() {}
|
||||
|
||||
// Entry point for Go. Initialize all packages and call main.main().
|
||||
//go:export main
|
||||
//export main
|
||||
func main() {
|
||||
// Initialize .data and .bss sections.
|
||||
preinit()
|
||||
|
||||
@@ -15,7 +15,7 @@ type timeUnit int64
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export Reset_Handler
|
||||
//export Reset_Handler
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -14,7 +14,7 @@ type timeUnit int64
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export Reset_Handler
|
||||
//export Reset_Handler
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -36,7 +36,7 @@ var _sbss [0]byte
|
||||
//go:extern _ebss
|
||||
var _ebss [0]byte
|
||||
|
||||
//go:export main
|
||||
//export main
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -74,7 +74,7 @@ type interruptStack struct {
|
||||
// For details, see:
|
||||
// https://community.arm.com/developer/ip-products/system/f/embedded-forum/3257/debugging-a-cortex-m0-hard-fault
|
||||
// https://blog.feabhas.com/2013/02/developing-a-generic-hard-fault-handler-for-arm-cortex-m3cortex-m4/
|
||||
//go:export handleHardFault
|
||||
//export handleHardFault
|
||||
func handleHardFault(sp *interruptStack) {
|
||||
print("fatal error: ")
|
||||
if uintptr(unsafe.Pointer(sp)) < 0x20000000 {
|
||||
|
||||
@@ -19,7 +19,7 @@ var timestamp timeUnit
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export Reset_Handler
|
||||
//export Reset_Handler
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -18,7 +18,7 @@ type timeUnit int64
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export main
|
||||
//export main
|
||||
func main() {
|
||||
// Zero the PLIC enable bits on startup: they are not zeroed at reset.
|
||||
sifive.PLIC.ENABLE[0].Set(0)
|
||||
|
||||
@@ -19,7 +19,7 @@ func systemInit()
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export Reset_Handler
|
||||
//export Reset_Handler
|
||||
func main() {
|
||||
systemInit()
|
||||
preinit()
|
||||
|
||||
@@ -6,7 +6,7 @@ type timeUnit int64
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export Reset_Handler
|
||||
//export Reset_Handler
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -19,7 +19,7 @@ var timestamp timeUnit
|
||||
|
||||
func postinit() {}
|
||||
|
||||
//go:export main
|
||||
//export main
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
@@ -6,22 +6,22 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//go:export putchar
|
||||
//export putchar
|
||||
func _putchar(c int) int
|
||||
|
||||
//go:export usleep
|
||||
//export usleep
|
||||
func usleep(usec uint) int
|
||||
|
||||
//go:export malloc
|
||||
//export malloc
|
||||
func malloc(size uintptr) unsafe.Pointer
|
||||
|
||||
//go:export abort
|
||||
//export abort
|
||||
func abort()
|
||||
|
||||
//go:export exit
|
||||
//export exit
|
||||
func exit(code int)
|
||||
|
||||
//go:export clock_gettime
|
||||
//export clock_gettime
|
||||
func clock_gettime(clk_id int32, ts *timespec)
|
||||
|
||||
type timeUnit int64
|
||||
@@ -41,7 +41,7 @@ const CLOCK_MONOTONIC_RAW = 4
|
||||
func postinit() {}
|
||||
|
||||
// Entry point for Go. Initialize all packages and call main.main().
|
||||
//go:export main
|
||||
//export main
|
||||
func main() int {
|
||||
preinit()
|
||||
|
||||
@@ -83,5 +83,5 @@ func extalloc(size uintptr) unsafe.Pointer {
|
||||
return malloc(size)
|
||||
}
|
||||
|
||||
//go:export free
|
||||
//export free
|
||||
func extfree(ptr unsafe.Pointer)
|
||||
|
||||
@@ -53,14 +53,14 @@ func setEventHandler(fn func()) {
|
||||
handleEvent = fn
|
||||
}
|
||||
|
||||
//go:export resume
|
||||
//export resume
|
||||
func resume() {
|
||||
go func() {
|
||||
handleEvent()
|
||||
}()
|
||||
}
|
||||
|
||||
//go:export go_scheduler
|
||||
//export go_scheduler
|
||||
func go_scheduler() {
|
||||
scheduler()
|
||||
}
|
||||
@@ -69,10 +69,10 @@ const asyncScheduler = true
|
||||
|
||||
// This function is called by the scheduler.
|
||||
// Schedule a call to runtime.scheduler, do not actually sleep.
|
||||
//go:export runtime.sleepTicks
|
||||
//export runtime.sleepTicks
|
||||
func sleepTicks(d timeUnit)
|
||||
|
||||
//go:export runtime.ticks
|
||||
//export runtime.ticks
|
||||
func ticks() timeUnit
|
||||
|
||||
// Abort executes the wasm 'unreachable' instruction.
|
||||
|
||||
Reference in New Issue
Block a user