fix: stdio and typo

This commit is contained in:
Haolan
2025-09-08 14:13:25 +08:00
parent 7ca8abc788
commit d9a20e8000
7 changed files with 17 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
//go:build !baremetal
package unix
import (

View File

@@ -4,6 +4,12 @@ package runtime
import c "github.com/goplus/llgo/runtime/internal/clite"
var (
printFormatPrefixInt = c.Str("%ld")
printFormatPrefixUInt = c.Str("%lu")
printFormatPrefixHex = c.Str("%lx")
)
// Rethrow rethrows a panic.
func Rethrow(link *Defer) {
// in baremetal environment, we cannot get debug data from pthread_getspecific

View File

@@ -8,6 +8,12 @@ import (
"github.com/goplus/llgo/runtime/internal/clite/pthread"
)
var (
printFormatPrefixInt = c.Str("%lld")
printFormatPrefixUInt = c.Str("%llu")
printFormatPrefixHex = c.Str("%llx")
)
// Rethrow rethrows a panic.
func Rethrow(link *Defer) {
if ptr := excepKey.Get(); ptr != nil {

View File

@@ -70,15 +70,15 @@ func PrintComplex(v complex128) {
}
func PrintUint(v uint64) {
c.Fprintf(c.Stderr, c.Str("%llu"), v)
c.Fprintf(c.Stderr, printFormatPrefixUInt, v)
}
func PrintInt(v int64) {
c.Fprintf(c.Stderr, c.Str("%lld"), v)
c.Fprintf(c.Stderr, printFormatPrefixInt, v)
}
func PrintHex(v uint64) {
c.Fprintf(c.Stderr, c.Str("%llx"), v)
c.Fprintf(c.Stderr, printFormatPrefixHex, v)
}
func PrintPointer(p unsafe.Pointer) {