front-end can use a different main().
* main.c: New.
* toplev.c: (main): Rename as toplev_main.
* toplev.h: Declare toplev_main.
* Makefile.in (OBJS): add toplev.o.
(BACKEND): remove toplev.o, add main.o.
From-SVN: r40247
+2001-03-05 Fergus Henderson <fjh@cs.mu.oz.au>
+
+ Put main() in a separate file, so that the language
+ front-end can use a different main().
+
+ * main.c: New.
+ * toplev.c: (main): Rename as toplev_main.
+ * toplev.h: Declare toplev_main.
+ * Makefile.in (OBJS): add toplev.o.
+ (BACKEND): remove toplev.o, add main.o.
+
2001-03-04 Neil Booth <neil@daikokuya.demon.co.uk>
* cppfiles.c (search_from): Special case the empty string.
recog.o reg-stack.o regclass.o regmove.o regrename.o reload.o \
reload1.o reorg.o resource.o rtl.o rtlanal.o sbitmap.o sched-deps.o \
sched-ebb.o sched-rgn.o sched-vis.o sdbout.o sibcall.o simplify-rtx.o \
- splay-tree.o ssa.o stmt.o stor-layout.o stringpool.o timevar.o tree.o \
- unroll.o varasm.o varray.o version.o xcoffout.o \
+ splay-tree.o ssa.o stmt.o stor-layout.o stringpool.o timevar.o \
+ toplev.o tree.o unroll.o varasm.o varray.o version.o xcoffout.o \
$(GGC) $(out_object_file) $(EXTRA_OBJS)
-BACKEND = toplev.o libbackend.a
+BACKEND = main.o libbackend.a
# GEN files are listed separately, so they can be built before doing parallel
# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
-DTARGET_NAME=\"$(target_alias)\" \
-c $(srcdir)/toplev.c
+main.o : main.c toplev.h
rtl.o : rtl.c $(GCONFIG_H) system.h $(RTL_H) bitmap.h $(GGC_H) toplev.h
$(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
--- /dev/null
+/* main.c: defines main() for cc1, cc1plus, etc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "gansidecl.h"
+#include "toplev.h"
+
+int main PARAMS ((int argc, char **argv));
+
+/* We define main() to call toplev_main(), which is defined in toplev.c.
+ We do this in a separate file in order to allow the language front-end
+ to define a different main(), if it so desires. */
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ return toplev_main (argc, argv);
+}
const char *progname;
-/* Copy of arguments to main. */
+/* Copy of arguments to toplev_main. */
int save_argc;
char **save_argv;
\f
return 1;
}
\f
-/* Entry point of cc1/c++. Decode command args, then call compile_file.
- Exit code is 35 if can't open files, 34 if fatal error,
- 33 if had nonfatal errors, else success. */
-
-extern int main PARAMS ((int, char **));
+/* Entry point of cc1, cc1plus, jc1, f771, etc.
+ Decode command args, then call compile_file.
+ Exit code is FATAL_EXIT_CODE if can't open files or if there were
+ any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
+
+ It is not safe to call this function more than once. */
int
-main (argc, argv)
+toplev_main (argc, argv)
int argc;
char **argv;
{
#define skip_leading_substring(whole, part) \
(strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
+extern int toplev_main PARAMS ((int argc, char **argv));
extern int read_integral_parameter PARAMS ((const char *, const char *,
const int));
extern int count_error PARAMS ((int));