diff options
author | Russ Cox <rsc@golang.org> | 2013-10-15 12:46:14 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-10-15 12:46:14 -0400 |
commit | b966f7f8b8a09f0ce55458ba6030fc021cb2eb93 (patch) | |
tree | 9d199899b50b68a10abb9eaa8f588be13a369928 /misc | |
parent | e7b50aa9a9ce02e13e0521dbed948eb94e4de3a4 (diff) | |
download | go-b966f7f8b8a09f0ce55458ba6030fc021cb2eb93.tar.gz |
cmd/cgo: work around bug in clang debug info for builtins like memset
Fixes issue 6506.
R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/14682044
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/test/issue6506.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/misc/cgo/test/issue6506.go b/misc/cgo/test/issue6506.go new file mode 100644 index 000000000..e2a733206 --- /dev/null +++ b/misc/cgo/test/issue6506.go @@ -0,0 +1,52 @@ +// 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. + +package cgotest + +// Test handling of size_t in the face of incorrect clang debug information. +// golang.org/issue/6506. + +/* +#include <stdlib.h> +#include <string.h> + +// These functions are clang builtins but not standard on other systems. +// Give them prototypes so that this test can be compiled on other systems. +// One of the great things about this bug is that even with these prototypes +// clang still generates the wrong debug information. + +void bzero(void*, size_t); +int bcmp(const void*, const void*, size_t); +int strncasecmp(const char*, const char*, size_t n); +size_t strlcpy(char*, const char*, size_t); +size_t strlcat(char*, const char*, size_t); +*/ +import "C" + +func test6506() { + // nothing to run, just make sure this compiles + var x C.size_t + + C.calloc(x, x) + C.malloc(x) + C.realloc(nil, x) + C.memcpy(nil, nil, x) + C.memcmp(nil, nil, x) + C.memmove(nil, nil, x) + C.strncpy(nil, nil, x) + C.strncmp(nil, nil, x) + C.strncat(nil, nil, x) + x = C.strxfrm(nil, nil, x) + C.memchr(nil, 0, x) + x = C.strcspn(nil, nil) + x = C.strspn(nil, nil) + C.memset(nil, 0, x) + x = C.strlen(nil) + C.alloca(x) + C.bzero(nil, x) + C.strncasecmp(nil, nil, x) + x = C.strlcpy(nil, nil, x) + x = C.strlcat(nil, nil, x) + _ = x +} |