Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(65)

Side by Side Diff: src/cmd/cgo/gcc.go

Issue 194098: code review 194098: More steps towards tracking of identifier scopes. (Closed)
Patch Set: code review 194098: More steps towards tracking of identifier scopes. Created 15 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/cgo/ast.go ('k') | src/cmd/godoc/godoc.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Annotate Crefs in Prog with C types by parsing gcc debug output. 5 // Annotate Crefs in Prog with C types by parsing gcc debug output.
6 // Conversion of debug output to Go types. 6 // Conversion of debug output to Go types.
7 7
8 package main 8 package main
9 9
10 import ( 10 import (
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if err == nil || val[0] == '\'' || val[0] == '"' { 55 if err == nil || val[0] == '\'' || val[0] == '"' {
56 defines[key] = val 56 defines[key] = val
57 } 57 }
58 } 58 }
59 59
60 // Construct a slice of unique names from p.Crefs. 60 // Construct a slice of unique names from p.Crefs.
61 m := make(map[string]int) 61 m := make(map[string]int)
62 for _, c := range p.Crefs { 62 for _, c := range p.Crefs {
63 // If we've already found this name as a define, it is not a Cre f. 63 // If we've already found this name as a define, it is not a Cre f.
64 if val, ok := defines[c.Name]; ok { 64 if val, ok := defines[c.Name]; ok {
65 » » » _, err := parser.ParseExpr("", val) 65 » » » _, err := parser.ParseExpr("", val, nil)
66 if err != nil { 66 if err != nil {
67 fmt.Fprintf(os.Stderr, "The value in C.%s does n ot parse as a Go expression; cannot use.\n", c.Name) 67 fmt.Fprintf(os.Stderr, "The value in C.%s does n ot parse as a Go expression; cannot use.\n", c.Name)
68 os.Exit(2) 68 os.Exit(2)
69 } 69 }
70 70
71 c.Context = "const" 71 c.Context = "const"
72 c.TypeName = false 72 c.TypeName = false
73 p.Constdef[c.Name] = val 73 p.Constdef[c.Name] = val
74 continue 74 continue
75 } 75 }
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 fld = c.pad(fld, dt.ByteSize-off) 792 fld = c.pad(fld, dt.ByteSize-off)
793 off = dt.ByteSize 793 off = dt.ByteSize
794 } 794 }
795 if off != dt.ByteSize { 795 if off != dt.ByteSize {
796 fatal("struct size calculation error") 796 fatal("struct size calculation error")
797 } 797 }
798 csyntax += "}" 798 csyntax += "}"
799 expr = &ast.StructType{Fields: fld} 799 expr = &ast.StructType{Fields: fld}
800 return 800 return
801 } 801 }
OLDNEW
« no previous file with comments | « src/cmd/cgo/ast.go ('k') | src/cmd/godoc/godoc.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b