From 3f1954175231156ce57a67938a58511e242c2213 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Thu, 18 Dec 2014 16:30:46 +1100 Subject: [PATCH] runtime: use go generate for zcallback_windows.go replacement for CL 180640043 Change-Id: I8ff36645cfcbbda338faf7b29cbfdb95c47d5ec4 Reviewed-on: https://go-review.googlesource.com/1765 Reviewed-by: Brad Fitzpatrick --- src/runtime/runtime2_windows.go | 8 -------- src/runtime/wincallback.go | 23 ++++++++++++++++++++++- src/runtime/zcallback_windows.go | 5 +++++ 3 files changed, 27 insertions(+), 9 deletions(-) delete mode 100644 src/runtime/runtime2_windows.go create mode 100644 src/runtime/zcallback_windows.go diff --git a/src/runtime/runtime2_windows.go b/src/runtime/runtime2_windows.go deleted file mode 100644 index 80fc386e952..00000000000 --- a/src/runtime/runtime2_windows.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2009 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. - -package runtime - -// TODO(brainman): move generation of zsys_windows_*.s out from cmd/dist/buildruntime.c and into here -const cb_max = 2000 // maximum number of windows callbacks allowed (must be in sync with MAXWINCB from cmd/dist/buildruntime.c) diff --git a/src/runtime/wincallback.go b/src/runtime/wincallback.go index 4c0daf17c08..a16ad21cd53 100644 --- a/src/runtime/wincallback.go +++ b/src/runtime/wincallback.go @@ -17,7 +17,7 @@ import ( const maxCallback = 2000 -func main() { +func genasm() { var buf bytes.Buffer buf.WriteString(`// generated by wincallback.go; run go generate @@ -41,3 +41,24 @@ TEXT runtime·callbackasm(SB),7,$0 os.Exit(2) } } + +func gengo() { + var buf bytes.Buffer + + buf.WriteString(fmt.Sprintf(`// generated by wincallback.go; run go generate + +package runtime + +const cb_max = %d // maximum number of windows callbacks allowed +`, maxCallback)) + err := ioutil.WriteFile("zcallback_windows.go", buf.Bytes(), 0666) + if err != nil { + fmt.Fprintf(os.Stderr, "wincallback: %s\n", err) + os.Exit(2) + } +} + +func main() { + genasm() + gengo() +} diff --git a/src/runtime/zcallback_windows.go b/src/runtime/zcallback_windows.go new file mode 100644 index 00000000000..9908d4ec237 --- /dev/null +++ b/src/runtime/zcallback_windows.go @@ -0,0 +1,5 @@ +// generated by wincallback.go; run go generate + +package runtime + +const cb_max = 2000 // maximum number of windows callbacks allowed