--- /dev/null
+// Copyright 2015 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 main
+
+// #include <stdio.h>
+import "C"
+
+func main() {
+ _ = C.fopen() // ERROR HERE
+}
// each pointer argument x with _cgoCheckPointer(x).(T).
func (p *Package) rewriteCall(f *File, call *ast.CallExpr, name *Name) {
for i, param := range name.FuncType.Params {
+ if len(call.Args) <= i {
+ // Avoid a crash; this will be caught when the
+ // generated file is compiled.
+ return
+ }
+
// An untyped nil does not need a pointer check, and
// when _cgoCheckPointer returns the untyped nil the
// type assertion we are going to insert will fail.
continue
}
- if len(call.Args) <= i {
- // Avoid a crash; this will be caught when the
- // generated file is compiled.
- return
- }
-
c := &ast.CallExpr{
Fun: ast.NewIdent("_cgoCheckPointer"),
Args: []ast.Expr{