aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-01-23 23:55:31 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-01-23 23:55:31 +0000
commitb1b3aec1b1e26c22791f21d971a851af4df2dad2 (patch)
treeed963d480affb07d364c84b0b56a97f7bb92427b /libgo
parent8bae34da8a4625767bc7e1caab295855963ff280 (diff)
downloadgcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.zip
gcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.tar.gz
gcc-b1b3aec1b1e26c22791f21d971a851af4df2dad2.tar.bz2
compiler: Give an error if a variable is defined but not used.
From-SVN: r183458
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/io/ioutil/ioutil_test.go4
-rw-r--r--libgo/go/reflect/type.go8
-rw-r--r--libgo/go/reflect/value.go11
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 1030668..70f83c9 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 07cc0f5..a3c5658 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 f9a3c8a..a1bc334 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.