1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:04:40 -07:00

convert non-pkg go files to whole-package compilation.

mostly removing forward declarations.

R=r
DELTA=138  (2 added, 127 deleted, 9 changed)
OCL=33068
CL=33099
This commit is contained in:
Russ Cox 2009-08-12 13:18:54 -07:00
parent eda49f331f
commit 5b62b19d43
13 changed files with 11 additions and 140 deletions

View File

@ -41,8 +41,6 @@ var chnames string
var chnameserial int var chnameserial int
var seqno int var seqno int
func Init();
func mkdch() *dch { func mkdch() *dch {
c := chnameserial % len(chnames); c := chnameserial % len(chnames);
chnameserial++; chnameserial++;
@ -428,7 +426,7 @@ func Poly(a []rat) PS {
*/ */
// Multiply. The algorithm is // Multiply. The algorithm is
// let U = u + x*UU // let U = u + x*UU
// let V = v + x*VV // let V = v + x*VV
// then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV // then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV
@ -547,7 +545,7 @@ func Exp(U PS) PS {
// Substitute V for x in U, where the leading term of V is zero // Substitute V for x in U, where the leading term of V is zero
// let U = u + x*UU // let U = u + x*UU
// let V = v + x*VV // let V = v + x*VV
// then S(U,V) = u + VV*S(V,UU) // then S(U,V) = u + VV*S(V,UU)
// bug: a nonzero constant term is ignored // bug: a nonzero constant term is ignored
func Subst(U, V PS) PS { func Subst(U, V PS) PS {

View File

@ -50,8 +50,6 @@ var chnames string
var chnameserial int var chnameserial int
var seqno int var seqno int
func Init();
func mkdch() *dch { func mkdch() *dch {
c := chnameserial % len(chnames); c := chnameserial % len(chnames);
chnameserial++; chnameserial++;
@ -441,7 +439,7 @@ func Poly(a [] *rat) PS{
*/ */
// Multiply. The algorithm is // Multiply. The algorithm is
// let U = u + x*UU // let U = u + x*UU
// let V = v + x*VV // let V = v + x*VV
// then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV // then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV
@ -560,7 +558,7 @@ func Exp(U PS) PS{
// Substitute V for x in U, where the leading term of V is zero // Substitute V for x in U, where the leading term of V is zero
// let U = u + x*UU // let U = u + x*UU
// let V = v + x*VV // let V = v + x*VV
// then S(U,V) = u + VV*S(V,UU) // then S(U,V) = u + VV*S(V,UU)
// bug: a nonzero constant term is ignored // bug: a nonzero constant term is ignored
func Subst(U, V PS) PS { func Subst(U, V PS) PS {

View File

@ -1,23 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// $G $D/$F.go && $L $F.$A && ./$A.out
// Forward declarations
package main
func f (x int) ; // this works
func f (x int) {}
func i (x, y int) ; // this works
func i (x, y int) {}
func g (x int) float ; // BUG this doesn't
func g (x int) float { return 0.0 }
func h (x int) (u int, v int) ; // BUG this doesn't
func h (x int) (u int, v int) { return; }
func main() {}

View File

@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// $G $D/$F.go && $L $F.$A && ./$A.out
package main
type S struct {
};
func (p *S) M1a() ;
func (p *S) M2a() {
p.M1a();
}
func (p *S) M1a() {} // this works
func (p *S) M1b() int;
func (p *S) M2b() {
p.M1b();
}
func (p *S) M1b() int { return 0 } // BUG this doesn't
func main() {}

View File

@ -9,11 +9,11 @@ package P
var x int var x int
func foo() { func foo() {
print(P.x); // P should be defined between the outermost "universe" scope and the global scope print(P.x); // ERROR "undefined"
} }
/* /*
uetli:~/Source/go1/test/bugs gri$ 6g bug085.go uetli:~/Source/go1/test/bugs gri$ 6g bug085.go
bug085.go:6: P: undefined bug085.go:6: P: undefined
Bus error Bus error
*/ */

View File

@ -87,9 +87,6 @@ func (m *HashMap) Probe (key *KeyType) *Entry {
} }
func (m *HashMap) Resize();
func (m *HashMap) Lookup (key *KeyType, insert bool) *Entry { func (m *HashMap) Lookup (key *KeyType, insert bool) *Entry {
// Find a matching entry. // Find a matching entry.
var p *Entry = m.Probe(key); var p *Entry = m.Probe(key);

View File

@ -19,6 +19,5 @@ type I2 interface {
} }
type T int type T int
func (t T) bar() I1;
func (t T) foo() I2 { return t } func (t T) foo() I2 { return t }
func (t T) bar() I1 { return t } func (t T) bar() I1 { return t }

View File

@ -6,8 +6,6 @@
package main package main
func simple(ia,ib,ic int) (oa,ob int);
func func
main() main()
{ {

View File

@ -13,8 +13,6 @@ type C struct
x func(p *C)int; x func(p *C)int;
} }
func g(p *C)int;
func func
(this *C) f()int (this *C) f()int
{ {

View File

@ -36,8 +36,6 @@ type Slist struct {
} }
func (this *Slist) Print();
func (this *Slist) Car() *Slist { func (this *Slist) Car() *Slist {
return this.list.car; return this.list.car;
} }
@ -67,9 +65,6 @@ func (slist *Slist) Free() {
// free(slist); // free(slist);
} }
func OpenFile();
func Parse() *Slist;
//Slist* atom(byte *s, int i); //Slist* atom(byte *s, int i);
var token int; var token int;

View File

@ -7,8 +7,6 @@
package main package main
func fun(ia,ib,ic int)int;
func func
main() main()
{ {

View File

@ -2,67 +2,10 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. include $(GOROOT)/src/Make.$(GOARCH)
# gobuild -m >Makefile
D= TARG=iterable
GOFILES=\
iterable.go\
O_arm=5 include $(GOROOT)/src/Make.pkg
O_amd64=6
O_386=8
OS=568vq
O=$(O_$(GOARCH))
GC=$(O)g -I_obj
CC=$(O)c -FVw
AS=$(O)a
AR=6ar
default: packages
clean:
rm -rf *.[$(OS)] *.a [$(OS)].out _obj
test: packages
gotest
coverage: packages
gotest
6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go
$(GC) $*.go
%.$O: %.c
$(CC) $*.c
%.$O: %.s
$(AS) $*.s
O1=\
iterable.$O\
phases: a1
_obj$D/iterable.a: phases
a1: $(O1)
$(AR) grc _obj$D/iterable.a iterable.$O
rm -f $(O1)
newpkg: clean
mkdir -p _obj$D
$(AR) grc _obj$D/iterable.a
$(O1): newpkg
$(O2): a1
nuke: clean
rm -f $(GOROOT)/pkg$D/iterable.a
packages: _obj$D/iterable.a
install: packages
test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg$D
cp _obj$D/iterable.a $(GOROOT)/pkg$D/iterable.a

View File

@ -5,7 +5,6 @@
package iterable package iterable
import ( import (
"iterable";
"testing"; "testing";
) )