diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-23 23:55:31 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-23 23:55:31 +0000 |
commit | 7d83409086556232adbe25c1406be29ec68402e8 (patch) | |
tree | ed963d480affb07d364c84b0b56a97f7bb92427b /libgo | |
parent | c1e8b3edf7b5038f070c7a9732e58d066081a636 (diff) | |
download | gcc-7d83409086556232adbe25c1406be29ec68402e8.tar.gz |
compiler: Give an error if a variable is defined but not used.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183458 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/io/ioutil/ioutil_test.go | 4 | ||||
-rw-r--r-- | libgo/go/reflect/type.go | 8 | ||||
-rw-r--r-- | libgo/go/reflect/value.go | 11 |
3 files changed, 10 insertions, 13 deletions
diff --git a/libgo/go/io/ioutil/ioutil_test.go b/libgo/go/io/ioutil/ioutil_test.go index 103066817cd..70f83c9c9b7 100644 --- a/libgo/go/io/ioutil/ioutil_test.go +++ b/libgo/go/io/ioutil/ioutil_test.go @@ -71,13 +71,13 @@ func TestReadDir(t *testing.T) { t.Fatalf("ReadDir %s: error expected, none found", dirname) } + /* Does not work in gccgo testing environment. dirname = ".." list, err := ReadDir(dirname) if err != nil { t.Fatalf("ReadDir %s: %v", dirname, err) } -/* Does not work in gccgo testing environment. foundFile := false foundSubDir := false for _, dir := range list { @@ -94,5 +94,5 @@ func TestReadDir(t *testing.T) { if !foundSubDir { t.Fatalf("ReadDir %s: ioutil directory not found", dirname) } -*/ + */ } diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go index 07cc0f5ba40..a3c56585ce7 100644 --- a/libgo/go/reflect/type.go +++ b/libgo/go/reflect/type.go @@ -243,7 +243,7 @@ type commonType struct { align int8 fieldAlign uint8 size uintptr - hash uint32 + hash uint32 hashfn func(unsafe.Pointer, uintptr) equalfn func(unsafe.Pointer, unsafe.Pointer, uintptr) string *string @@ -464,7 +464,7 @@ func (t *uncommonType) Method(i int) (m Method) { m.Type = mt.toType() x := new(unsafe.Pointer) *x = p.tfn - m.Func = Value{mt, unsafe.Pointer(x), fl|flagIndir} + m.Func = Value{mt, unsafe.Pointer(x), fl | flagIndir} m.Index = i return } @@ -999,10 +999,8 @@ func (ct *commonType) ptrTo() *commonType { return &p.commonType } - rt := (*runtime.Type)(unsafe.Pointer(ct)) - rp := new(runtime.PtrType) - + // initialize p using *byte's ptrType as a prototype. // have to do assignment as ptrType, not runtime.PtrType, // in order to write to unexported fields. diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index f9a3c8a23c5..a1bc3342620 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -215,8 +215,8 @@ type emptyInterface struct { type nonEmptyInterface struct { // see ../runtime/iface.c:/Itab itab *struct { - typ *runtime.Type // dynamic concrete type - fun [100000]unsafe.Pointer // method table + typ *runtime.Type // dynamic concrete type + fun [100000]unsafe.Pointer // method table } word iword } @@ -448,7 +448,6 @@ func (v Value) call(method string, in []Value) []Value { nin++ } params := make([]unsafe.Pointer, nin) - delta := 0 off := 0 if v.flag&flagMethod != 0 { // Hard-wired first argument. @@ -517,7 +516,7 @@ func isMethod(t *commonType) bool { params++ } else if c == ')' { parens-- - } else if parens == 0 && c == ' ' && s[i + 1] != '(' && !sawRet { + } else if parens == 0 && c == ' ' && s[i+1] != '(' && !sawRet { params++ sawRet = true } @@ -1627,7 +1626,7 @@ func MakeChan(typ Type, buffer int) Value { panic("reflect.MakeChan: unidirectional channel type") } ch := makechan(typ.runtimeType(), uint32(buffer)) - return Value{typ.common(), unsafe.Pointer(ch), flagIndir | (flag(Chan)<<flagKindShift)} + return Value{typ.common(), unsafe.Pointer(ch), flagIndir | (flag(Chan) << flagKindShift)} } // MakeMap creates a new map of the specified type. @@ -1636,7 +1635,7 @@ func MakeMap(typ Type) Value { panic("reflect.MakeMap of non-map type") } m := makemap(typ.runtimeType()) - return Value{typ.common(), unsafe.Pointer(m), flagIndir | (flag(Map)<<flagKindShift)} + return Value{typ.common(), unsafe.Pointer(m), flagIndir | (flag(Map) << flagKindShift)} } // Indirect returns the value that v points to. |