]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: return 0 from C function in test
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 27 Nov 2020 19:45:15 +0000 (20:45 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 27 Nov 2020 20:31:33 +0000 (20:31 +0000)
This function's prototype includes a return value, so return a value.
Otherwise clang gets upset:

    --- FAIL: TestDLLPreloadMitigation (1.40s)
        syscall_windows_test.go:986: failed to build dll: exit status 1 - nojack.c:7:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
            }
            ^
            1 error generated.

Fixes #42860.

Change-Id: I65b8eb9ccb502692c5b65bd34829f331cd86eef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/273726
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/syscall_windows_test.go

index 3827c6ed83fd5557dee57ddb752284b3d851b067..a20573eb6af6b17ea6581ca5c3202d4697f31414 100644 (file)
@@ -969,8 +969,9 @@ func TestDLLPreloadMitigation(t *testing.T) {
 #include <stdint.h>
 #include <windows.h>
 
-uintptr_t cfunc() {
+uintptr_t cfunc(void) {
    SetLastError(123);
+   return 0;
 }
 `
        srcname := "nojack.c"