Commit f6d0aded authored by Russ Cox's avatar Russ Cox

build: remove dead code

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7877045
parent f29b0911
...@@ -48,7 +48,6 @@ func parseMetaGoImports(r io.Reader) (imports []metaImport) { ...@@ -48,7 +48,6 @@ func parseMetaGoImports(r io.Reader) (imports []metaImport) {
}) })
} }
} }
return
} }
// attrValue returns the attribute value for the case-insensitive key // attrValue returns the attribute value for the case-insensitive key
......
...@@ -3164,7 +3164,6 @@ func ungetrune(f *bufio.Reader, c rune) { ...@@ -3164,7 +3164,6 @@ func ungetrune(f *bufio.Reader, c rune) {
func write(f *bufio.Writer, b []byte, n int) int { func write(f *bufio.Writer, b []byte, n int) int {
panic("write") panic("write")
return 0
} }
func open(s string) *bufio.Reader { func open(s string) *bufio.Reader {
......
...@@ -640,7 +640,6 @@ func (f *decompressor) huffSym(h *huffmanDecoder) (int, error) { ...@@ -640,7 +640,6 @@ func (f *decompressor) huffSym(h *huffmanDecoder) (int, error) {
return int(chunk >> huffmanValueShift), nil return int(chunk >> huffmanValueShift), nil
} }
} }
return 0, CorruptInputError(f.roffset)
} }
// Flush any buffered output to the underlying writer. // Flush any buffered output to the underlying writer.
......
...@@ -120,7 +120,6 @@ func (z *Reader) readString() (string, error) { ...@@ -120,7 +120,6 @@ func (z *Reader) readString() (string, error) {
return string(z.buf[0:i]), nil return string(z.buf[0:i]), nil
} }
} }
panic("not reached")
} }
func (z *Reader) read2() (uint32, error) { func (z *Reader) read2() (uint32, error) {
......
...@@ -202,7 +202,6 @@ func (d *decoder) decode() { ...@@ -202,7 +202,6 @@ func (d *decoder) decode() {
return return
} }
} }
panic("unreachable")
} }
func (d *decoder) flush() { func (d *decoder) flush() {
......
...@@ -63,8 +63,9 @@ func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) { ...@@ -63,8 +63,9 @@ func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) {
} }
func TestParameterGeneration(t *testing.T) { func TestParameterGeneration(t *testing.T) {
// This test is too slow to run all the time. if testing.Short() {
return t.Skip("skipping parameter generation test in short mode")
}
testParameterGeneration(t, L1024N160, 1024, 160) testParameterGeneration(t, L1024N160, 1024, 160)
testParameterGeneration(t, L2048N224, 2048, 224) testParameterGeneration(t, L2048N224, 2048, 224)
......
...@@ -98,8 +98,6 @@ func Prime(rand io.Reader, bits int) (p *big.Int, err error) { ...@@ -98,8 +98,6 @@ func Prime(rand io.Reader, bits int) (p *big.Int, err error) {
return return
} }
} }
return
} }
// Int returns a uniform random value in [0, max). // Int returns a uniform random value in [0, max).
...@@ -130,6 +128,4 @@ func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) { ...@@ -130,6 +128,4 @@ func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) {
return return
} }
} }
return
} }
...@@ -460,7 +460,6 @@ func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameter ...@@ -460,7 +460,6 @@ func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameter
default: default:
return marshalUTF8String(out, v.String()) return marshalUTF8String(out, v.String())
} }
return
} }
return StructuralError{"unknown Go type"} return StructuralError{"unknown Go type"}
......
...@@ -212,7 +212,6 @@ func (r *Reader) skip(delim rune) error { ...@@ -212,7 +212,6 @@ func (r *Reader) skip(delim rune) error {
return nil return nil
} }
} }
panic("unreachable")
} }
// parseRecord reads and parses a single csv record from r. // parseRecord reads and parses a single csv record from r.
...@@ -249,7 +248,6 @@ func (r *Reader) parseRecord() (fields []string, err error) { ...@@ -249,7 +248,6 @@ func (r *Reader) parseRecord() (fields []string, err error) {
return nil, err return nil, err
} }
} }
panic("unreachable")
} }
// parseField parses the next field in the record. The read field is // parseField parses the next field in the record. The read field is
......
...@@ -1066,7 +1066,6 @@ func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId, inProgress map[re ...@@ -1066,7 +1066,6 @@ func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId, inProgress map[re
case reflect.Struct: case reflect.Struct:
return true return true
} }
return true
} }
// typeString returns a human-readable description of the type identified by remoteId. // typeString returns a human-readable description of the type identified by remoteId.
......
...@@ -526,7 +526,6 @@ func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, err ...@@ -526,7 +526,6 @@ func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, err
default: default:
return nil, errors.New("gob NewTypeObject can't handle type: " + rt.String()) return nil, errors.New("gob NewTypeObject can't handle type: " + rt.String())
} }
return nil, nil
} }
// isExported reports whether this is an exported - upper case - name. // isExported reports whether this is an exported - upper case - name.
......
...@@ -868,7 +868,6 @@ func (d *decodeState) literalInterface() interface{} { ...@@ -868,7 +868,6 @@ func (d *decodeState) literalInterface() interface{} {
} }
return n return n
} }
panic("unreachable")
} }
// getu4 decodes \uXXXX from the beginning of s, returning the hex value, // getu4 decodes \uXXXX from the beginning of s, returning the hex value,
......
...@@ -429,7 +429,6 @@ func tCSS(c context, s []byte) (context, int) { ...@@ -429,7 +429,6 @@ func tCSS(c context, s []byte) (context, int) {
} }
k = i + 1 k = i + 1
} }
panic("unreachable")
} }
// tCSSStr is the context transition function for the CSS string and URL states. // tCSSStr is the context transition function for the CSS string and URL states.
...@@ -470,7 +469,6 @@ func tCSSStr(c context, s []byte) (context, int) { ...@@ -470,7 +469,6 @@ func tCSSStr(c context, s []byte) (context, int) {
c, _ = tURL(c, decodeCSS(s[:i+1])) c, _ = tURL(c, decodeCSS(s[:i+1]))
k = i + 1 k = i + 1
} }
panic("unreachable")
} }
// tError is the context transition function for the error state. // tError is the context transition function for the error state.
......
...@@ -1021,8 +1021,6 @@ func trailingZeroBits(x Word) uint { ...@@ -1021,8 +1021,6 @@ func trailingZeroBits(x Word) uint {
default: default:
panic("unknown word size") panic("unknown word size")
} }
return 0
} }
// trailingZeroBits returns the number of consecutive least significant zero // trailingZeroBits returns the number of consecutive least significant zero
......
...@@ -202,7 +202,6 @@ func (m *maxLatencyWriter) flushLoop() { ...@@ -202,7 +202,6 @@ func (m *maxLatencyWriter) flushLoop() {
m.lk.Unlock() m.lk.Unlock()
} }
} }
panic("unreached")
} }
func (m *maxLatencyWriter) stop() { m.done <- true } func (m *maxLatencyWriter) stop() { m.done <- true }
...@@ -222,7 +222,6 @@ func (ip IP) DefaultMask() IPMask { ...@@ -222,7 +222,6 @@ func (ip IP) DefaultMask() IPMask {
default: default:
return classCMask return classCMask
} }
return nil // not reached
} }
func allFF(b []byte) bool { func allFF(b []byte) bool {
......
...@@ -99,7 +99,6 @@ func sotypeToNet(sotype int) string { ...@@ -99,7 +99,6 @@ func sotypeToNet(sotype int) string {
default: default:
panic("sotypeToNet unknown socket type") panic("sotypeToNet unknown socket type")
} }
return ""
} }
// UnixConn is an implementation of the Conn interface for connections // UnixConn is an implementation of the Conn interface for connections
......
...@@ -46,8 +46,6 @@ func Readlink(name string) (string, error) { ...@@ -46,8 +46,6 @@ func Readlink(name string) (string, error) {
return string(b[0:n]), nil return string(b[0:n]), nil
} }
} }
// Silence 6g.
return "", nil
} }
// Rename renames a file. // Rename renames a file.
......
...@@ -90,8 +90,6 @@ func Getwd() (pwd string, err error) { ...@@ -90,8 +90,6 @@ func Getwd() (pwd string, err error) {
} }
} }
} }
fd.Close()
return "", ErrNotExist
Found: Found:
pd, err := fd.Stat() pd, err := fd.Stat()
......
...@@ -92,5 +92,4 @@ func valueToString(val Value) string { ...@@ -92,5 +92,4 @@ func valueToString(val Value) string {
default: default:
panic("valueToString: can't print type " + typ.String()) panic("valueToString: can't print type " + typ.String())
} }
return "valueToString: can't happen"
} }
...@@ -636,7 +636,6 @@ func (f *extFloat) ShortestDecimal(d *decimalSlice, lower, upper *extFloat) bool ...@@ -636,7 +636,6 @@ func (f *extFloat) ShortestDecimal(d *decimalSlice, lower, upper *extFloat) bool
1<<shift, multiplier*2) 1<<shift, multiplier*2)
} }
} }
return false
} }
// adjustLastDigit modifies d = x-currentDiff*ε, to get closest to // adjustLastDigit modifies d = x-currentDiff*ε, to get closest to
......
...@@ -215,11 +215,6 @@ childerror: ...@@ -215,11 +215,6 @@ childerror:
for { for {
RawSyscall(SYS_EXIT, 253, 0, 0) RawSyscall(SYS_EXIT, 253, 0, 0)
} }
// Calling panic is not actually safe,
// but the for loop above won't break
// and this shuts up the compiler.
panic("unreached")
} }
// Try to open a pipe with O_CLOEXEC set on both file descriptors. // Try to open a pipe with O_CLOEXEC set on both file descriptors.
......
...@@ -140,8 +140,6 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) { ...@@ -140,8 +140,6 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) {
default: default:
return reflect.Value{}, false return reflect.Value{}, false
} }
return
} }
// A Config structure contains options for running a test. // A Config structure contains options for running a test.
......
...@@ -429,7 +429,6 @@ func (t *Tree) pipeline(context string) (pipe *PipeNode) { ...@@ -429,7 +429,6 @@ func (t *Tree) pipeline(context string) (pipe *PipeNode) {
t.unexpected(token, context) t.unexpected(token, context)
} }
} }
return
} }
func (t *Tree) parseControl(context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) { func (t *Tree) parseControl(context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment