Update dependencies and build to go1.22 (#2113)
* Update dependencies and build to go1.22 * Fix api changes wrt to dependencies * Update golangci config
This commit is contained in:
75
vendor/modernc.org/libc/printf.go
generated
vendored
75
vendor/modernc.org/libc/printf.go
generated
vendored
@@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !(linux && (amd64 || loong64))
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
import (
|
||||
@@ -38,17 +40,17 @@ const (
|
||||
// the output stream; and conversion specifications, each of which results in
|
||||
// fetching zero or more subsequent arguments.
|
||||
func printf(format, args uintptr) []byte {
|
||||
format0 := format
|
||||
args0 := args
|
||||
// format0 := format
|
||||
// args0 := args
|
||||
buf := bytes.NewBuffer(nil)
|
||||
for {
|
||||
switch c := *(*byte)(unsafe.Pointer(format)); c {
|
||||
case '%':
|
||||
format = printfConversion(buf, format, &args)
|
||||
case 0:
|
||||
if dmesgs {
|
||||
dmesg("%v: %q, %#x -> %q", origin(1), GoString(format0), args0, buf.Bytes())
|
||||
}
|
||||
// if dmesgs {
|
||||
// dmesg("%v: %q, %#x -> %q", origin(1), GoString(format0), args0, buf.Bytes())
|
||||
// }
|
||||
return buf.Bytes()
|
||||
default:
|
||||
format++
|
||||
@@ -114,7 +116,7 @@ flags:
|
||||
break flags
|
||||
}
|
||||
}
|
||||
format, width, hasWidth := parseFieldWidth(format)
|
||||
format, width, hasWidth := parseFieldWidth(format, args)
|
||||
if hasWidth {
|
||||
spec += strconv.Itoa(width)
|
||||
}
|
||||
@@ -141,7 +143,7 @@ more:
|
||||
mod = modNone
|
||||
}
|
||||
switch mod {
|
||||
case modL, modLL, mod64:
|
||||
case modL, modLL, mod64, modJ:
|
||||
arg = VaInt64(args)
|
||||
case modH:
|
||||
arg = int64(int16(VaInt32(args)))
|
||||
@@ -149,6 +151,8 @@ more:
|
||||
arg = int64(int8(VaInt32(args)))
|
||||
case mod32, modNone:
|
||||
arg = int64(VaInt32(args))
|
||||
case modT:
|
||||
arg = int64(VaInt64(args))
|
||||
default:
|
||||
panic(todo("", mod))
|
||||
}
|
||||
@@ -185,6 +189,8 @@ more:
|
||||
arg = uint64(uint8(VaInt32(args)))
|
||||
case mod32:
|
||||
arg = uint64(VaInt32(args))
|
||||
case modZ:
|
||||
arg = uint64(VaInt64(args))
|
||||
default:
|
||||
panic(todo("", mod))
|
||||
}
|
||||
@@ -235,6 +241,38 @@ more:
|
||||
|
||||
f := spec + "o"
|
||||
str = fmt.Sprintf(f, arg)
|
||||
case 'b':
|
||||
// Base 2.
|
||||
format++
|
||||
var arg uint64
|
||||
if isWindows && mod == modL {
|
||||
mod = modNone
|
||||
}
|
||||
switch mod {
|
||||
case modNone:
|
||||
arg = uint64(VaUint32(args))
|
||||
case modL, modLL, mod64:
|
||||
arg = VaUint64(args)
|
||||
case modH:
|
||||
arg = uint64(uint16(VaInt32(args)))
|
||||
case modHH:
|
||||
arg = uint64(uint8(VaInt32(args)))
|
||||
case mod32:
|
||||
arg = uint64(VaInt32(args))
|
||||
default:
|
||||
panic(todo("", mod))
|
||||
}
|
||||
|
||||
if arg == 0 && hasPrecision && prec == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
if hasPrecision {
|
||||
panic(todo("", prec))
|
||||
}
|
||||
|
||||
f := spec + "b"
|
||||
str = fmt.Sprintf(f, arg)
|
||||
case 'I':
|
||||
if !isWindows {
|
||||
panic(todo("%#U", c))
|
||||
@@ -470,7 +508,7 @@ more:
|
||||
// nonexistent or small field width cause truncation of a field; if the result
|
||||
// of a conversion is wider than the field width, the field is expanded to
|
||||
// contain the conversion result.
|
||||
func parseFieldWidth(format uintptr) (_ uintptr, n int, ok bool) {
|
||||
func parseFieldWidth(format uintptr, args *uintptr) (_ uintptr, n int, ok bool) {
|
||||
first := true
|
||||
for {
|
||||
var digit int
|
||||
@@ -478,7 +516,13 @@ func parseFieldWidth(format uintptr) (_ uintptr, n int, ok bool) {
|
||||
case first && c == '0':
|
||||
return format, n, ok
|
||||
case first && c == '*':
|
||||
panic(todo(""))
|
||||
format++
|
||||
switch c := *(*byte)(unsafe.Pointer(format)); {
|
||||
case c >= '0' && c <= '9':
|
||||
panic(todo(""))
|
||||
default:
|
||||
return format, int(VaInt32(args)), true
|
||||
}
|
||||
case c >= '0' && c <= '9':
|
||||
format++
|
||||
ok = true
|
||||
@@ -609,13 +653,18 @@ func parseLengthModifier(format uintptr) (_ uintptr, n int) {
|
||||
n = modLD
|
||||
return format, n
|
||||
case 'j':
|
||||
panic(todo(""))
|
||||
format++
|
||||
n = modJ
|
||||
return format, n
|
||||
case 'z':
|
||||
panic(todo(""))
|
||||
format++
|
||||
return format, modZ
|
||||
case 'Z':
|
||||
panic(todo(""))
|
||||
format++
|
||||
return format, modCapitalZ
|
||||
case 't':
|
||||
panic(todo(""))
|
||||
format++
|
||||
return format, modT
|
||||
default:
|
||||
return format, 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user