Update dependencies (#333)

This commit is contained in:
tobi 2021-11-27 15:26:58 +01:00 committed by GitHub
commit 182b4eea73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
848 changed files with 377869 additions and 107280 deletions

4
vendor/modernc.org/cc/v3/Makefile generated vendored
View file

@ -95,8 +95,8 @@ edit:
editor: lexer.go
gofmt -l -s -w *.go
GO111MODULE=off go test -o /dev/null -c
GO111MODULE=off go install 2>&1 | tee log
go test -o /dev/null -c
go install 2>&1 | tee log
ast.go lexer.go stringer.go: lexer.l parser.yy enum.go
go generate

17
vendor/modernc.org/cc/v3/abi.go generated vendored
View file

@ -50,10 +50,9 @@ func NewABI(os, arch string) (ABI, error) {
return ABI{}, fmt.Errorf("unsupported os/arch pair: %s-%s", os, arch)
}
abi := ABI{
ByteOrder: order,
Types: make(map[Kind]ABIType, len(types)),
//TODO: depends on the OS?
SignedChar: true,
ByteOrder: order,
Types: make(map[Kind]ABIType, len(types)),
SignedChar: abiSignedChar[[2]string{os, arch}],
os: os,
arch: arch,
}
@ -276,10 +275,10 @@ func (a *ABI) layout(ctx *context, n Node, t *structType) *structType {
off := f.offset
m[off] = append(m[off], f)
}
for _, a := range m {
for _, s := range m {
var first *field
var w byte
for _, f := range a {
for _, f := range s {
if first == nil {
first = f
}
@ -291,11 +290,15 @@ func (a *ABI) layout(ctx *context, n Node, t *structType) *structType {
}
}
w = normalizeBitFieldWidth(w)
for _, f := range a {
for _, f := range s {
if f.isBitField {
f.blockStart = first
f.blockWidth = w
}
if a.ByteOrder == binary.BigEndian {
f.bitFieldOffset = w - f.bitFieldWidth - f.bitFieldOffset
f.bitFieldMask = (uint64(1)<<f.bitFieldWidth - 1) << f.bitFieldOffset
}
}
}
}()

View file

@ -3,13 +3,31 @@ package cc
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,
}
var (
abiByteOrders = map[string]binary.ByteOrder{
"amd64": binary.LittleEndian,
"386": binary.LittleEndian,
"arm": binary.LittleEndian,
"arm64": binary.LittleEndian,
"s390x": binary.BigEndian,
}
abiSignedChar = map[[2]string]bool{
{"linux", "arm"}: false,
{"linux", "arm64"}: false,
{"linux", "s390x"}: false,
{"darwin", "amd64"}: true,
{"darwin", "arm64"}: true,
{"freebsd", "amd64"}: true,
{"linux", "386"}: true,
{"linux", "amd64"}: true,
{"netbsd", "amd64"}: true,
{"openbsd", "amd64"}: true,
{"windows", "386"}: true,
{"windows", "amd64"}: true,
}
)
// abiTypes contains size and alignment information for known OS/arch pairs.
//
@ -364,4 +382,73 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
Int128: {16, 16, 16},
UInt128: {16, 16, 16},
},
// gcc (GCC) 8.4.0
{"openbsd", "amd64"}: {
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 (GCC) 10.3.0
{"netbsd", "amd64"}: {
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},
},
}

2
vendor/modernc.org/cc/v3/ast.go generated vendored
View file

@ -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

39
vendor/modernc.org/cc/v3/ast2.go generated vendored
View file

@ -414,16 +414,16 @@ func Preprocess(cfg *Config, includePaths, sysIncludePaths []string, sources []S
func wTok(w io.Writer, tok Token) (err error) {
switch tok.Rune {
case STRINGLITERAL, LONGSTRINGLITERAL:
_, err = fmt.Fprintf(w, `%s"%s"`, tok.Sep, cQuotedString(tok.String()))
_, err = fmt.Fprintf(w, `%s"%s"`, tok.Sep, cQuotedString(tok.String(), true))
case CHARCONST, LONGCHARCONST:
_, err = fmt.Fprintf(w, `%s'%s'`, tok.Sep, cQuotedString(tok.String()))
_, err = fmt.Fprintf(w, `%s'%s'`, tok.Sep, cQuotedString(tok.String(), false))
default:
_, err = fmt.Fprintf(w, "%s%s", tok.Sep, tok)
}
return err
}
func cQuotedString(s string) []byte {
func cQuotedString(s string, isString bool) []byte {
var b []byte
for i := 0; i < len(s); i++ {
c := s[i]
@ -447,7 +447,20 @@ func cQuotedString(s string) []byte {
b = append(b, '\\', '\\')
continue
case '"':
b = append(b, '\\', '"')
switch {
case isString:
b = append(b, '\\', '"')
default:
b = append(b, '"')
}
continue
case '\'':
switch {
case isString:
b = append(b, '\'')
default:
b = append(b, '\\', '\'')
}
continue
}
@ -590,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) {
@ -790,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.
@ -894,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 }

16
vendor/modernc.org/cc/v3/cc.go generated vendored
View file

@ -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.

567
vendor/modernc.org/cc/v3/check.go generated vendored

File diff suppressed because it is too large Load diff

30
vendor/modernc.org/cc/v3/cpp.go generated vendored
View file

@ -7,6 +7,7 @@ package cc // import "modernc.org/cc/v3"
import (
"bytes"
"fmt"
gotoken "go/token"
"math"
"os"
"path/filepath"
@ -2182,6 +2183,8 @@ func decodeEscapeSequence(ctx *context, tok cppToken, s string) (rune, int) {
return 7, 2
case 'b':
return 8, 2
case 'e':
return 0x1b, 2
case 'f':
return 12, 2
case 'n':
@ -2444,21 +2447,7 @@ func (n *ppIncludeDirective) translationPhase4(c *cpp) {
v = dir
}
var p string
switch {
case strings.HasPrefix(nm, "./"):
wd := c.ctx.cfg.WorkingDir
if wd == "" {
var err error
if wd, err = os.Getwd(); err != nil {
c.err(toks[0], "cannot determine working dir: %v", err)
return
}
}
p = filepath.Join(wd, nm)
default:
p = filepath.Join(v, nm)
}
p := filepath.Join(v, nm)
fi, err := c.ctx.statFile(p, sys)
if err != nil || fi.IsDir() {
continue
@ -2475,6 +2464,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)

8
vendor/modernc.org/cc/v3/lexer.go generated vendored
View file

@ -360,7 +360,7 @@ yystate20:
switch {
default:
goto yyabort
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
goto yystate18
case c == 'U':
goto yystate21
@ -662,7 +662,7 @@ yystate53:
switch {
default:
goto yyabort
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
goto yystate51
case c == 'U':
goto yystate54
@ -1137,7 +1137,7 @@ yystate105:
switch {
default:
goto yyabort
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
goto yystate103
case c == 'U':
goto yystate106
@ -1254,7 +1254,7 @@ yystate117:
switch {
default:
goto yyabort
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v':
goto yystate115
case c == 'U':
goto yystate118

2
vendor/modernc.org/cc/v3/lexer.l generated vendored
View file

@ -34,7 +34,7 @@ pp-number ({digit}|\.{digit})({digit}|{identifier-nondigit}|[eEpP]{sign}|\.)*
s-char [^\x22\n\x80\\]|{escape-sequence}
s-char-sequence {s-char}+
sign [-+]
simple-sequence \\['\x22?\\abfnrtv]
simple-sequence \\['\x22?\\abefnrtv]
string-literal \x22{s-char-sequence}?\x22
universal-character-name \\u{hex-quad}|\\U{hex-quad}{hex-quad}
white-space [ \t\f\v]

4
vendor/modernc.org/cc/v3/parser.yy generated vendored
View file

@ -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

View file

@ -1178,10 +1178,6 @@ func (c *ppCache) getFile(ctx *context, name string, sys bool, doNotCache bool)
size := int(fi.Size())
if !filepath.IsAbs(name) { // Never cache relative paths
if isTesting {
panic(internalError())
}
f, err := ctx.openFile(name, sys)
if err != nil {
return nil, err

35
vendor/modernc.org/cc/v3/type.go generated vendored
View file

@ -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
}
@ -3164,10 +3163,6 @@ func NewStructLayout(t Type) *StructLayout {
//trc("%q off %d pos %d %v %v %v", f.Name(), off, pos, ft, ft.Kind(), ft.IsIncomplete())
switch {
case ft.IsBitFieldType():
if f.BitFieldOffset() != 0 {
break
}
if p := int(off - pos); p != 0 {
if pads == nil {
pads = map[Field]int{}