summaryrefslogtreecommitdiffstats
path: root/vendor/modernc.org/ccgo
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-08-13 16:14:26 +0200
committerGitHub <noreply@github.com>2022-08-13 16:14:26 +0200
commit6a3fc713978a0c1c9290a4afd08b47886b49b635 (patch)
treeaa62cd85cf5671646c75ee38b3fc140ef7edcea8 /vendor/modernc.org/ccgo
parent3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (diff)
downloadmatterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.gz
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.bz2
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.zip
Update dependencies and go1.18 (#1873)
* Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18
Diffstat (limited to 'vendor/modernc.org/ccgo')
-rw-r--r--vendor/modernc.org/ccgo/v3/lib/Makefile2
-rw-r--r--vendor/modernc.org/ccgo/v3/lib/go.go53
2 files changed, 53 insertions, 2 deletions
diff --git a/vendor/modernc.org/ccgo/v3/lib/Makefile b/vendor/modernc.org/ccgo/v3/lib/Makefile
index 0e9b362e..a170239c 100644
--- a/vendor/modernc.org/ccgo/v3/lib/Makefile
+++ b/vendor/modernc.org/ccgo/v3/lib/Makefile
@@ -116,7 +116,7 @@ edit:
editor:
gofmt -l -s -w *.go
- go build -v -o $(GOPATH)/bin/ccgo modernc.org/ccgo/v3
+ go build -v -o $(GOPATH)/bin/ccgo3 modernc.org/ccgo/v3
go test -c -o /dev/null
later:
diff --git a/vendor/modernc.org/ccgo/v3/lib/go.go b/vendor/modernc.org/ccgo/v3/lib/go.go
index 45ffc6e7..665f5ebe 100644
--- a/vendor/modernc.org/ccgo/v3/lib/go.go
+++ b/vendor/modernc.org/ccgo/v3/lib/go.go
@@ -9523,7 +9523,7 @@ func (p *project) postfixExpressionSelectPSelectStruct(f *function, n *cc.Postfi
func (p *project) postfixExpressionSelectSelect(f *function, n *cc.PostfixExpression, t cc.Type, mode exprMode, flags flags) {
// PostfixExpression '.' IDENTIFIER
- switch k := p.opKind(f, n.PostfixExpression, n.PostfixExpression.Operand.Type()); k {
+ switch k := p.structOrUnion(n); k {
case opUnion:
p.postfixExpressionSelectSelectUnion(f, n, t, mode, flags)
case opStruct:
@@ -9533,6 +9533,40 @@ func (p *project) postfixExpressionSelectSelect(f *function, n *cc.PostfixExpres
}
}
+func (p *project) structOrUnion(n *cc.PostfixExpression) opKind {
+ t := n.PostfixExpression.Operand.Type()
+ switch n.Case {
+ case cc.PostfixExpressionSelect: // PostfixExpression '.' IDENTIFIER
+ // ok
+ case cc.PostfixExpressionPSelect: // PostfixExpression "->" IDENTIFIER
+ if t.Kind() == cc.Ptr {
+ t = t.Elem()
+ break
+ }
+
+ p.err(n, "expected pointer type: %s", t)
+ return opStruct
+ }
+ f, path, ok := t.FieldByName2(n.Token2.Src)
+ if !ok {
+ p.err(&n.Token, "unknown field: %s", n.Token2)
+ return opStruct
+ }
+
+ for len(path) > 1 {
+ f = t.FieldByIndex(path[:1])
+ path = path[1:]
+ t = f.Type()
+ }
+ if t.Kind() == cc.Union {
+ // trc("%v: %q %v", n.Token2.Position(), n.Token2.Src, opUnion)
+ return opUnion
+ }
+
+ // trc("%v: %q %v", n.Token2.Position(), n.Token2.Src, opStruct)
+ return opStruct
+}
+
func (p *project) postfixExpressionSelectSelectStruct(f *function, n *cc.PostfixExpression, t cc.Type, mode exprMode, flags flags) {
// PostfixExpression '.' IDENTIFIER
fld := n.Field
@@ -12640,6 +12674,23 @@ func (p *project) iterationStatement(f *function, n *cc.IterationStatement) {
}
p.statement(f, n.Statement, true, false, false, 0)
case cc.IterationStatementForDecl: // "for" '(' Declaration Expression ';' Expression ')' Statement
+ if !(f.hasJumps || n.Expression2 != nil && n.Expression2.Case == cc.ExpressionComma) {
+ p.w("{")
+ p.declaration(f, n.Declaration, false)
+ p.w("for ;")
+ if n.Expression != nil {
+ p.expression(f, n.Expression, n.Expression.Operand.Type(), exprBool, 0)
+ }
+ p.w(";")
+ if n.Expression2 != nil {
+ p.expression(f, n.Expression2, n.Expression2.Operand.Type(), exprVoid, fNoCondAssignment)
+ }
+ p.w("{")
+ p.statement(f, n.Statement, false, true, false, 0)
+ p.w("}};")
+ break
+ }
+
var ids []*cc.InitDeclarator
for list := n.Declaration.InitDeclaratorList; list != nil; list = list.InitDeclaratorList {
ids = append(ids, list.InitDeclarator)