[bootstrap-O3] add a default initializer to avoid a warning at -O3
[official-gcc.git] / libgo / runtime / go-main.c
blobdba808526038b22b331992c0910b017842e761b8
1 /* go-main.c -- the main function for a Go program.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #include "config.h"
9 #include <stdlib.h>
10 #include <time.h>
11 #include <unistd.h>
13 #ifdef HAVE_FPU_CONTROL_H
14 #include <fpu_control.h>
15 #endif
17 #include "runtime.h"
18 #include "array.h"
19 #include "arch.h"
20 #include "malloc.h"
22 #undef int
23 #undef char
24 #undef unsigned
26 /* The main function for a Go program. This records the command line
27 parameters, calls the real main function, and returns a zero status
28 if the real main function returns. */
30 extern char **environ;
32 /* A copy of _end that a shared library can reasonably refer to. */
33 uintptr __go_end;
35 extern byte _end[];
37 /* The main function. */
39 int
40 main (int argc, char **argv)
42 runtime_isarchive = false;
44 if (runtime_isstarted)
45 return 0;
46 runtime_isstarted = true;
48 if (runtime_iscgo)
49 setIsCgo ();
51 __go_end = (uintptr)_end;
52 runtime_cpuinit ();
53 runtime_check ();
54 runtime_args (argc, (byte **) argv);
55 runtime_osinit ();
56 runtime_schedinit ();
57 __go_go (runtime_main, NULL);
58 runtime_mstart (runtime_m ());
59 abort ();