]> Cypherpunks repositories - gostls13.git/commitdiff
all: switch to the new deprecation convention
authorShenghou Ma <minux@golang.org>
Mon, 18 May 2015 19:50:00 +0000 (15:50 -0400)
committerMinux Ma <minux@golang.org>
Thu, 18 Jun 2015 19:16:23 +0000 (19:16 +0000)
While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
12 files changed:
src/archive/zip/struct.go
src/cmd/internal/obj/textflag.go
src/cmd/link/internal/ld/objfile.go
src/cmd/link/internal/ld/textflag.go
src/go/doc/doc.go
src/image/jpeg/reader.go
src/runtime/debug/stack.go
src/syscall/exec_plan9.go
src/syscall/exec_unix.go
src/syscall/syscall.go
src/syscall/syscall_windows.go
src/text/template/parse/node.go

index 793d5da48de067e6a710c614964282be6d724d54..137d0495fd993439b32cc151a67be54017cb6270 100644 (file)
@@ -81,8 +81,8 @@ type FileHeader struct {
        ModifiedTime       uint16 // MS-DOS time
        ModifiedDate       uint16 // MS-DOS date
        CRC32              uint32
-       CompressedSize     uint32 // deprecated; use CompressedSize64
-       UncompressedSize   uint32 // deprecated; use UncompressedSize64
+       CompressedSize     uint32 // Deprecated: Use CompressedSize64 instead.
+       UncompressedSize   uint32 // Deprecated: Use UncompressedSize64 instead.
        CompressedSize64   uint64
        UncompressedSize64 uint64
        Extra              []byte
index b5d27a60ee18c4a5904ff776db4a20d944363a54..dbd1bc8a7b2e998e4e897d1b7fd49fea2e8fdd2e 100644 (file)
@@ -9,7 +9,9 @@
 package obj
 
 const (
-       // Don't profile the marked routine.  This flag is deprecated.
+       // Don't profile the marked routine.
+       //
+       // Deprecated: Not implemented, do not use.
        NOPROF = 1
 
        // It is ok for the linker to get multiple of these symbols.  It will
index 613fcb2a40c39de19a9b273a91ba37382712dbe3..f716ea43bbee50e53915df67f1c74d1ef8b000e4 100644 (file)
@@ -4,6 +4,102 @@
 
 package ld
 
+// Writing and reading of Go object files.
+//
+// Originally, Go object files were Plan 9 object files, but no longer.
+// Now they are more like standard object files, in that each symbol is defined
+// by an associated memory image (bytes) and a list of relocations to apply
+// during linking. We do not (yet?) use a standard file format, however.
+// For now, the format is chosen to be as simple as possible to read and write.
+// It may change for reasons of efficiency, or we may even switch to a
+// standard file format if there are compelling benefits to doing so.
+// See golang.org/s/go13linker for more background.
+//
+// The file format is:
+//
+//     - magic header: "\x00\x00go13ld"
+//     - byte 1 - version number
+//     - sequence of strings giving dependencies (imported packages)
+//     - empty string (marks end of sequence)
+//     - sequence of defined symbols
+//     - byte 0xff (marks end of sequence)
+//     - magic footer: "\xff\xffgo13ld"
+//
+// All integers are stored in a zigzag varint format.
+// See golang.org/s/go12symtab for a definition.
+//
+// Data blocks and strings are both stored as an integer
+// followed by that many bytes.
+//
+// A symbol reference is a string name followed by a version.
+// An empty name corresponds to a nil LSym* pointer.
+//
+// Each symbol is laid out as the following fields (taken from LSym*):
+//
+//     - byte 0xfe (sanity check for synchronization)
+//     - type [int]
+//     - name [string]
+//     - version [int]
+//     - flags [int]
+//             1 dupok
+//     - size [int]
+//     - gotype [symbol reference]
+//     - p [data block]
+//     - nr [int]
+//     - r [nr relocations, sorted by off]
+//
+// If type == STEXT, there are a few more fields:
+//
+//     - args [int]
+//     - locals [int]
+//     - nosplit [int]
+//     - flags [int]
+//             1 leaf
+//             2 C function
+//     - nlocal [int]
+//     - local [nlocal automatics]
+//     - pcln [pcln table]
+//
+// Each relocation has the encoding:
+//
+//     - off [int]
+//     - siz [int]
+//     - type [int]
+//     - add [int]
+//     - xadd [int]
+//     - sym [symbol reference]
+//     - xsym [symbol reference]
+//
+// Each local has the encoding:
+//
+//     - asym [symbol reference]
+//     - offset [int]
+//     - type [int]
+//     - gotype [symbol reference]
+//
+// The pcln table has the encoding:
+//
+//     - pcsp [data block]
+//     - pcfile [data block]
+//     - pcline [data block]
+//     - npcdata [int]
+//     - pcdata [npcdata data blocks]
+//     - nfuncdata [int]
+//     - funcdata [nfuncdata symbol references]
+//     - funcdatasym [nfuncdata ints]
+//     - nfile [int]
+//     - file [nfile symbol references]
+//
+// The file layout and meaning of type integers are architecture-independent.
+//
+// TODO(rsc): The file format is good for a first pass but needs work.
+//     - There are SymID in the object file that should really just be strings.
+//     - The actual symbol memory images are interlaced with the symbol
+//       metadata. They should be separated, to reduce the I/O required to
+//       load just the metadata.
+//     - The symbol references should be shortened, either with a symbol
+//       table or by using a simple backward index to an earlier mentioned symbol.
+
 import (
        "bytes"
        "cmd/internal/obj"
index 335f20d21d19ef5e39bae6405faeb0fe64a8fef1..6457fda9ddb554c1fd4fd91d4ce6cd02aa54ba0a 100644 (file)
 
 package ld
 
-// Writing and reading of Go object files.
-//
-// Originally, Go object files were Plan 9 object files, but no longer.
-// Now they are more like standard object files, in that each symbol is defined
-// by an associated memory image (bytes) and a list of relocations to apply
-// during linking. We do not (yet?) use a standard file format, however.
-// For now, the format is chosen to be as simple as possible to read and write.
-// It may change for reasons of efficiency, or we may even switch to a
-// standard file format if there are compelling benefits to doing so.
-// See golang.org/s/go13linker for more background.
-//
-// The file format is:
-//
-//     - magic header: "\x00\x00go13ld"
-//     - byte 1 - version number
-//     - sequence of strings giving dependencies (imported packages)
-//     - empty string (marks end of sequence)
-//     - sequence of defined symbols
-//     - byte 0xff (marks end of sequence)
-//     - magic footer: "\xff\xffgo13ld"
-//
-// All integers are stored in a zigzag varint format.
-// See golang.org/s/go12symtab for a definition.
-//
-// Data blocks and strings are both stored as an integer
-// followed by that many bytes.
-//
-// A symbol reference is a string name followed by a version.
-// An empty name corresponds to a nil LSym* pointer.
-//
-// Each symbol is laid out as the following fields (taken from LSym*):
-//
-//     - byte 0xfe (sanity check for synchronization)
-//     - type [int]
-//     - name [string]
-//     - version [int]
-//     - flags [int]
-//             1 dupok
-//     - size [int]
-//     - gotype [symbol reference]
-//     - p [data block]
-//     - nr [int]
-//     - r [nr relocations, sorted by off]
-//
-// If type == STEXT, there are a few more fields:
-//
-//     - args [int]
-//     - locals [int]
-//     - nosplit [int]
-//     - flags [int]
-//             1 leaf
-//             2 C function
-//     - nlocal [int]
-//     - local [nlocal automatics]
-//     - pcln [pcln table]
-//
-// Each relocation has the encoding:
-//
-//     - off [int]
-//     - siz [int]
-//     - type [int]
-//     - add [int]
-//     - xadd [int]
-//     - sym [symbol reference]
-//     - xsym [symbol reference]
-//
-// Each local has the encoding:
-//
-//     - asym [symbol reference]
-//     - offset [int]
-//     - type [int]
-//     - gotype [symbol reference]
-//
-// The pcln table has the encoding:
-//
-//     - pcsp [data block]
-//     - pcfile [data block]
-//     - pcline [data block]
-//     - npcdata [int]
-//     - pcdata [npcdata data blocks]
-//     - nfuncdata [int]
-//     - funcdata [nfuncdata symbol references]
-//     - funcdatasym [nfuncdata ints]
-//     - nfile [int]
-//     - file [nfile symbol references]
-//
-// The file layout and meaning of type integers are architecture-independent.
-//
-// TODO(rsc): The file format is good for a first pass but needs work.
-//     - There are SymID in the object file that should really just be strings.
-//     - The actual symbol memory images are interlaced with the symbol
-//       metadata. They should be separated, to reduce the I/O required to
-//       load just the metadata.
-//     - The symbol references should be shortened, either with a symbol
-//       table or by using a simple backward index to an earlier mentioned symbol.
-
-// Copyright 2013 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.
-
 // This file defines flags attached to various functions
 // and data objects.  The compilers, assemblers, and linker must
 // all agree on these values.
 
-// Don't profile the marked routine.  This flag is deprecated.
-
-// It is ok for the linker to get multiple of these symbols.  It will
-// pick one of the duplicates to use.
-
-// Don't insert stack check preamble.
-
-// Put this data in a read-only section.
-
-// This data contains no pointers.
-
-// This is a wrapper function and should not count as disabling 'recover'.
-
-// This function uses its incoming context register.
 const (
-       NOPROF   = 1
-       DUPOK    = 2
-       NOSPLIT  = 4
-       RODATA   = 8
-       NOPTR    = 16
-       WRAPPER  = 32
+       // Don't profile the marked routine.
+       //
+       // Deprecated: Not implemented, do not use.
+       NOPROF = 1
+       // It is ok for the linker to get multiple of these symbols.  It will
+       // pick one of the duplicates to use.
+       DUPOK = 2
+       // Don't insert stack check preamble.
+       NOSPLIT = 4
+       // Put this data in a read-only section.
+       RODATA = 8
+       // This data contains no pointers.
+       NOPTR = 16
+       // This is a wrapper function and should not count as disabling 'recover'.
+       WRAPPER = 32
+       // This function uses its incoming context register.
        NEEDCTXT = 64
 )
index 4264940a0cd5ca20ff5a0d27d18f548f4ad6aa2d..3c3e28d48fb88dfb57a3bbd76a4142118b79e4f4 100644 (file)
@@ -18,7 +18,8 @@ type Package struct {
        Imports    []string
        Filenames  []string
        Notes      map[string][]*Note
-       // DEPRECATED. For backward compatibility Bugs is still populated,
+
+       // Deprecated: For backward compatibility Bugs is still populated,
        // but all new code should use Notes instead.
        Bugs []string
 
index 772953221940a3399cdcb9bc77b0eec1c5e97e05..0fe57006bb93ec6a275b84cbf9bdeb22fc147c3e 100644 (file)
@@ -89,7 +89,7 @@ var unzig = [blockSize]int{
        53, 60, 61, 54, 47, 55, 62, 63,
 }
 
-// Reader is deprecated.
+// Deprecated: Reader is deprecated.
 type Reader interface {
        io.ByteReader
        io.Reader
index c29b0a226a2b08c583a2f73827e3a324c14c69c3..ab12bffa6e5da817339149928101b4fb6f88ddbd 100644 (file)
@@ -31,7 +31,7 @@ func PrintStack() {
 // then attempts to discover, for Go functions, the calling function or
 // method and the text of the line containing the invocation.
 //
-// This function is deprecated. Use package runtime's Stack instead.
+// Deprecated: Use package runtime's Stack instead.
 func Stack() []byte {
        return stack()
 }
index ed358385b9c2080385070173b48cfe905f21710e..7a415fd31edbbd2511fd9a8019d95868aabd0f5b 100644 (file)
@@ -61,9 +61,11 @@ import (
 
 var ForkLock sync.RWMutex
 
-// StringSlicePtr is deprecated. Use SlicePtrFromStrings instead.
-// If any string contains a NUL byte this function panics instead
-// of returning an error.
+// StringSlicePtr converts a slice of strings to a slice of pointers
+// to NUL-terminated byte arrays. If any string contains a NUL byte
+// this function panics instead of returning an error.
+//
+// Deprecated: Use SlicePtrFromStrings instead.
 func StringSlicePtr(ss []string) []*byte {
        bb := make([]*byte, len(ss)+1)
        for i := 0; i < len(ss); i++ {
@@ -74,7 +76,7 @@ func StringSlicePtr(ss []string) []*byte {
 }
 
 // SlicePtrFromStrings converts a slice of strings to a slice of
-// pointers to NUL-terminated byte slices. If any string contains
+// pointers to NUL-terminated byte arrays. If any string contains
 // a NUL byte, it returns (nil, EINVAL).
 func SlicePtrFromStrings(ss []string) ([]*byte, error) {
        var err error
index 890bfdc2272caef6167188b084f90b729fc3c49c..565252cb4a98e731333928348bead8b93a5ca3e5 100644 (file)
@@ -63,9 +63,11 @@ import (
 
 var ForkLock sync.RWMutex
 
-// StringSlicePtr is deprecated. Use SlicePtrFromStrings instead.
-// If any string contains a NUL byte this function panics instead
-// of returning an error.
+// StringSlicePtr converts a slice of strings to a slice of pointers
+// to NUL-terminated byte arrays. If any string contains a NUL byte
+// this function panics instead of returning an error.
+//
+// Deprecated: Use SlicePtrFromStrings instead.
 func StringSlicePtr(ss []string) []*byte {
        bb := make([]*byte, len(ss)+1)
        for i := 0; i < len(ss); i++ {
@@ -76,7 +78,7 @@ func StringSlicePtr(ss []string) []*byte {
 }
 
 // SlicePtrFromStrings converts a slice of strings to a slice of
-// pointers to NUL-terminated byte slices. If any string contains
+// pointers to NUL-terminated byte arrays. If any string contains
 // a NUL byte, it returns (nil, EINVAL).
 func SlicePtrFromStrings(ss []string) ([]*byte, error) {
        var err error
index c7b0daab0f4e40fe61f036a941a6b6d0a47290b0..791bcbbb678c7bee7466b1216970efdbc7ea940d 100644 (file)
@@ -28,9 +28,11 @@ package syscall
 
 import "unsafe"
 
-// StringByteSlice is deprecated. Use ByteSliceFromString instead.
+// StringByteSlice converts a string to a NUL-terminated []byte,
 // If s contains a NUL byte this function panics instead of
 // returning an error.
+//
+// Deprecated: Use ByteSliceFromString instead.
 func StringByteSlice(s string) []byte {
        a, err := ByteSliceFromString(s)
        if err != nil {
@@ -53,9 +55,11 @@ func ByteSliceFromString(s string) ([]byte, error) {
        return a, nil
 }
 
-// StringBytePtr is deprecated. Use BytePtrFromString instead.
-// If s contains a NUL byte this function panics instead of
-// returning an error.
+// StringBytePtr returns a pointer to a NUL-terminated array of bytes.
+// If s contains a NUL byte this function panics instead of returning
+// an error.
+//
+// Deprecated: Use BytePtrFromString instead.
 func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] }
 
 // BytePtrFromString returns a pointer to a NUL-terminated array of
index 225946c03d1992d528fe8df39d3876589f214da7..23035ac3872f774f3d22bed63319b72edca9b6c3 100644 (file)
@@ -19,9 +19,11 @@ type Handle uintptr
 
 const InvalidHandle = ^Handle(0)
 
-// StringToUTF16 is deprecated. Use UTF16FromString instead.
-// If s contains a NUL byte this function panics instead of
-// returning an error.
+// StringToUTF16 returns the UTF-16 encoding of the UTF-8 string s,
+// with a terminating NUL added. If s contains a NUL byte this
+// function panics instead of returning an error.
+//
+// Deprecated: Use UTF16FromString instead.
 func StringToUTF16(s string) []uint16 {
        a, err := UTF16FromString(s)
        if err != nil {
@@ -54,9 +56,12 @@ func UTF16ToString(s []uint16) string {
        return string(utf16.Decode(s))
 }
 
-// StringToUTF16Ptr is deprecated. Use UTF16PtrFromString instead.
+// StringToUTF16Ptr returns pointer to the UTF-16 encoding of
+// the UTF-8 string s, with a terminating NUL added. If s
 // If s contains a NUL byte this function panics instead of
 // returning an error.
+//
+// Deprecated: Use UTF16PtrFromString instead.
 func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] }
 
 // UTF16PtrFromString returns pointer to the UTF-16 encoding of
index 728181baae798cc1af96d49e1b617ad16749bcc2..55ff46c17ab28e84875f70758cc41796651fa53e 100644 (file)
@@ -145,7 +145,7 @@ type PipeNode struct {
        NodeType
        Pos
        tr   *Tree
-       Line int             // The line number in the input (deprecated; kept for compatibility)
+       Line int             // The line number in the input. Deprecated: Kept for compatibility.
        Decl []*VariableNode // Variable declarations in lexical order.
        Cmds []*CommandNode  // The commands in lexical order.
 }
@@ -208,7 +208,7 @@ type ActionNode struct {
        NodeType
        Pos
        tr   *Tree
-       Line int       // The line number in the input (deprecated; kept for compatibility)
+       Line int       // The line number in the input. Deprecated: Kept for compatibility.
        Pipe *PipeNode // The pipeline in the action.
 }
 
@@ -701,7 +701,7 @@ type elseNode struct {
        NodeType
        Pos
        tr   *Tree
-       Line int // The line number in the input (deprecated; kept for compatibility)
+       Line int // The line number in the input. Deprecated: Kept for compatibility.
 }
 
 func (t *Tree) newElse(pos Pos, line int) *elseNode {
@@ -729,7 +729,7 @@ type BranchNode struct {
        NodeType
        Pos
        tr       *Tree
-       Line     int       // The line number in the input (deprecated; kept for compatibility)
+       Line     int       // The line number in the input. Deprecated: Kept for compatibility.
        Pipe     *PipeNode // The pipeline to be evaluated.
        List     *ListNode // What to execute if the value is non-empty.
        ElseList *ListNode // What to execute if the value is empty (nil if absent).
@@ -814,7 +814,7 @@ type TemplateNode struct {
        NodeType
        Pos
        tr   *Tree
-       Line int       // The line number in the input (deprecated; kept for compatibility)
+       Line int       // The line number in the input. Deprecated: Kept for compatibility.
        Name string    // The name of the template (unquoted).
        Pipe *PipeNode // The command to evaluate as dot for the template.
 }