OLD | NEW |
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if nerrors > 0 { | 248 if nerrors > 0 { |
249 os.Exit(2) | 249 os.Exit(2) |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 // Record what needs to be recorded about f. | 253 // Record what needs to be recorded about f. |
254 func (p *Package) Record(f *File) { | 254 func (p *Package) Record(f *File) { |
255 if p.PackageName == "" { | 255 if p.PackageName == "" { |
256 p.PackageName = f.Package | 256 p.PackageName = f.Package |
257 } else if p.PackageName != f.Package { | 257 } else if p.PackageName != f.Package { |
258 » » error(token.NoPos, "inconsistent package names: %s, %s", p.Packa
geName, f.Package) | 258 » » error_(token.NoPos, "inconsistent package names: %s, %s", p.Pack
ageName, f.Package) |
259 } | 259 } |
260 | 260 |
261 if p.Name == nil { | 261 if p.Name == nil { |
262 p.Name = f.Name | 262 p.Name = f.Name |
263 } else { | 263 } else { |
264 for k, v := range f.Name { | 264 for k, v := range f.Name { |
265 if p.Name[k] == nil { | 265 if p.Name[k] == nil { |
266 p.Name[k] = v | 266 p.Name[k] = v |
267 } else if !reflect.DeepEqual(p.Name[k], v) { | 267 } else if !reflect.DeepEqual(p.Name[k], v) { |
268 » » » » error(token.NoPos, "inconsistent definitions for
C.%s", k) | 268 » » » » error_(token.NoPos, "inconsistent definitions fo
r C.%s", k) |
269 } | 269 } |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 p.ExpFunc = append(p.ExpFunc, f.ExpFunc...) | 273 p.ExpFunc = append(p.ExpFunc, f.ExpFunc...) |
274 p.Decl = append(p.Decl, f.AST.Decls...) | 274 p.Decl = append(p.Decl, f.AST.Decls...) |
275 } | 275 } |
OLD | NEW |