Commit 79a4a779 authored by Alex Brainman's avatar Alex Brainman

syscall: clean up TestStdcallAndCDeclCallbacks to have no warnings

Fixes #9188

Change-Id: Ifbf5d9fa78a4f4ceb7f92d42494fe37fa7878c45
Reviewed-on: https://go-review.googlesource.com/1930Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent bc611a31
...@@ -271,7 +271,7 @@ func (f cbDLLFunc) buildOne(stdcall bool) string { ...@@ -271,7 +271,7 @@ func (f cbDLLFunc) buildOne(stdcall bool) string {
typename := "t" + funcname typename := "t" + funcname
p := make([]string, f) p := make([]string, f)
for i := range p { for i := range p {
p[i] = "void*" p[i] = "uintptr_t"
} }
params := strings.Join(p, ",") params := strings.Join(p, ",")
for i := range p { for i := range p {
...@@ -280,9 +280,9 @@ func (f cbDLLFunc) buildOne(stdcall bool) string { ...@@ -280,9 +280,9 @@ func (f cbDLLFunc) buildOne(stdcall bool) string {
args := strings.Join(p, ",") args := strings.Join(p, ",")
return fmt.Sprintf(` return fmt.Sprintf(`
typedef void %s (*%s)(%s); typedef void %s (*%s)(%s);
void %s(%s f, void *n) { void %s(%s f, uintptr_t n) {
int i; uintptr_t i;
for(i=0;i<(int)n;i++){ for(i=0;i<n;i++){
f(%s); f(%s);
} }
} }
...@@ -290,7 +290,7 @@ void %s(%s f, void *n) { ...@@ -290,7 +290,7 @@ void %s(%s f, void *n) {
} }
func (f cbDLLFunc) build() string { func (f cbDLLFunc) build() string {
return f.buildOne(false) + f.buildOne(true) return "#include <stdint.h>\n\n" + f.buildOne(false) + f.buildOne(true)
} }
var cbFuncs = [...]interface{}{ var cbFuncs = [...]interface{}{
...@@ -379,13 +379,13 @@ var cbDLLs = []cbDLL{ ...@@ -379,13 +379,13 @@ var cbDLLs = []cbDLL{
{ {
"test", "test",
func(out, src string) []string { func(out, src string) []string {
return []string{"gcc", "-shared", "-s", "-o", out, src} return []string{"gcc", "-shared", "-s", "-Werror", "-o", out, src}
}, },
}, },
{ {
"testO2", "testO2",
func(out, src string) []string { func(out, src string) []string {
return []string{"gcc", "-shared", "-s", "-o", out, "-O2", src} return []string{"gcc", "-shared", "-s", "-Werror", "-o", out, "-O2", src}
}, },
}, },
} }
......
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