• Russ Cox's avatar
    cmd/gc: avoid use of goprintf · 5e568545
    Russ Cox authored
    goprintf is a printf-like print for Go.
    It is used in the code generated by 'defer print(...)' and 'go print(...)'.
    
    Normally print(1, 2, 3) turns into
    
            printint(1)
            printint(2)
            printint(3)
    
    but defer and go need a single function call to give the runtime;
    they give the runtime something like goprintf("%d%d%d", 1, 2, 3).
    
    Variadic functions like goprintf cannot be described in the new
    type information world, so we have to replace it.
    
    Replace with a custom function, so that defer print(1, 2, 3) turns
    into
    
            defer func(a1, a2, a3 int) {
                    print(a1, a2, a3)
            }(1, 2, 3)
    
    (and then the print becomes three different printints as usual).
    
    Fixes #8614.
    
    LGTM=austin
    R=austin
    CC=golang-codereviews, r
    https://golang.org/cl/159700043
    5e568545
builtin.c 9.46 KB