type File struct{}
-func Open(name string) (file *File, err error)
+func Open(name string) (file *File, err error) {
+ // OMIT
+ panic(1)
+ // STOP OMIT
+}
func openFile() { // OMIT
f, err := os.Open("filename.ext")
if(argc < 1)
usage();
- // special flag to detect compilation of package runtime
- compiling_runtime = debug['+'];
+ // special flags used during build.
+ compiling_runtime = debug['+']; // detect compilation of package runtime
+ pure_go = debug['=']; // package is completely go (no C or assembly)
pathname = mal(1000);
if(getwd(pathname, 999) == 0)
throwreturn = sysfunc("throwreturn");
}
- if(fn->nbody == nil)
- return;
+ lno = setlineno(fn);
+
+ if(fn->nbody == nil) {
+ if(pure_go || memcmp(fn->nname->sym->name, "init·", 6) == 0)
+ yyerror("missing function body", fn);
+ goto ret;
+ }
saveerrors();
// set up domain for labels
clearlabels();
- lno = setlineno(fn);
-
curfn = fn;
dowidth(curfn->type);
return tool(archChar + "l")
}
+var rsc = flag.Bool("rsc", false, "rsc")
+
func (gcToolchain) gc(b *builder, p *Package, obj string, importArgs []string, gofiles []string) (ofile string, err error) {
out := "_go_." + archChar
ofile = obj + out
gcargs = append(gcargs, "-+")
}
+ // If we're giving the compiler the entire package (no C etc files), tell it that,
+ // so that it can give good error messages about forward declarations.
+ // Exceptions: a few standard packages have forward declarations for
+ // pieces supplied behind-the-scenes by package runtime.
+ extFiles := len(p.CgoFiles) + len(p.CFiles) + len(p.SFiles) + len(p.SysoFiles) + len(p.SwigFiles) + len(p.SwigCXXFiles)
+ if p.Standard {
+ switch p.ImportPath {
+ case "os", "runtime/pprof", "sync", "time":
+ extFiles++
+ }
+ }
+ if extFiles == 0 {
+ gcargs = append(gcargs, "-=")
+ }
+
args := stringList(tool(archChar+"g"), "-o", ofile, buildGcflags, gcargs, "-D", p.localPrefix, importArgs)
for _, f := range gofiles {
args = append(args, mkAbs(p.Dir, f))