github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/test/issue6506.go (about)

     1  // Copyright 2013 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package cgotest
     6  
     7  // Test handling of size_t in the face of incorrect clang debug information.
     8  // golang.org/issue/6506.
     9  
    10  /*
    11  #include <stdlib.h>
    12  #include <string.h>
    13  */
    14  import "C"
    15  
    16  func test6506() {
    17  	// nothing to run, just make sure this compiles
    18  	var x C.size_t
    19  
    20  	C.calloc(x, x)
    21  	C.malloc(x)
    22  	C.realloc(nil, x)
    23  	C.memcpy(nil, nil, x)
    24  	C.memcmp(nil, nil, x)
    25  	C.memmove(nil, nil, x)
    26  	C.strncpy(nil, nil, x)
    27  	C.strncmp(nil, nil, x)
    28  	C.strncat(nil, nil, x)
    29  	x = C.strxfrm(nil, nil, x)
    30  	C.memchr(nil, 0, x)
    31  	x = C.strcspn(nil, nil)
    32  	x = C.strspn(nil, nil)
    33  	C.memset(nil, 0, x)
    34  	x = C.strlen(nil)
    35  	_ = x
    36  }