chore(deps): Update sqlite dependencies
This commit is contained in:
1
vendor/modernc.org/cc/v3/CONTRIBUTORS
generated
vendored
1
vendor/modernc.org/cc/v3/CONTRIBUTORS
generated
vendored
@ -16,3 +16,4 @@ Steffen Butzer <steffen(dot)butzer@outlook.com>
|
||||
Tommi Virtanen <tv@eagain.net>
|
||||
Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
Zvi Effron <zeffron@cs.hmc.edu>
|
||||
Lucas Raab <tuftedocelot@fastmail.fm>
|
||||
|
14
vendor/modernc.org/cc/v3/Makefile
generated
vendored
14
vendor/modernc.org/cc/v3/Makefile
generated
vendored
@ -61,12 +61,26 @@ test_windows386:
|
||||
build_all_targets:
|
||||
GOOS=darwin GOARCH=amd64 go build -v ./...
|
||||
GOOS=darwin GOARCH=arm64 go build -v ./...
|
||||
GOOS=freebsd GOARCH=386 go build -v ./...
|
||||
GOOS=freebsd GOARCH=amd64 go build -v ./...
|
||||
GOOS=freebsd GOARCH=arm go build -v ./...
|
||||
GOOS=freebsd GOARCH=arm64 go build -v ./...
|
||||
GOOS=linux GOARCH=386 go build -v ./...
|
||||
GOOS=linux GOARCH=amd64 go build -v ./...
|
||||
GOOS=linux GOARCH=arm go build -v ./...
|
||||
GOOS=linux GOARCH=arm64 go build -v ./...
|
||||
GOOS=linux GOARCH=ppc64le go build -v ./...
|
||||
GOOS=linux GOARCH=riscv64 go build -v ./...
|
||||
GOOS=linux GOARCH=s390x go build -v ./...
|
||||
GOOS=netbsd GOARCH=amd64 go build -v ./...
|
||||
GOOS=netbsd GOARCH=arm go build -v ./...
|
||||
GOOS=netbsd GOARCH=386 go build -v ./...
|
||||
GOOS=openbsd GOARCH=amd64 go build -v ./...
|
||||
GOOS=openbsd GOARCH=arm64 go build -v ./...
|
||||
GOOS=openbsd GOARCH=386 go build -v ./...
|
||||
GOOS=windows GOARCH=386 go build -v ./...
|
||||
GOOS=windows GOARCH=amd64 go build -v ./...
|
||||
GOOS=windows GOARCH=arm64 go build -v ./...
|
||||
|
||||
devbench:
|
||||
date 2>&1 | tee log-devbench
|
||||
|
8
vendor/modernc.org/cc/v3/abi.go
generated
vendored
8
vendor/modernc.org/cc/v3/abi.go
generated
vendored
@ -395,8 +395,12 @@ func (a *ABI) layout(ctx *context, n Node, t *structType) *structType {
|
||||
group += f.bitFieldWidth
|
||||
default:
|
||||
if n := group % 64; n != 0 {
|
||||
group -= n
|
||||
off += int64(normalizeBitFieldWidth(group) - group)
|
||||
if ctx.cfg.FixBitfieldPadding {
|
||||
off += int64(normalizeBitFieldWidth(group-n) - group)
|
||||
} else {
|
||||
group -= n
|
||||
off += int64(normalizeBitFieldWidth(group) - group)
|
||||
}
|
||||
}
|
||||
off0 := off
|
||||
off = roundup(off, 8*int64(al))
|
||||
|
352
vendor/modernc.org/cc/v3/abi_platforms.go
generated
vendored
352
vendor/modernc.org/cc/v3/abi_platforms.go
generated
vendored
@ -5,27 +5,39 @@ import "encoding/binary"
|
||||
// abiByteOrders contains byte order information for known architectures.
|
||||
var (
|
||||
abiByteOrders = map[string]binary.ByteOrder{
|
||||
"amd64": binary.LittleEndian,
|
||||
"386": binary.LittleEndian,
|
||||
"arm": binary.LittleEndian,
|
||||
"arm64": binary.LittleEndian,
|
||||
"s390x": binary.BigEndian,
|
||||
"386": binary.LittleEndian,
|
||||
"amd64": binary.LittleEndian,
|
||||
"arm": binary.LittleEndian,
|
||||
"arm64": binary.LittleEndian,
|
||||
"ppc64le": binary.LittleEndian,
|
||||
"riscv64": binary.LittleEndian,
|
||||
"s390x": binary.BigEndian,
|
||||
}
|
||||
|
||||
abiSignedChar = map[[2]string]bool{
|
||||
{"linux", "arm"}: false,
|
||||
{"linux", "arm64"}: false,
|
||||
{"linux", "s390x"}: false,
|
||||
{"freebsd", "arm"}: false,
|
||||
{"freebsd", "arm64"}: false,
|
||||
{"linux", "arm"}: false,
|
||||
{"linux", "arm64"}: false,
|
||||
{"linux", "ppc64le"}: false,
|
||||
{"linux", "riscv64"}: false,
|
||||
{"linux", "s390x"}: false,
|
||||
{"netbsd", "arm"}: false,
|
||||
|
||||
{"darwin", "amd64"}: true,
|
||||
{"darwin", "arm64"}: true,
|
||||
{"freebsd", "386"}: true,
|
||||
{"freebsd", "amd64"}: true,
|
||||
{"linux", "386"}: true,
|
||||
{"linux", "amd64"}: true,
|
||||
{"netbsd", "386"}: true,
|
||||
{"netbsd", "amd64"}: true,
|
||||
{"openbsd", "386"}: true,
|
||||
{"openbsd", "amd64"}: true,
|
||||
{"openbsd", "arm64"}: true,
|
||||
{"windows", "386"}: true,
|
||||
{"windows", "amd64"}: true,
|
||||
{"windows", "arm64"}: true,
|
||||
}
|
||||
)
|
||||
|
||||
@ -210,6 +222,29 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
|
||||
Decimal64: {8, 8, 8},
|
||||
Decimal128: {16, 16, 16},
|
||||
},
|
||||
// clang version 14.0.0 (https://github.com/llvm/llvm-project.git 329fda39c507e8740978d10458451dcdb21563be)
|
||||
// Target: aarch64-w64-windows-gnu
|
||||
{"windows", "arm64"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {8, 8, 8},
|
||||
Function: {8, 8, 8},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {8, 8, 8},
|
||||
},
|
||||
// $ i686-w64-mingw32-gcc main.c && wine a.exe
|
||||
{"windows", "386"}: {
|
||||
Void: {1, 1, 1},
|
||||
@ -382,6 +417,103 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
},
|
||||
// gcc (FreeBSD Ports Collection) 11.3.0
|
||||
{"freebsd", "arm64"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {8, 8, 8},
|
||||
ULong: {8, 8, 8},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {8, 8, 8},
|
||||
Function: {8, 8, 8},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {16, 16, 16},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
},
|
||||
// gcc (FreeBSD Ports Collection) 10.3.0
|
||||
{"freebsd", "386"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 4, 4},
|
||||
ULongLong: {8, 4, 4},
|
||||
Ptr: {4, 4, 4},
|
||||
Function: {4, 4, 4},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 4, 4},
|
||||
LongDouble: {12, 4, 4},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 4, 4},
|
||||
UInt64: {8, 4, 4},
|
||||
Float32: {4, 4, 4},
|
||||
Float32x: {8, 4, 4},
|
||||
Float64: {8, 4, 4},
|
||||
Float64x: {16, 16, 16},
|
||||
Float128: {16, 16, 16},
|
||||
},
|
||||
// gcc (FreeBSD Ports Collection) 11.3.0
|
||||
{"freebsd", "arm"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {4, 4, 4},
|
||||
Function: {4, 4, 4},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {8, 8, 8},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
},
|
||||
// gcc (GCC) 8.4.0
|
||||
{"openbsd", "amd64"}: {
|
||||
Void: {1, 1, 1},
|
||||
@ -419,6 +551,68 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
|
||||
Float64x: {16, 16, 16},
|
||||
Float128: {16, 16, 16},
|
||||
},
|
||||
// OpenBSD clang version 13.0.0
|
||||
{"openbsd", "arm64"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {8, 8, 8},
|
||||
ULong: {8, 8, 8},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {8, 8, 8},
|
||||
Function: {8, 8, 8},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {16, 16, 16},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
},
|
||||
// OpenBSD clang version 13.0.0
|
||||
{"openbsd", "386"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 4, 4},
|
||||
ULongLong: {8, 4, 4},
|
||||
Ptr: {4, 4, 4},
|
||||
Function: {4, 4, 4},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 4, 4},
|
||||
LongDouble: {12, 4, 4},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 4, 4},
|
||||
UInt64: {8, 4, 4},
|
||||
},
|
||||
// gcc (GCC) 10.3.0
|
||||
{"netbsd", "amd64"}: {
|
||||
Void: {1, 1, 1},
|
||||
@ -451,4 +645,146 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
},
|
||||
// gcc (nb4 20200810) 7.5.0
|
||||
{"netbsd", "arm"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {4, 4, 4},
|
||||
Function: {4, 4, 4},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {8, 8, 8},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
},
|
||||
// gcc (nb4 20200810) 7.5.0
|
||||
{"netbsd", "386"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {4, 4, 4},
|
||||
ULong: {4, 4, 4},
|
||||
LongLong: {8, 4, 4},
|
||||
ULongLong: {8, 4, 4},
|
||||
Ptr: {4, 4, 4},
|
||||
Function: {4, 4, 4},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 4, 4},
|
||||
LongDouble: {12, 4, 4},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 4, 4},
|
||||
UInt64: {8, 4, 4},
|
||||
Float32: {4, 4, 4},
|
||||
Float32x: {8, 4, 4},
|
||||
Float64: {8, 4, 4},
|
||||
Float64x: {12, 4, 4},
|
||||
Float128: {16, 16, 16},
|
||||
},
|
||||
// gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
|
||||
{"linux", "riscv64"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {8, 8, 8},
|
||||
ULong: {8, 8, 8},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {8, 8, 8},
|
||||
Function: {8, 8, 8},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {16, 16, 16},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
Float32: {4, 4, 4},
|
||||
Float32x: {8, 8, 8},
|
||||
Float64: {8, 8, 8},
|
||||
Float64x: {16, 16, 16},
|
||||
Float128: {16, 16, 16},
|
||||
},
|
||||
// gcc (Debian 10.2.1-6) 10.2.1 20210110
|
||||
{"linux", "ppc64le"}: {
|
||||
Void: {1, 1, 1},
|
||||
Bool: {1, 1, 1},
|
||||
Char: {1, 1, 1},
|
||||
SChar: {1, 1, 1},
|
||||
UChar: {1, 1, 1},
|
||||
Short: {2, 2, 2},
|
||||
UShort: {2, 2, 2},
|
||||
Enum: {4, 4, 4},
|
||||
Int: {4, 4, 4},
|
||||
UInt: {4, 4, 4},
|
||||
Long: {8, 8, 8},
|
||||
ULong: {8, 8, 8},
|
||||
LongLong: {8, 8, 8},
|
||||
ULongLong: {8, 8, 8},
|
||||
Ptr: {8, 8, 8},
|
||||
Function: {8, 8, 8},
|
||||
Float: {4, 4, 4},
|
||||
Double: {8, 8, 8},
|
||||
LongDouble: {16, 16, 16},
|
||||
Int8: {1, 1, 1},
|
||||
UInt8: {1, 1, 1},
|
||||
Int16: {2, 2, 2},
|
||||
UInt16: {2, 2, 2},
|
||||
Int32: {4, 4, 4},
|
||||
UInt32: {4, 4, 4},
|
||||
Int64: {8, 8, 8},
|
||||
UInt64: {8, 8, 8},
|
||||
Int128: {16, 16, 16},
|
||||
UInt128: {16, 16, 16},
|
||||
Float32: {4, 4, 4},
|
||||
Float32x: {8, 8, 8},
|
||||
Float64: {8, 8, 8},
|
||||
Float64x: {16, 16, 16},
|
||||
Float128: {16, 16, 16},
|
||||
Decimal32: {4, 4, 4},
|
||||
Decimal64: {8, 8, 8},
|
||||
Decimal128: {16, 16, 16},
|
||||
},
|
||||
}
|
||||
|
8
vendor/modernc.org/cc/v3/ast.go
generated
vendored
8
vendor/modernc.org/cc/v3/ast.go
generated
vendored
@ -670,6 +670,7 @@ func (n *AssignmentExpression) Position() (r token.Position) {
|
||||
// AtomicTypeSpecifier:
|
||||
// "_Atomic" '(' TypeName ')'
|
||||
type AtomicTypeSpecifier struct {
|
||||
list []*TypeSpecifier
|
||||
Token Token
|
||||
Token2 Token
|
||||
Token3 Token
|
||||
@ -1339,6 +1340,7 @@ type Declarator struct {
|
||||
called bool
|
||||
fnDef bool
|
||||
hasInitializer bool
|
||||
implicit bool
|
||||
AttributeSpecifierList *AttributeSpecifierList
|
||||
DirectDeclarator *DirectDeclarator
|
||||
Pointer *Pointer
|
||||
@ -3525,6 +3527,7 @@ type PointerCase int
|
||||
const (
|
||||
PointerTypeQual PointerCase = iota
|
||||
PointerPtr
|
||||
PointerBlock
|
||||
)
|
||||
|
||||
// String implements fmt.Stringer
|
||||
@ -3534,6 +3537,8 @@ func (n PointerCase) String() string {
|
||||
return "PointerTypeQual"
|
||||
case PointerPtr:
|
||||
return "PointerPtr"
|
||||
case PointerBlock:
|
||||
return "PointerBlock"
|
||||
default:
|
||||
return fmt.Sprintf("PointerCase(%v)", int(n))
|
||||
}
|
||||
@ -3544,6 +3549,7 @@ func (n PointerCase) String() string {
|
||||
// Pointer:
|
||||
// '*' TypeQualifiers // Case PointerTypeQual
|
||||
// | '*' TypeQualifiers Pointer // Case PointerPtr
|
||||
// | '^' TypeQualifiers // Case PointerBlock
|
||||
type Pointer struct {
|
||||
typeQualifiers *typeBase
|
||||
Case PointerCase `PrettyPrint:"stringer,zero"`
|
||||
@ -3562,7 +3568,7 @@ func (n *Pointer) Position() (r token.Position) {
|
||||
}
|
||||
|
||||
switch n.Case {
|
||||
case 0:
|
||||
case 0, 2:
|
||||
if p := n.Token.Position(); p.IsValid() {
|
||||
return p
|
||||
}
|
||||
|
18
vendor/modernc.org/cc/v3/ast2.go
generated
vendored
18
vendor/modernc.org/cc/v3/ast2.go
generated
vendored
@ -603,7 +603,11 @@ func (n *BlockItem) Closure() map[StringID]struct{} { return n.closure }
|
||||
// FunctionDefinition returns the nested function (case BlockItemFuncDef).
|
||||
func (n *BlockItem) FunctionDefinition() *FunctionDefinition { return n.fn }
|
||||
|
||||
func (n *Declarator) IsStatic() bool { return n.td != nil && n.td.static() }
|
||||
func (n *Declarator) IsStatic() bool { return n.td != nil && n.td.static() }
|
||||
|
||||
// IsImplicit reports whether n was not declared nor defined, only inferred.
|
||||
func (n *Declarator) IsImplicit() bool { return n.implicit }
|
||||
|
||||
func (n *Declarator) isVisible(at int32) bool { return at == 0 || n.DirectDeclarator.ends() < at }
|
||||
|
||||
func (n *Declarator) setLHS(lhs *Declarator) {
|
||||
@ -803,7 +807,8 @@ func (n *AndExpression) Promote() Type { return n.promote }
|
||||
|
||||
func (n *InitDeclarator) Value() *InitializerValue { return n.initializer }
|
||||
|
||||
// FirstDesignatorField returns the first field a designator denotes, if any.
|
||||
// FirstDesignatorField returns the first field a designator of an union type
|
||||
// denotes, if any.
|
||||
func (n *Initializer) FirstDesignatorField() Field { return n.field0 }
|
||||
|
||||
// TrailingComma returns the comma token following n, if any.
|
||||
@ -907,6 +912,15 @@ func (n *EnumSpecifier) LexicalScope() Scope { return n.lexicalScope }
|
||||
// // TypeSpecifierTypedefName was resolved in, if any.
|
||||
// func (n *TypeSpecifier) ResolvedIn() Scope { return n.resolvedIn }
|
||||
|
||||
func (n *TypeSpecifier) list() (r []*TypeSpecifier) {
|
||||
switch n.Case {
|
||||
case TypeSpecifierAtomic:
|
||||
return n.AtomicTypeSpecifier.list
|
||||
default:
|
||||
return []*TypeSpecifier{n}
|
||||
}
|
||||
}
|
||||
|
||||
// // LexicalScope returns the lexical scope of n.
|
||||
// func (n *UnaryExpression) LexicalScope() Scope { return n.lexicalScope }
|
||||
|
||||
|
93
vendor/modernc.org/cc/v3/cc.go
generated
vendored
93
vendor/modernc.org/cc/v3/cc.go
generated
vendored
@ -509,14 +509,18 @@ type Config struct {
|
||||
|
||||
PragmaHandler func(Pragma, []Token) // Called on pragmas, other than #pragma STDC ..., if non nil
|
||||
|
||||
// SharedFunctionDefinitions collects function definitions having the
|
||||
// same position and definition. This can happen, for example, when a
|
||||
// function is defined in a header file included multiple times. Either
|
||||
// within a single translation unit or across translation units. In the
|
||||
// later case just supply the same SharedFunctionDefinitions in Config
|
||||
// when translating/parsing each translation unit.
|
||||
// SharedFunctionDefinitions collects function definitions having the same
|
||||
// position and definition. This can happen, for example, when a function is
|
||||
// defined in a header file included multiple times. Either within a single
|
||||
// translation unit or across translation units. In the later case just supply
|
||||
// the same SharedFunctionDefinitions in Config when translating/parsing each
|
||||
// translation unit.
|
||||
SharedFunctionDefinitions *SharedFunctionDefinitions
|
||||
|
||||
// IncludeFileHandler, when non nil, is called by the preprocessor for every
|
||||
// successfully included file.
|
||||
IncludeFileHandler func(pos gotoken.Position, includePath string)
|
||||
|
||||
MaxErrors int // 0: default (10), < 0: unlimited, n: n.
|
||||
|
||||
CheckExternInlineFnBodies bool // Translate will consider extern inline function bodies.
|
||||
@ -524,6 +528,7 @@ type Config struct {
|
||||
DebugWorkingDir bool // Output to stderr.
|
||||
DoNotTypecheckAsm bool
|
||||
EnableAssignmentCompatibilityChecking bool // No such checks performed up to v3.31.0. Currently only partially implemented.
|
||||
FixBitfieldPadding bool // Fix a bug in calculating field positions after a bitfield.
|
||||
InjectTracingCode bool // Output to stderr.
|
||||
LongDoubleIsDouble bool
|
||||
PreprocessOnly bool
|
||||
@ -788,6 +793,14 @@ func (c *context) openFile(name string, sys bool) (io.ReadCloser, error) {
|
||||
// Execution of HostConfig is not free, so caching of the results is
|
||||
// recommended.
|
||||
func HostConfig(cpp string, opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error) {
|
||||
if predefined, includePaths, sysIncludePaths, err = hostConfigv3(cpp, opts...); err == nil {
|
||||
return predefined, includePaths, sysIncludePaths, nil
|
||||
}
|
||||
|
||||
return hostConfigv4(opts)
|
||||
}
|
||||
|
||||
func hostConfigv3(cpp string, opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error) {
|
||||
if cpp == "" {
|
||||
cpp = "cpp"
|
||||
}
|
||||
@ -839,6 +852,74 @@ func HostConfig(cpp string, opts ...string) (predefined string, includePaths, sy
|
||||
return "", nil, nil, fmt.Errorf("failed parsing %s -v output", cpp)
|
||||
}
|
||||
|
||||
func hostConfigv4(opts []string) (predefined string, includePaths, sysIncludePaths []string, err error) {
|
||||
for _, cc := range []string{os.Getenv("CC"), "cc", "gcc"} {
|
||||
if cc == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
cc, err = exec.LookPath(cc)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
args := append(opts, "-dM", "-E", "-")
|
||||
pre, err := exec.Command(cc, args...).CombinedOutput()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
sep := "\n"
|
||||
if env("GOOS", runtime.GOOS) == "windows" {
|
||||
sep = "\r\n"
|
||||
}
|
||||
a := strings.Split(string(pre), sep)
|
||||
w := 0
|
||||
for _, v := range a {
|
||||
if strings.HasPrefix(v, "#") {
|
||||
a[w] = v
|
||||
w++
|
||||
}
|
||||
}
|
||||
predefined = strings.Join(a[:w], "\n")
|
||||
args = append(opts, "-v", "-E", "-")
|
||||
out, err := exec.Command(cc, args...).CombinedOutput()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
a = strings.Split(string(out), sep)
|
||||
for i := 0; i < len(a); {
|
||||
switch a[i] {
|
||||
case "#include \"...\" search starts here:":
|
||||
loop:
|
||||
for i = i + 1; i < len(a); {
|
||||
switch v := a[i]; {
|
||||
case strings.HasPrefix(v, "#") || v == "End of search list.":
|
||||
break loop
|
||||
default:
|
||||
includePaths = append(includePaths, strings.TrimSpace(v))
|
||||
i++
|
||||
}
|
||||
}
|
||||
case "#include <...> search starts here:":
|
||||
for i = i + 1; i < len(a); {
|
||||
switch v := a[i]; {
|
||||
case strings.HasPrefix(v, "#") || v == "End of search list.":
|
||||
return predefined, includePaths, sysIncludePaths, nil
|
||||
default:
|
||||
sysIncludePaths = append(sysIncludePaths, strings.TrimSpace(v))
|
||||
i++
|
||||
}
|
||||
}
|
||||
default:
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", nil, nil, fmt.Errorf("cannot determine C compiler configuration")
|
||||
}
|
||||
|
||||
func env(key, val string) string {
|
||||
if s := os.Getenv(key); s != "" {
|
||||
return s
|
||||
|
572
vendor/modernc.org/cc/v3/check.go
generated
vendored
572
vendor/modernc.org/cc/v3/check.go
generated
vendored
File diff suppressed because it is too large
Load Diff
231
vendor/modernc.org/cc/v3/cpp.go
generated
vendored
231
vendor/modernc.org/cc/v3/cpp.go
generated
vendored
@ -7,6 +7,7 @@ package cc // import "modernc.org/cc/v3"
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
gotoken "go/token"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -142,6 +143,15 @@ func cppToksStr(toks []cppToken, sep string) string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func cppToksStr2(toks [][]cppToken) string {
|
||||
panic(todo(""))
|
||||
var a []string
|
||||
for _, v := range toks {
|
||||
a = append(a, fmt.Sprintf("%q", cppToksStr(v, "|")))
|
||||
}
|
||||
return fmt.Sprint(a)
|
||||
}
|
||||
|
||||
type cppReader struct {
|
||||
buf []cppToken
|
||||
ungetBuf
|
||||
@ -266,6 +276,10 @@ func (m *Macro) param2(varArgs []cppToken, ap [][]cppToken, nm StringID, out *[]
|
||||
}
|
||||
|
||||
func (m *Macro) param(varArgs []cppToken, ap [][]cppToken, nm StringID, out *[]cppToken) bool {
|
||||
// trc("select (A) varArgs %q, ap %v, nm %q, out %q", cppToksStr(varArgs, "|"), cppToksStr2(ap), nm, cppToksStr(*out, "|"))
|
||||
// defer func() {
|
||||
// trc("select (A) varArgs %q, ap %v, nm %q, out %q", cppToksStr(varArgs, "|"), cppToksStr2(ap), nm, cppToksStr(*out, "|"))
|
||||
// }()
|
||||
return m.param2(varArgs, ap, nm, out, nil)
|
||||
}
|
||||
|
||||
@ -286,6 +300,7 @@ type cpp struct {
|
||||
macros map[StringID]*Macro
|
||||
out chan *[]token4
|
||||
outBuf *[]token4
|
||||
pragmaOpBuf []token4
|
||||
rq chan struct{}
|
||||
timeMacro Macro
|
||||
ungetBuf
|
||||
@ -295,6 +310,7 @@ type cpp struct {
|
||||
intmaxChecked bool
|
||||
nonFirstRead bool
|
||||
seenEOF bool
|
||||
inPragmaOp bool
|
||||
}
|
||||
|
||||
func newCPP(ctx *context) *cpp {
|
||||
@ -407,87 +423,72 @@ func (c *cpp) write(tok cppToken) {
|
||||
|
||||
//dbg("%T.write %q", c, tok)
|
||||
c.last = tok.char
|
||||
*c.outBuf = append(*c.outBuf, tok.token4)
|
||||
if tok.char == '\n' {
|
||||
for i, tok := range *c.outBuf {
|
||||
if tok.char != ' ' {
|
||||
if tok.char == IDENTIFIER && tok.value == idPragmaOp {
|
||||
toks := (*c.outBuf)[i:]
|
||||
b := token4Pool.Get().(*[]token4)
|
||||
*b = (*b)[:0]
|
||||
c.outBuf = b
|
||||
c.pragmaOp(toks)
|
||||
return
|
||||
}
|
||||
|
||||
switch {
|
||||
case c.inPragmaOp:
|
||||
out:
|
||||
switch tok.char {
|
||||
case ')':
|
||||
c.inPragmaOp = false
|
||||
b := c.pragmaOpBuf
|
||||
if len(b) == 0 || b[0].char != '(' {
|
||||
c.err(b[0], "expected (")
|
||||
break
|
||||
}
|
||||
}
|
||||
c.out <- c.outBuf
|
||||
b := token4Pool.Get().(*[]token4)
|
||||
*b = (*b)[:0]
|
||||
c.outBuf = b
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cpp) pragmaOp(toks []token4) {
|
||||
var a []string
|
||||
loop:
|
||||
for {
|
||||
tok := toks[0]
|
||||
toks = toks[1:] // Skip "_Pragma"
|
||||
toks = ltrim4(toks)
|
||||
if len(toks) == 0 || toks[0].char != '(' {
|
||||
c.err(tok, "expected (")
|
||||
break loop
|
||||
}
|
||||
var a []string
|
||||
for _, v := range b[1:] {
|
||||
if v.char != STRINGLITERAL {
|
||||
c.err(v, "expected string literal")
|
||||
break out
|
||||
}
|
||||
|
||||
tok = toks[0]
|
||||
toks = toks[1:] // Skip '('
|
||||
toks = ltrim4(toks)
|
||||
if len(toks) == 0 || (toks[0].char != STRINGLITERAL && toks[0].char != LONGSTRINGLITERAL) {
|
||||
c.err(toks[0], "expected string literal")
|
||||
break loop
|
||||
}
|
||||
a = append(a, v.String())
|
||||
}
|
||||
|
||||
tok = toks[0]
|
||||
a = append(a, tok.String())
|
||||
toks = toks[1:] // Skip string literal
|
||||
toks = ltrim4(toks)
|
||||
if len(toks) == 0 || toks[0].char != ')' {
|
||||
c.err(toks[0], "expected )")
|
||||
break loop
|
||||
}
|
||||
if len(a) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
toks = toks[1:] // Skip ')'
|
||||
toks = ltrim4(toks)
|
||||
if len(toks) == 0 {
|
||||
break loop
|
||||
}
|
||||
|
||||
switch tok := toks[0]; {
|
||||
case tok.char == '\n':
|
||||
break loop
|
||||
case tok.char == IDENTIFIER && tok.value == idPragmaOp:
|
||||
// ok
|
||||
for i, v := range a {
|
||||
// [0], 6.10.9, 1
|
||||
if v[0] == 'L' {
|
||||
v = v[1:]
|
||||
}
|
||||
v = v[1 : len(v)-1]
|
||||
v = strings.ReplaceAll(v, `\"`, `"`)
|
||||
a[i] = "#pragma " + strings.ReplaceAll(v, `\\`, `\`) + "\n"
|
||||
}
|
||||
src := strings.Join(a, "")
|
||||
s := newScanner0(c.ctx, strings.NewReader(src), tokenNewFile("", len(src)), 4096)
|
||||
if ppf := s.translationPhase3(); ppf != nil {
|
||||
ppf.translationPhase4(c)
|
||||
}
|
||||
default:
|
||||
c.err(tok, "expected new-line")
|
||||
break loop
|
||||
c.pragmaOpBuf = append(c.pragmaOpBuf, tok.token4)
|
||||
}
|
||||
}
|
||||
for i, v := range a {
|
||||
// [0], 6.10.9, 1
|
||||
if v[0] == 'L' {
|
||||
v = v[1:]
|
||||
default:
|
||||
switch {
|
||||
case tok.char == '\n':
|
||||
*c.outBuf = append(*c.outBuf, tok.token4)
|
||||
c.out <- c.outBuf
|
||||
b := token4Pool.Get().(*[]token4)
|
||||
*b = (*b)[:0]
|
||||
c.outBuf = b
|
||||
case tok.char == IDENTIFIER && tok.value == idPragmaOp:
|
||||
if len(*c.outBuf) != 0 {
|
||||
tok.char = '\n'
|
||||
tok.value = 0
|
||||
*c.outBuf = append(*c.outBuf, tok.token4)
|
||||
c.out <- c.outBuf
|
||||
b := token4Pool.Get().(*[]token4)
|
||||
*b = (*b)[:0]
|
||||
c.outBuf = b
|
||||
}
|
||||
c.inPragmaOp = true
|
||||
c.pragmaOpBuf = c.pragmaOpBuf[:0]
|
||||
default:
|
||||
*c.outBuf = append(*c.outBuf, tok.token4)
|
||||
}
|
||||
v = v[1 : len(v)-1]
|
||||
v = strings.ReplaceAll(v, `\"`, `"`)
|
||||
a[i] = "#pragma " + strings.ReplaceAll(v, `\\`, `\`) + "\n"
|
||||
}
|
||||
src := strings.Join(a, "")
|
||||
s := newScanner0(c.ctx, strings.NewReader(src), tokenNewFile("", len(src)), 4096)
|
||||
if ppf := s.translationPhase3(); ppf != nil {
|
||||
ppf.translationPhase4(c)
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,7 +531,7 @@ func (c *cpp) writes(toks []cppToken) {
|
||||
// return T^HS • expand(TS’);
|
||||
// }
|
||||
func (c *cpp) expand(ts tokenReader, w tokenWriter, expandDefined bool) {
|
||||
// dbg("==== expand enter")
|
||||
// trc("==== expand enter")
|
||||
start:
|
||||
tok, ok := ts.read()
|
||||
tok.file = c.file
|
||||
@ -538,7 +539,7 @@ start:
|
||||
if !ok {
|
||||
// ---------------------------------------------------------- A
|
||||
// return {};
|
||||
// dbg("---- expand A")
|
||||
// trc("---- expand A")
|
||||
return
|
||||
}
|
||||
|
||||
@ -558,8 +559,8 @@ start:
|
||||
if tok.has(nm) {
|
||||
// -------------------------------------------------- B
|
||||
// return T^HS • expand(TS’);
|
||||
// dbg("---- expand B")
|
||||
// dbg("expand write %q", tok)
|
||||
// trc("---- expand B")
|
||||
// trc("expand write %q", tok)
|
||||
w.write(tok)
|
||||
goto start
|
||||
}
|
||||
@ -591,7 +592,7 @@ start:
|
||||
if m != nil {
|
||||
// -------------------------------------------------- C
|
||||
// return expand(subst(ts(T), {}, {}, HS \cup {T}, {}) • TS’ );
|
||||
// dbg("---- expand C")
|
||||
// trc("---- expand C")
|
||||
hs := hideSet{nm: {}}
|
||||
for k, v := range tok.hs {
|
||||
hs[k] = v
|
||||
@ -622,7 +623,7 @@ start:
|
||||
// -------------------------------------------------- D
|
||||
// check TS’ is actuals • )^HS’ • TS’’ and actuals are "correct for T"
|
||||
// return expand(subst(ts(T), fp(T), actuals,(HS \cap HS’) \cup {T }, {}) • TS’’);
|
||||
// dbg("---- expand D")
|
||||
// trc("---- expand D")
|
||||
hs := tok.hs
|
||||
var skip []cppToken
|
||||
again:
|
||||
@ -703,8 +704,8 @@ start:
|
||||
// ------------------------------------------------------------------ E
|
||||
// note TS must be T^HS • TS’
|
||||
// return T^HS • expand(TS’);
|
||||
// dbg("---- expand E")
|
||||
// dbg("expand write %q", tok)
|
||||
// trc("---- expand E")
|
||||
// trc("expand write %q", tok)
|
||||
w.write(tok)
|
||||
goto start
|
||||
}
|
||||
@ -912,28 +913,28 @@ func (c *cpp) actuals(m *Macro, r tokenReader) (varArgs []cppToken, ap [][]cppTo
|
||||
// combinations. After the entire input sequence is finished, the updated hide
|
||||
// set is applied to the output sequence, and that is the result of subst.
|
||||
func (c *cpp) subst(m *Macro, is []cppToken, fp []StringID, varArgs []cppToken, ap [][]cppToken, hs hideSet, os *[]cppToken, expandDefined bool) (r []cppToken) {
|
||||
// var a []string
|
||||
// for _, v := range ap {
|
||||
// a = append(a, fmt.Sprintf("%q", cppToksStr(v, "|")))
|
||||
// }
|
||||
// dbg("==== subst: is %q, fp %v ap %v", cppToksStr(is, "|"), fp, a)
|
||||
var ap0 [][]cppToken
|
||||
for _, v := range ap {
|
||||
ap0 = append(ap0, append([]cppToken(nil), v...))
|
||||
}
|
||||
// trc("==== subst: is %q, fp, %v ap@%p %v", cppToksStr(is, "|"), fp, &ap, cppToksStr2(ap))
|
||||
start:
|
||||
// dbg("start: %q", cppToksStr(is, "|"))
|
||||
// trc("start: is %q, fp %v, ap@%p %v, os %q", cppToksStr(is, "|"), fp, &ap, cppToksStr2(ap), cppToksStr(*os, "|"))
|
||||
if len(is) == 0 {
|
||||
// ---------------------------------------------------------- A
|
||||
// return hsadd(HS, OS);
|
||||
// dbg("---- A")
|
||||
// dbg("subst returns %q", cppToksStr(os, "|"))
|
||||
// trc("---- A")
|
||||
// trc("subst RETURNS %q", cppToksStr(*os, "|"))
|
||||
return c.hsAdd(hs, os)
|
||||
}
|
||||
|
||||
tok := is[0]
|
||||
var arg []cppToken
|
||||
if tok.char == '#' {
|
||||
if len(is) > 1 && is[1].char == IDENTIFIER && m.param(varArgs, ap, is[1].value, &arg) {
|
||||
if len(is) > 1 && is[1].char == IDENTIFIER && m.param(varArgs, ap0, is[1].value, &arg) {
|
||||
// -------------------------------------------------- B
|
||||
// return subst(IS’, FP, AP, HS, OS • stringize(select(i, AP)));
|
||||
// dbg("---- subst B")
|
||||
// trc("---- subst B")
|
||||
*os = append(*os, c.stringize(arg))
|
||||
is = is[2:]
|
||||
goto start
|
||||
@ -941,14 +942,14 @@ start:
|
||||
}
|
||||
|
||||
if tok.char == PPPASTE {
|
||||
if len(is) > 1 && is[1].char == IDENTIFIER && m.param(varArgs, ap, is[1].value, &arg) {
|
||||
if len(is) > 1 && is[1].char == IDENTIFIER && m.param(varArgs, ap0, is[1].value, &arg) {
|
||||
// -------------------------------------------------- C
|
||||
// dbg("---- subst C")
|
||||
// trc("---- subst C")
|
||||
if len(arg) == 0 {
|
||||
// TODO "only if actuals can be empty"
|
||||
// ------------------------------------------ D
|
||||
// return subst(IS’, FP, AP, HS, OS);
|
||||
// dbg("---- D")
|
||||
// trc("---- D")
|
||||
if c := len(*os); c != 0 && (*os)[c-1].char == ',' {
|
||||
*os = (*os)[:c-1]
|
||||
}
|
||||
@ -958,7 +959,7 @@ start:
|
||||
|
||||
// -------------------------------------------------- E
|
||||
// return subst(IS’, FP, AP, HS, glue(OS, select(i, AP)));
|
||||
// dbg("---- subst E")
|
||||
// trc("---- subst E, arg %q", cppToksStr(arg, "|"))
|
||||
*os = c.glue(*os, arg)
|
||||
is = is[2:]
|
||||
goto start
|
||||
@ -967,39 +968,39 @@ start:
|
||||
if len(is) > 1 {
|
||||
// -------------------------------------------------- F
|
||||
// return subst(IS’, FP, AP, HS, glue(OS, T^HS’));
|
||||
// dbg("---- subst F")
|
||||
// trc("---- subst F")
|
||||
*os = c.glue(*os, is[1:2])
|
||||
is = is[2:]
|
||||
goto start
|
||||
}
|
||||
}
|
||||
|
||||
if tok.char == IDENTIFIER && (len(is) > 1 && is[1].char == PPPASTE) && m.param(varArgs, ap, tok.value, &arg) {
|
||||
if tok.char == IDENTIFIER && (len(is) > 1 && is[1].char == PPPASTE) && m.param(varArgs, ap0, tok.value, &arg) {
|
||||
// ---------------------------------------------------------- G
|
||||
// dbg("---- subst G")
|
||||
// trc("---- subst G")
|
||||
if len(arg) == 0 {
|
||||
// TODO "only if actuals can be empty"
|
||||
// -------------------------------------------------- H
|
||||
// dbg("---- subst H")
|
||||
// trc("---- subst H")
|
||||
is = is[2:] // skip T##
|
||||
if len(is) > 0 && is[0].char == IDENTIFIER && m.param(varArgs, ap, is[0].value, &arg) {
|
||||
// -------------------------------------------------- I
|
||||
// return subst(IS’’, FP, AP, HS, OS • select(j, AP));
|
||||
// dbg("---- subst I")
|
||||
// trc("---- subst I")
|
||||
*os = append(*os, arg...)
|
||||
is = is[1:]
|
||||
goto start
|
||||
} else {
|
||||
// -------------------------------------------------- J
|
||||
// return subst(IS’, FP, AP, HS, OS);
|
||||
// dbg("---- subst J")
|
||||
// trc("---- subst J")
|
||||
goto start
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------- K
|
||||
// return subst(##^HS’ • IS’, FP, AP, HS, OS • select(i, AP));
|
||||
// dbg("---- subst K")
|
||||
// trc("---- subst K")
|
||||
*os = append(*os, arg...)
|
||||
is = is[1:]
|
||||
goto start
|
||||
@ -1009,7 +1010,7 @@ start:
|
||||
if tok.char == IDENTIFIER && m.param2(varArgs, ap, tok.value, &arg, &ax) {
|
||||
// ------------------------------------------ L
|
||||
// return subst(IS’, FP, AP, HS, OS • expand(select(i, AP)));
|
||||
// dbg("---- subst L")
|
||||
// trc("---- subst L")
|
||||
// if toks, ok := cache[tok.value]; ok {
|
||||
// os = append(os, toks...)
|
||||
// is = is[1:]
|
||||
@ -1018,7 +1019,9 @@ start:
|
||||
|
||||
sel := cppReader{buf: arg}
|
||||
var w cppWriter
|
||||
// trc("---- L(1) ap@%p %v", &ap, cppToksStr2(ap))
|
||||
c.expand(&sel, &w, expandDefined)
|
||||
// trc("---- L(2) ap@%p %v", &ap, cppToksStr2(ap))
|
||||
*os = append(*os, w.toks...)
|
||||
if ax >= 0 {
|
||||
ap[ax] = w.toks
|
||||
@ -1030,9 +1033,9 @@ start:
|
||||
// ------------------------------------------------------------------ M
|
||||
// note IS must be T^HS’ • IS’
|
||||
// return subst(IS’, FP, AP, HS, OS • T^HS’);
|
||||
// dbg("---- subst M")
|
||||
*os = append(*os, tok)
|
||||
is = is[1:]
|
||||
// trc("---- subst M: is %q, os %q", cppToksStr(is, "|"), cppToksStr(*os, "|"))
|
||||
goto start
|
||||
}
|
||||
|
||||
@ -1057,7 +1060,18 @@ start:
|
||||
// 43
|
||||
// 0
|
||||
// $
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// glue(LS,RS ) /* paste last of left side with first of right side */
|
||||
// {
|
||||
// if LS is L^HS and RS is R^HS’ • RS’ then
|
||||
// return L&R^(HS∩HS’) • RS’; /* undefined if L&R is invalid */
|
||||
|
||||
// // note LS must be L HS • LS’
|
||||
// return L^HS • glue(LS’,RS );
|
||||
// }
|
||||
func (c *cpp) glue(ls, rs []cppToken) (out []cppToken) {
|
||||
// trc("ls %q, rs %q", cppToksStr(ls, "|"), cppToksStr(rs, "|"))
|
||||
if len(rs) == 0 {
|
||||
return ls
|
||||
}
|
||||
@ -2463,6 +2477,17 @@ func (n *ppIncludeDirective) translationPhase4(c *cpp) {
|
||||
return
|
||||
}
|
||||
|
||||
if h := c.ctx.cfg.IncludeFileHandler; h != nil {
|
||||
var position gotoken.Position
|
||||
if p := toks[0].Pos(); p.IsValid() {
|
||||
position = gotoken.Position(c.file.PositionFor(p, true))
|
||||
}
|
||||
apath, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
c.err(toks[0], "%s: cannot compute absolute path: %v", path, err)
|
||||
}
|
||||
h(position, apath)
|
||||
}
|
||||
cf, err := cache.getFile(c.ctx, path, sys, false)
|
||||
if err != nil {
|
||||
c.err(toks[0], "%s: %v", path, err)
|
||||
|
95
vendor/modernc.org/cc/v3/parser.go
generated
vendored
95
vendor/modernc.org/cc/v3/parser.go
generated
vendored
@ -313,6 +313,7 @@ var (
|
||||
dict.sid("__pragma_stdc"): PRAGMASTDC,
|
||||
dict.sid("__restrict"): RESTRICT,
|
||||
dict.sid("__restrict__"): RESTRICT,
|
||||
dict.sid("__signed"): SIGNED,
|
||||
dict.sid("__signed__"): SIGNED,
|
||||
dict.sid("__thread"): THREADLOCAL,
|
||||
dict.sid("__typeof"): TYPEOF,
|
||||
@ -2263,7 +2264,7 @@ func (p *parser) functionSpecifier(inline *bool) *FunctionSpecifier {
|
||||
// declarator:
|
||||
// pointer_opt direct-declarator attribute-specifier-list_opt
|
||||
func (p *parser) declarator(declare, isTypedefName bool, ptr *Pointer) *Declarator {
|
||||
if ptr == nil && p.rune() == '*' {
|
||||
if ptr == nil && (p.rune() == '*' || p.rune() == '^') {
|
||||
ptr = p.pointer()
|
||||
}
|
||||
r := &Declarator{IsTypedefName: isTypedefName, Pointer: ptr, DirectDeclarator: p.directDeclarator(nil)}
|
||||
@ -2488,9 +2489,21 @@ func (p *parser) directDeclarator(d *DirectDeclarator) (r *DirectDeclarator) {
|
||||
// pointer:
|
||||
// * type-qualifier-list_opt
|
||||
// * type-qualifier-list_opt pointer
|
||||
// ^ type-qualifier-list_opt
|
||||
func (p *parser) pointer() (r *Pointer) {
|
||||
if p.rune() == '^' {
|
||||
t := p.shift()
|
||||
var list *TypeQualifiers
|
||||
switch p.rune() {
|
||||
case ATTRIBUTE, CONST, RESTRICT, VOLATILE, ATOMIC:
|
||||
list = p.typeQualifierList()
|
||||
}
|
||||
|
||||
return &Pointer{Case: PointerBlock, Token: t, TypeQualifiers: list}
|
||||
}
|
||||
|
||||
if p.rune() != '*' {
|
||||
p.err("expected *")
|
||||
p.err("expected * or ^")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2608,7 +2621,8 @@ func (p *parser) parameterDeclaration() *ParameterDeclaration {
|
||||
|
||||
func (p *parser) declaratorOrAbstractDeclarator(isTypedefName bool) (r Node) {
|
||||
var ptr *Pointer
|
||||
if p.rune() == '*' {
|
||||
switch p.rune() {
|
||||
case '*', '^':
|
||||
ptr = p.pointer()
|
||||
}
|
||||
switch p.rune() {
|
||||
@ -2766,7 +2780,7 @@ func (p *parser) typeName() *TypeName {
|
||||
// pointer
|
||||
// pointer_opt direct-abstract-declarator
|
||||
func (p *parser) abstractDeclarator(ptr *Pointer) *AbstractDeclarator {
|
||||
if ptr == nil && p.rune() == '*' {
|
||||
if ptr == nil && (p.rune() == '*' || p.rune() == '^') {
|
||||
ptr = p.pointer()
|
||||
}
|
||||
switch p.rune() {
|
||||
@ -3148,28 +3162,49 @@ func (p *parser) designator(acceptCol bool) (*Designator, bool) {
|
||||
// iteration-statement
|
||||
// jump-statement
|
||||
// asm-statement
|
||||
func (p *parser) statement() *Statement {
|
||||
switch p.rune() {
|
||||
case IDENTIFIER:
|
||||
if p.peek(false) == ':' {
|
||||
return &Statement{Case: StatementLabeled, LabeledStatement: p.labeledStatement()}
|
||||
func (p *parser) statement() (r *Statement) {
|
||||
var r0 *Statement
|
||||
var prevLS, ls *LabeledStatement
|
||||
|
||||
defer func() {
|
||||
if ls != nil {
|
||||
ls.Statement = r
|
||||
r = r0
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
switch p.rune() {
|
||||
case IDENTIFIER:
|
||||
switch {
|
||||
case p.peek(false) == ':':
|
||||
ls = p.labeledStatement()
|
||||
default:
|
||||
return &Statement{Case: StatementExpr, ExpressionStatement: p.expressionStatement()}
|
||||
}
|
||||
case '{':
|
||||
return &Statement{Case: StatementCompound, CompoundStatement: p.compoundStatement(nil, nil)}
|
||||
case IF, SWITCH:
|
||||
return &Statement{Case: StatementSelection, SelectionStatement: p.selectionStatement()}
|
||||
case WHILE, DO, FOR:
|
||||
return &Statement{Case: StatementIteration, IterationStatement: p.iterationStatement()}
|
||||
case GOTO, BREAK, CONTINUE, RETURN:
|
||||
return &Statement{Case: StatementJump, JumpStatement: p.jumpStatement()}
|
||||
case CASE, DEFAULT:
|
||||
ls = p.labeledStatement()
|
||||
case ASM:
|
||||
return &Statement{Case: StatementAsm, AsmStatement: p.asmStatement()}
|
||||
default:
|
||||
return &Statement{Case: StatementExpr, ExpressionStatement: p.expressionStatement()}
|
||||
}
|
||||
|
||||
return &Statement{Case: StatementExpr, ExpressionStatement: p.expressionStatement()}
|
||||
case '{':
|
||||
return &Statement{Case: StatementCompound, CompoundStatement: p.compoundStatement(nil, nil)}
|
||||
case IF, SWITCH:
|
||||
return &Statement{Case: StatementSelection, SelectionStatement: p.selectionStatement()}
|
||||
case WHILE, DO, FOR:
|
||||
return &Statement{Case: StatementIteration, IterationStatement: p.iterationStatement()}
|
||||
case GOTO, BREAK, CONTINUE, RETURN:
|
||||
return &Statement{Case: StatementJump, JumpStatement: p.jumpStatement()}
|
||||
case CASE, DEFAULT:
|
||||
return &Statement{Case: StatementLabeled, LabeledStatement: p.labeledStatement()}
|
||||
case ASM:
|
||||
return &Statement{Case: StatementAsm, AsmStatement: p.asmStatement()}
|
||||
default:
|
||||
return &Statement{Case: StatementExpr, ExpressionStatement: p.expressionStatement()}
|
||||
switch {
|
||||
case r0 == nil:
|
||||
r0 = &Statement{Case: StatementLabeled, LabeledStatement: ls}
|
||||
default:
|
||||
prevLS.Statement = &Statement{Case: StatementLabeled, LabeledStatement: ls}
|
||||
}
|
||||
prevLS = ls
|
||||
}
|
||||
}
|
||||
|
||||
@ -3206,7 +3241,7 @@ func (p *parser) labeledStatement() (r *LabeledStatement) {
|
||||
p.block.hasLabel()
|
||||
r = &LabeledStatement{
|
||||
Case: LabeledStatementLabel, Token: t, Token2: t2, AttributeSpecifierList: attr,
|
||||
Statement: p.statement(), lexicalScope: p.declScope, block: p.block,
|
||||
lexicalScope: p.declScope, block: p.block,
|
||||
}
|
||||
p.declScope.declare(t.Value, r)
|
||||
return r
|
||||
@ -3232,8 +3267,7 @@ func (p *parser) labeledStatement() (r *LabeledStatement) {
|
||||
return &LabeledStatement{
|
||||
Case: LabeledStatementRange, Token: t, ConstantExpression: e,
|
||||
Token2: t2, ConstantExpression2: e2, Token3: t3,
|
||||
Statement: p.statement(), lexicalScope: p.declScope,
|
||||
block: p.block,
|
||||
lexicalScope: p.declScope, block: p.block,
|
||||
}
|
||||
case ':':
|
||||
t2 = p.shift()
|
||||
@ -3242,8 +3276,7 @@ func (p *parser) labeledStatement() (r *LabeledStatement) {
|
||||
}
|
||||
return &LabeledStatement{
|
||||
Case: LabeledStatementCaseLabel, Token: t, ConstantExpression: e,
|
||||
Token2: t2, Statement: p.statement(), lexicalScope: p.declScope,
|
||||
block: p.block,
|
||||
Token2: t2, lexicalScope: p.declScope, block: p.block,
|
||||
}
|
||||
case DEFAULT:
|
||||
if p.switches == 0 {
|
||||
@ -3257,12 +3290,12 @@ func (p *parser) labeledStatement() (r *LabeledStatement) {
|
||||
p.err("expected :")
|
||||
}
|
||||
return &LabeledStatement{
|
||||
Case: LabeledStatementDefault, Token: t, Token2: t2, Statement: p.statement(),
|
||||
Case: LabeledStatementDefault, Token: t, Token2: t2,
|
||||
lexicalScope: p.declScope, block: p.block,
|
||||
}
|
||||
default:
|
||||
p.err("expected labeled-statement")
|
||||
return nil
|
||||
return &LabeledStatement{}
|
||||
}
|
||||
}
|
||||
|
||||
|
6
vendor/modernc.org/cc/v3/parser.yy
generated
vendored
6
vendor/modernc.org/cc/v3/parser.yy
generated
vendored
@ -608,7 +608,8 @@ package cc // import "modernc.org/cc/v3"
|
||||
/*yy:case Expr */ | IDENTIFIER AttributeSpecifierList '=' ConstantExpression
|
||||
|
||||
/* [2], 6.7.2.4 Atomic type specifiers */
|
||||
/*yy:example _Atomic(int) i; */
|
||||
/*yy:field list []*TypeSpecifier */
|
||||
/*yy:example _Atomic(int) i; */
|
||||
AtomicTypeSpecifier:
|
||||
"_Atomic" '(' TypeName ')'
|
||||
|
||||
@ -647,6 +648,7 @@ package cc // import "modernc.org/cc/v3"
|
||||
/*yy:field called bool */
|
||||
/*yy:field fnDef bool */
|
||||
/*yy:field hasInitializer bool */
|
||||
/*yy:field implicit bool */
|
||||
/*yy:example int *p __attribute__ ((foo)); */
|
||||
Declarator:
|
||||
Pointer DirectDeclarator AttributeSpecifierList %prec BELOW_ATTRIBUTE
|
||||
@ -686,6 +688,8 @@ package cc // import "modernc.org/cc/v3"
|
||||
'*' TypeQualifiers
|
||||
/*yy:example int **p; */
|
||||
/*yy:case Ptr */ | '*' TypeQualifiers Pointer
|
||||
/*yy:example int atexit_b(void (^ _Nonnull)(void)); */
|
||||
/*yy:case Block */ | '^' TypeQualifiers
|
||||
|
||||
/*yy:field noStorageClass */
|
||||
/*yy:example int * const i; */
|
||||
|
31
vendor/modernc.org/cc/v3/type.go
generated
vendored
31
vendor/modernc.org/cc/v3/type.go
generated
vendored
@ -403,8 +403,8 @@ type Type interface {
|
||||
// Name returns type name, if any.
|
||||
Name() StringID
|
||||
|
||||
// atomic reports whether type has type qualifier "_Atomic".
|
||||
atomic() bool
|
||||
// IsAtomic reports whether type has type qualifier "_Atomic".
|
||||
IsAtomic() bool
|
||||
|
||||
// hasConst reports whether type has type qualifier "const".
|
||||
hasConst() bool
|
||||
@ -611,7 +611,7 @@ func (t *typeBase) check(ctx *context, td typeDescriptor, defaultInt bool) (r Ty
|
||||
case DeclarationSpecifiersStorage: // StorageClassSpecifier DeclarationSpecifiers
|
||||
// nop
|
||||
case DeclarationSpecifiersTypeSpec: // TypeSpecifier DeclarationSpecifiers
|
||||
typeSpecifiers = append(typeSpecifiers, n.TypeSpecifier)
|
||||
typeSpecifiers = append(typeSpecifiers, n.TypeSpecifier.list()...)
|
||||
case DeclarationSpecifiersTypeQual: // TypeQualifier DeclarationSpecifiers
|
||||
// nop
|
||||
case DeclarationSpecifiersFunc: // FunctionSpecifier DeclarationSpecifiers
|
||||
@ -628,7 +628,7 @@ func (t *typeBase) check(ctx *context, td typeDescriptor, defaultInt bool) (r Ty
|
||||
for ; n != nil; n = n.SpecifierQualifierList {
|
||||
switch n.Case {
|
||||
case SpecifierQualifierListTypeSpec: // TypeSpecifier SpecifierQualifierList
|
||||
typeSpecifiers = append(typeSpecifiers, n.TypeSpecifier)
|
||||
typeSpecifiers = append(typeSpecifiers, n.TypeSpecifier.list()...)
|
||||
case SpecifierQualifierListTypeQual: // TypeQualifier SpecifierQualifierList
|
||||
// nop
|
||||
case SpecifierQualifierListAlignSpec: // AlignmentSpecifier SpecifierQualifierList
|
||||
@ -931,8 +931,8 @@ func (t *typeBase) UnionCommon() Kind {
|
||||
panic(internalErrorf("%s: UnionCommon of invalid type", t.Kind()))
|
||||
}
|
||||
|
||||
// atomic implements Type.
|
||||
func (t *typeBase) atomic() bool { return t.flags&fAtomic != 0 }
|
||||
// IsAtomic implements Type.
|
||||
func (t *typeBase) IsAtomic() bool { return t.flags&fAtomic != 0 }
|
||||
|
||||
// Attributes implements Type.
|
||||
func (t *typeBase) Attributes() (a []*AttributeSpecifier) { return nil }
|
||||
@ -1220,7 +1220,7 @@ func (t *typeBase) Tag() StringID {
|
||||
// string implements Type.
|
||||
func (t *typeBase) string(b *bytes.Buffer) {
|
||||
spc := ""
|
||||
if t.atomic() {
|
||||
if t.IsAtomic() {
|
||||
b.WriteString("atomic")
|
||||
spc = " "
|
||||
}
|
||||
@ -1944,7 +1944,7 @@ func (t *aliasType) Size() uintptr { return t.d.Type().Size() }
|
||||
// String implements Type.
|
||||
func (t *aliasType) String() string {
|
||||
var a []string
|
||||
if t.typeBase.atomic() {
|
||||
if t.typeBase.IsAtomic() {
|
||||
a = append(a, "atomic")
|
||||
}
|
||||
if t.typeBase.hasConst() {
|
||||
@ -1972,8 +1972,8 @@ func (t *aliasType) Tag() StringID { return t.d.Type().Tag() }
|
||||
// Name implements Type.
|
||||
func (t *aliasType) Name() StringID { return t.nm }
|
||||
|
||||
// atomic implements Type.
|
||||
func (t *aliasType) atomic() bool { return t.d.Type().atomic() }
|
||||
// IsAtomic implements Type.
|
||||
func (t *aliasType) IsAtomic() bool { return t.d.Type().IsAtomic() }
|
||||
|
||||
// Inline implements Type.
|
||||
func (t *aliasType) Inline() bool { return t.d.Type().Inline() }
|
||||
@ -2544,12 +2544,11 @@ func (t *taggedType) isAssingmentCompatibleOperand(rhs Operand) (r bool) {
|
||||
|
||||
// IsCompatible implements Type.
|
||||
func (t *taggedType) IsCompatible(u Type) (r bool) {
|
||||
// defer func() {
|
||||
// u0 := u
|
||||
// if !r {
|
||||
// trc("TRACE %v <- %v\n%s", t, u0, debug.Stack()) //TODO-
|
||||
// }
|
||||
// }()
|
||||
defer func() {
|
||||
// if !r {
|
||||
// trc("TRACE %v <- %v: %v (%s)", t, u0, r, origin(2)) //TODO-
|
||||
// }
|
||||
}()
|
||||
if t == nil || u == nil {
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user