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

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

Issue 4082047: code review 4082047: cgo: improve error reporting slightly. (Closed)
Patch Set: code review 4082047: cgo: improve error reporting slightly. Created 14 years, 1 month 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/gcc.go ('k') | no next file » | 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 // Cgo; see gmp.go for an overview. 5 // Cgo; see gmp.go for an overview.
6 6
7 // TODO(rsc): 7 // TODO(rsc):
8 // Emit correct line number annotations. 8 // Emit correct line number annotations.
9 // Make 6g understand the annotations. 9 // Make 6g understand the annotations.
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 // A FuncType collects information about a function type in both the C and Go wo rlds. 93 // A FuncType collects information about a function type in both the C and Go wo rlds.
94 type FuncType struct { 94 type FuncType struct {
95 Params []*Type 95 Params []*Type
96 Result *Type 96 Result *Type
97 Go *ast.FuncType 97 Go *ast.FuncType
98 } 98 }
99 99
100 func usage() { 100 func usage() {
101 » fmt.Fprint(os.Stderr, "usage: cgo [compiler options] file.go ...\n") 101 » fmt.Fprint(os.Stderr, "usage: cgo -- [compiler options] file.go ...\n")
102 » flag.PrintDefaults()
102 os.Exit(2) 103 os.Exit(2)
103 } 104 }
104 105
105 var ptrSizeMap = map[string]int64{ 106 var ptrSizeMap = map[string]int64{
106 "386": 4, 107 "386": 4,
107 "amd64": 8, 108 "amd64": 8,
108 "arm": 4, 109 "arm": 4,
109 } 110 }
110 111
111 var cPrefix string 112 var cPrefix string
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 p.Name[k] = v 249 p.Name[k] = v
249 } else if !reflect.DeepEqual(p.Name[k], v) { 250 } else if !reflect.DeepEqual(p.Name[k], v) {
250 error(token.NoPos, "inconsistent definitions for C.%s", k) 251 error(token.NoPos, "inconsistent definitions for C.%s", k)
251 } 252 }
252 } 253 }
253 } 254 }
254 255
255 p.ExpFunc = append(p.ExpFunc, f.ExpFunc...) 256 p.ExpFunc = append(p.ExpFunc, f.ExpFunc...)
256 p.Decl = append(p.Decl, f.AST.Decls...) 257 p.Decl = append(p.Decl, f.AST.Decls...)
257 } 258 }
OLDNEW
« no previous file with comments | « src/cmd/cgo/gcc.go ('k') | no next file » | no next file with comments »

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