From 9257393c20357f1f5c454d252da8089dcc22c1fd Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Mon, 13 Sep 1999 03:57:40 +0000 Subject: Makefile.in (gcc.o, [...]): Depend on gcc.h. * Makefile.in (gcc.o, gccspec.o, cppspec.o): Depend on gcc.h. * gcc.h: New file. (lang_specific_driver): Don't take a function pointer parameter. All callers changed. * gcc.c: Include gcc.h. (do_spec, fancy_abort,lang_specific_driver,lang_specific_pre_link, lang_specific_extra_outfiles, fatal): Don't declare. (multilib_defaults_raw): Constify. (read_specs): Call memset, rather than bzero. (main): Call return, not exit. (lookup_compiler): Call memcpy, not bcopy. (fatal): Make extern. * cppspec.c: Include gcc.h. (lang_specific_driver): Initialize variable `quote'. Constify a char*. All calls to the function pointer parameter now explicitly call `fatal'. * gccspec.c (lang_specific_driver): Include gcc.h. cp: * Make-lang.in (g++spec.o): Depend on system.h and gcc.h. * g++spec.c: Include gcc.h. (lang_specific_driver): Constify a char*. Call xcalloc, not xmalloc/bzero. All calls to the function pointer parameter now explicitly call `fatal'. f: * Make-lang.in (g77spec.o): Depend on system.h and gcc.h. * g77spec.c: Include gcc.h. (g77_xargv): Constify. (g77_fn): Add parameter prototypes. (lookup_option, append_arg): Add static prototypes. (g77_newargv): Constify. (lookup_option, append_arg, lang_specific_driver): Constify a char*. (lang_specific_driver): All calls to the function pointer parameter now explicitly call `fatal'. java: * Make-lang.in (jvspec.o): Depend on system.h and gcc.h. * jvspec.c: Include gcc.h. Don't include gansidecl.h. (do_spec, lang_specific_pre_link, lang_specific_driver, input_filename, input_filename_length): Don't declare. (main_class_name, jvgenmain_spec, lang_specific_driver): Constify a char*. (lang_specific_driver): All calls to the function pointer parameter now explicitly call `fatal'. From-SVN: r29367 --- gcc/ChangeLog | 24 ++++++++++++++++++++++++ gcc/Makefile.in | 6 +++--- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/Make-lang.in | 2 +- gcc/cp/g++spec.c | 23 ++++++++++++----------- gcc/cppspec.c | 20 +++++++++++--------- gcc/f/ChangeLog | 15 ++++++++++++++- gcc/f/Make-lang.in | 2 +- gcc/f/g77spec.c | 45 +++++++++++++++++++++++--------------------- gcc/gcc.c | 52 ++++++++++++++++++--------------------------------- gcc/gcc.h | 43 ++++++++++++++++++++++++++++++++++++++++++ gcc/gccspec.c | 4 ++-- gcc/java/ChangeLog | 12 ++++++++++++ gcc/java/Make-lang.in | 2 +- gcc/java/jvspec.c | 43 ++++++++++++++++++------------------------ 15 files changed, 193 insertions(+), 109 deletions(-) create mode 100644 gcc/gcc.h (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b445d3..e681e60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +Sun Sep 12 23:28:20 1999 Kaveh R. Ghazi + + * Makefile.in (gcc.o, gccspec.o, cppspec.o): Depend on gcc.h. + + * gcc.h: New file. + (lang_specific_driver): Don't take a function pointer parameter. + All callers changed. + + * gcc.c: Include gcc.h. + (do_spec, fancy_abort,lang_specific_driver,lang_specific_pre_link, + lang_specific_extra_outfiles, fatal): Don't declare. + (multilib_defaults_raw): Constify. + (read_specs): Call memset, rather than bzero. + (main): Call return, not exit. + (lookup_compiler): Call memcpy, not bcopy. + (fatal): Make extern. + + * cppspec.c: Include gcc.h. + (lang_specific_driver): Initialize variable `quote'. Constify a + char*. All calls to the function pointer parameter now + explicitly call `fatal'. + + * gccspec.c (lang_specific_driver): Include gcc.h. + Sun Sep 12 19:52:10 1999 Richard Earnshaw * arm.c (note_invalid_constants): Use recog_data.operand_type diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 8e3623a..1799933 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1419,13 +1419,13 @@ DRIVER_DEFINES = \ -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \ -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" gcc.o: gcc.c $(CONFIG_H) system.h intl.h multilib.h \ - Makefile $(lang_specs_files) prefix.h + Makefile $(lang_specs_files) prefix.h gcc.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(DRIVER_DEFINES) \ -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'` -gccspec.o: gccspec.c $(CONFIG_H) system.h -cppspec.o: cppspec.c $(CONFIG_H) system.h +gccspec.o: gccspec.c $(CONFIG_H) system.h gcc.h +cppspec.o: cppspec.c $(CONFIG_H) system.h gcc.h tree-check.h: s-check ; @true s-check : gencheck $(srcdir)/move-if-change diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9e953ed..5d11fe6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi + + * Make-lang.in (g++spec.o): Depend on system.h and gcc.h. + + * g++spec.c: Include gcc.h. + (lang_specific_driver): Constify a char*. Call xcalloc, not + xmalloc/bzero. All calls to the function pointer parameter now + explicitly call `fatal'. + 1999-09-12 Mark Mitchell * call.c (implicit_conversion): Robustify. Handle OFFSET_REFs. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 9e5a218..3051d91 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -75,7 +75,7 @@ C++ c++: cc1plus$(exeext) # Tell GNU make to ignore these if they exist. .PHONY: C++ c++ -g++spec.o: $(srcdir)/cp/g++spec.c +g++spec.o: $(srcdir)/cp/g++spec.c system.h gcc.h $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c $(INTL_TARGETS): $(srcdir)/cp/parse.c diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index 7e4d49c..239390d 100644 --- a/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "gcc.h" /* This bit is set if we saw a `-xfoo' language specification. */ #define LANGSPEC (1<<1) @@ -37,8 +38,7 @@ Boston, MA 02111-1307, USA. */ #endif void -lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) - void (*fn)(); +lang_specific_driver (in_argc, in_argv, in_added_libraries) int *in_argc; char ***in_argv; int *in_added_libraries; @@ -59,10 +59,11 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) /* Used to track options that take arguments, so we don't go wrapping those with -xc++/-xnone. */ - char *quote = NULL; + const char *quote = NULL; /* The new argument list will be contained in this. */ - char **arglist; + char **real_arglist; + const char **arglist; /* Non-zero if we saw a `-xfoo' language specification on the command line. Used to avoid adding our own -xc++ if the user @@ -70,10 +71,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) int saw_speclang = 0; /* "-lm" or "-lmath" if it appears on the command line. */ - char *saw_math = 0; + const char *saw_math = 0; /* "-lc" if it appears on the command line. */ - char *saw_libc = 0; + const char *saw_libc = 0; /* An array used to flag each argument that needs a bit set for LANGSPEC, MATHLIB, or WITHLIBC. */ @@ -98,8 +99,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) argv = *in_argv; added_libraries = *in_added_libraries; - args = (int *) xmalloc (argc * sizeof (int)); - bzero ((char *) args, argc * sizeof (int)); + args = (int *) xcalloc (argc, sizeof (int)); for (i = 1; i < argc; i++) { @@ -188,7 +188,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) } if (quote) - (*fn) ("argument to `%s' missing\n", quote); + fatal ("argument to `%s' missing\n", quote); /* If we know we don't have to do anything, bail now. */ if (! added && ! library) @@ -199,7 +199,8 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) /* Make sure to have room for the trailing NULL argument. */ num_args = argc + added + need_math + 1; - arglist = (char **) xmalloc (num_args * sizeof (char *)); + real_arglist = (char **) xmalloc (num_args * sizeof (char *)); + arglist = (const char **) real_arglist; /* NOTE: We start at 1 now, not 0. */ for (i = 0, j = 0; i < argc; i++, j++) @@ -253,7 +254,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) arglist[j] = NULL; *in_argc = j; - *in_argv = arglist; + *in_argv = real_arglist; *in_added_libraries = added_libraries; } diff --git a/gcc/cppspec.c b/gcc/cppspec.c index 0127305..f9a632f 100644 --- a/gcc/cppspec.c +++ b/gcc/cppspec.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "gcc.h" /* The `cpp' executable installed in $(bindir) and $(cpp_install_dir) is a customized version of the gcc driver. It forces -E; -S and -c @@ -69,8 +70,7 @@ static const char *const known_suffixes[] = /* Filter argc and argv before processing by the gcc driver proper. */ void -lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) - void (*errfn) PVPROTO((const char *, ...)); +lang_specific_driver (in_argc, in_argv, in_added_libraries) int *in_argc; char ***in_argv; int *in_added_libraries ATTRIBUTE_UNUSED; @@ -99,8 +99,9 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) /* Do we need to fix up an input file with an unrecognized suffix? */ int need_fixups = 1; - int i, j, quote; - char **new_argv; + int i, j, quote = 0; + char **real_new_argv; + const char **new_argv; int new_argc; /* First pass. If we see an -S or -c, barf. If we see an input file, @@ -124,8 +125,8 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) need_E = 0; else if (argv[i][1] == 'S' || argv[i][1] == 'c') { - (*errfn) ("`%s' is not a legal option to the preprocessor", - argv[i]); + fatal ("`%s' is not a legal option to the preprocessor", + argv[i]); return; } else if (argv[i][1] == 'x') @@ -148,7 +149,7 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) seen_input++; if (seen_input == 3) { - (*errfn) ("too many input files"); + fatal ("too many input files"); return; } else if (seen_input == 2) @@ -195,7 +196,8 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) return; /* One more slot for a terminating null. */ - new_argv = (char **) xmalloc ((new_argc + 1) * sizeof(char *)); + real_new_argv = (char **) xmalloc ((new_argc + 1) * sizeof(char *)); + new_argv = (const char **) real_new_argv. new_argv[0] = argv[0]; j = 1; @@ -223,7 +225,7 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) new_argv[j] = NULL; *in_argc = new_argc; - *in_argv = new_argv; + *in_argv = real_new_argv; } /* Called before linking. Returns 0 on success and -1 on failure. */ diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 5382d9a..c0b1b02 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,16 @@ +Sun Sep 12 23:29:47 1999 Kaveh R. Ghazi + + * Make-lang.in (g77spec.o): Depend on system.h and gcc.h. + + * g77spec.c: Include gcc.h. + (g77_xargv): Constify. + (g77_fn): Add parameter prototypes. + (lookup_option, append_arg): Add static prototypes. + (g77_newargv): Constify. + (lookup_option, append_arg, lang_specific_driver): Constify a char*. + (lang_specific_driver): All calls to the function pointer + parameter now explicitly call `fatal'. + Fri Sep 10 10:32:32 1999 Bernd Schmidt * com.h: Delete declarations for all tree nodes now moved to @@ -494,7 +507,7 @@ Sun Apr 11 21:33:33 1999 Mumit Khan * g77spec.c (lang_specific_driver): Check whether MATH_LIBRARY is null to decide whether to use it. -Wed Apr 7 09:47:09 1999 Kaveh R. Ghazi +Wed Apr 7 09:47:09 1999 Kaveh R. Ghazi * ansify.c (die): Specify void argument. diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in index daf6617..1009b71 100644 --- a/gcc/f/Make-lang.in +++ b/gcc/f/Make-lang.in @@ -59,7 +59,7 @@ F77 f77: f771$(exeext) f77.extraclean f77.maintainer-clean f77.distdir f77.rebuilt \ f77.stage1 f77.stage2 f77.stage3 f77.stage4 -g77spec.o: $(srcdir)/f/g77spec.c $(srcdir)/f/version.h +g77spec.o: $(srcdir)/f/g77spec.c $(srcdir)/f/version.h system.h gcc.h case "$(LANGUAGES)" in \ *[fF]77*) touch lang-f77;; \ *) rm -f lang-f77;; \ diff --git a/gcc/f/g77spec.c b/gcc/f/g77spec.c index 50e7738..96621c4 100644 --- a/gcc/f/g77spec.c +++ b/gcc/f/g77spec.c @@ -46,6 +46,7 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "gcc.h" #include #ifndef MATH_LIBRARY @@ -85,12 +86,15 @@ typedef enum /* The original argument list and related info is copied here. */ static int g77_xargc; -static char **g77_xargv; -static void (*g77_fn)(); +static const char **g77_xargv; +static void lookup_option PARAMS ((Option *, int *, const char **, + const char *)); +static void append_arg PARAMS ((const char *)); /* The new argument list will be built here. */ static int g77_newargc; -static char **g77_newargv; +static char **real_g77_newargv; +static const char **g77_newargv; extern char *version_string; @@ -136,12 +140,12 @@ static void lookup_option (xopt, xskip, xarg, text) Option *xopt; int *xskip; - char **xarg; - char *text; + const char **xarg; + const char *text; { Option opt = OPTION_; int skip; - char *arg = NULL; + const char *arg = NULL; if ((skip = SWITCH_TAKES_ARG (text[1]))) skip -= (text[2] != '\0'); /* See gcc.c. */ @@ -216,7 +220,7 @@ lookup_option (xopt, xskip, xarg, text) static void append_arg (arg) - char *arg; + const char *arg; { static int newargsize; @@ -238,7 +242,8 @@ append_arg (arg) int i; newargsize = (g77_xargc << 2) + 20; /* This should handle all. */ - g77_newargv = (char **) xmalloc (newargsize * sizeof (char *)); + real_g77_newargv = (char **) xmalloc (newargsize * sizeof (char *)); + g77_newargv = (const char **) real_g77_newargv; /* Copy what has been done so far. */ for (i = 0; i < g77_newargc; ++i) @@ -246,29 +251,28 @@ append_arg (arg) } if (g77_newargc == newargsize) - (*g77_fn) ("overflowed output arg list for `%s'", arg); + fatal ("overflowed output arg list for `%s'", arg); g77_newargv[g77_newargc++] = arg; } void -lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) - void (*fn)(); +lang_specific_driver (in_argc, in_argv, in_added_libraries) int *in_argc; char ***in_argv; - int *in_added_libraries; + int *in_added_libraries ATTRIBUTE_UNUSED; { int argc = *in_argc; - char **argv = *in_argv; + const char **argv = (const char **) *in_argv; int i; int verbose = 0; Option opt; int skip; - char *arg; + const char *arg; /* This will be NULL if we encounter a situation where we should not link in libf2c. */ - char *library = FORTRAN_LIBRARY; + const char *library = FORTRAN_LIBRARY; /* This will become 0 if anything other than -v and kin (like -V) is seen, meaning the user is trying to accomplish something. @@ -304,7 +308,6 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) g77_xargv = argv; g77_newargc = 0; g77_newargv = argv; - g77_fn = fn; /* First pass through arglist. @@ -434,7 +437,7 @@ For bug reporting instructions, please see:\n\ #endif case OPTION_driver: - (*fn) ("--driver no longer supported", argv[i]); + fatal ("--driver no longer supported", argv[i]); break; default: @@ -448,11 +451,11 @@ For bug reporting instructions, please see:\n\ if (i + skip < argc) i += skip; else - (*fn) ("argument to `%s' missing", argv[i]); + fatal ("argument to `%s' missing", argv[i]); } if ((n_outfiles != 0) && (n_infiles == 0)) - (*fn) ("No input files; unwilling to write output files"); + fatal ("No input files; unwilling to write output files"); /* Second pass through arglist, transforming arguments as appropriate. */ @@ -486,7 +489,7 @@ For bug reporting instructions, please see:\n\ if (opt == OPTION_x) { /* Track input language. */ - char *lang; + const char *lang; if (arg == NULL) lang = argv[i+1]; @@ -569,7 +572,7 @@ For bug reporting instructions, please see:\n\ } *in_argc = g77_newargc; - *in_argv = g77_newargv; + *in_argv = real_g77_newargv; } /* Called before linking. Returns 0 on success and -1 on failure. */ diff --git a/gcc/gcc.c b/gcc/gcc.c index 1b7638f..ff61c1c 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -38,6 +38,7 @@ compilation is specified by a string called a "spec". */ #include "obstack.h" #include "intl.h" #include "prefix.h" +#include "gcc.h" #ifdef VMS #define exit __posix_exit @@ -190,7 +191,6 @@ static void clear_failure_queue PROTO((void)); static int check_live_switch PROTO((int, int)); static const char *handle_braces PROTO((const char *)); static char *save_string PROTO((const char *, int)); -extern int do_spec PROTO((const char *)); static int do_spec_1 PROTO((const char *, int, const char *)); static const char *find_file PROTO((const char *)); static int is_directory PROTO((const char *, const char *, int)); @@ -205,8 +205,6 @@ static void pfatal_with_name PROTO((const char *)) ATTRIBUTE_NORETURN; static void perror_with_name PROTO((const char *)); static void pfatal_pexecute PROTO((const char *, const char *)) ATTRIBUTE_NORETURN; -static void fatal PVPROTO((const char *, ...)) - ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; static void notice PVPROTO((const char *, ...)) @@ -220,18 +218,6 @@ static int execute PROTO ((void)); static void unused_prefix_warnings PROTO ((struct path_prefix *)); static void clear_args PROTO ((void)); static void fatal_error PROTO ((int)); - -void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN; - -/* Called before processing to change/add/remove arguments. */ -extern void lang_specific_driver PROTO ((void (*) PVPROTO((const char *, ...)), - int *, char ***, int *)); - -/* Called before linking. Returns 0 on success and -1 on failure. */ -extern int lang_specific_pre_link (); - -/* Number of extra output files that lang_specific_pre_link may generate. */ -extern int lang_specific_extra_outfiles; /* Specs are strings containing lines, each of which (if not blank) is made up of a program name, and arguments separated by spaces. @@ -503,7 +489,7 @@ static char *multilib_defaults; #define MULTILIB_DEFAULTS { "" } #endif -static char *multilib_defaults_raw[] = MULTILIB_DEFAULTS; +static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS; struct user_specs { struct user_specs *next; @@ -1657,12 +1643,11 @@ read_specs (filename, main_p) (n_compilers + 2) * sizeof (struct compiler))); compilers[n_compilers].suffix = suffix; - bzero ((char *) compilers[n_compilers].spec, - sizeof compilers[n_compilers].spec); + memset (compilers[n_compilers].spec, 0, + sizeof compilers[n_compilers].spec); compilers[n_compilers].spec[0] = spec; n_compilers++; - bzero ((char *) &compilers[n_compilers], - sizeof compilers[n_compilers]); + memset (&compilers[n_compilers], 0, sizeof compilers[n_compilers]); } if (*suffix == 0) @@ -2714,7 +2699,7 @@ process_command (argc, argv) translate_options (&argc, &argv); /* Do language-specific adjustment/addition of flags. */ - lang_specific_driver (fatal, &argc, &argv, &added_libraries); + lang_specific_driver (&argc, &argv, &added_libraries); /* Scan argv twice. Here, the first time, just count how many switches there will be in their vector, and how many input files in theirs. @@ -4914,26 +4899,26 @@ main (argc, argv) printf ("install: %s%s\n", standard_exec_prefix, machine_suffix); printf ("programs: %s\n", build_search_list (&exec_prefixes, "", 0)); printf ("libraries: %s\n", build_search_list (&startfile_prefixes, "", 0)); - exit (0); + return (0); } if (print_file_name) { printf ("%s\n", find_file (print_file_name)); - exit (0); + return (0); } if (print_prog_name) { char *newname = find_a_file (&exec_prefixes, print_prog_name, X_OK); printf ("%s\n", (newname ? newname : print_prog_name)); - exit (0); + return (0); } if (print_multi_lib) { print_multilib_info (); - exit (0); + return (0); } if (print_multi_directory) @@ -4942,7 +4927,7 @@ main (argc, argv) printf (".\n"); else printf ("%s\n", multilib_dir); - exit (0); + return (0); } if (print_help_list) @@ -4954,7 +4939,7 @@ main (argc, argv) printf ("\nFor bug reporting instructions, please see:\n"); printf (".\n"); - exit (0); + return (0); } /* We do not exit here. Instead we have created a fake input file @@ -4981,7 +4966,7 @@ main (argc, argv) version_string, compiler_version); if (n_infiles == 0) - exit (0); + return (0); } if (n_infiles == added_libraries) @@ -5146,9 +5131,7 @@ main (argc, argv) printf ("\n"); } - exit (error_count > 0 ? (signal_count ? 2 : 1) : 0); - /* NOTREACHED */ - return 0; + return (error_count > 0 ? (signal_count ? 2 : 1) : 0); } /* Find the proper compilation spec for the file name NAME, @@ -5208,8 +5191,9 @@ lookup_compiler (name, length, language) language = cp->spec[0] + 1; new = (struct compiler *) xmalloc (sizeof (struct compiler)); new->suffix = cp->suffix; - bcopy ((char *) lookup_compiler (NULL_PTR, 0, language)->spec, - (char *) new->spec, sizeof new->spec); + memcpy (new->spec, + lookup_compiler (NULL_PTR, 0, language)->spec, + sizeof new->spec); return new; } @@ -5280,7 +5264,7 @@ fancy_abort () /* Output an error message and exit */ -static void +void fatal VPROTO((const char *msgid, ...)) { #ifndef ANSI_PROTOTYPES diff --git a/gcc/gcc.h b/gcc/gcc.h new file mode 100644 index 0000000..3e870e2 --- /dev/null +++ b/gcc/gcc.h @@ -0,0 +1,43 @@ +/* Header file for modules that link with gcc.c + Copyright (C) 1999 Free Software Foundation, Inc. + +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. */ + +#ifndef __GCC_H__ +#define __GCC_H__ + +/* These are exported by gcc.c. */ +extern int do_spec PARAMS ((const char *)); +extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; +extern const char *input_filename; +extern size_t input_filename_length; +extern void fatal PARAMS ((const char *, ...)) + ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; + +/* Spec files linked with gcc.c must provide definitions for these. */ + +/* Called before processing to change/add/remove arguments. */ +extern void lang_specific_driver PARAMS ((int *, char ***, int *)); + +/* Called before linking. Returns 0 on success and -1 on failure. */ +extern int lang_specific_pre_link PARAMS ((void)); + +/* Number of extra output files that lang_specific_pre_link may generate. */ +extern int lang_specific_extra_outfiles; + +#endif /* ! __GCC_H__ */ diff --git a/gcc/gccspec.c b/gcc/gccspec.c index 78c67d2..5df63ab 100644 --- a/gcc/gccspec.c +++ b/gcc/gccspec.c @@ -20,11 +20,11 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "gcc.h" /* Filter argc and argv before processing by the gcc driver proper. */ void -lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) - void (*fn)() ATTRIBUTE_UNUSED; +lang_specific_driver (in_argc, in_argv, in_added_libraries) int *in_argc ATTRIBUTE_UNUSED; char ***in_argv ATTRIBUTE_UNUSED; int *in_added_libraries ATTRIBUTE_UNUSED; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index a07eff5..8fd784f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,15 @@ +Sun Sep 12 23:30:09 1999 Kaveh R. Ghazi + + * Make-lang.in (jvspec.o): Depend on system.h and gcc.h. + + * jvspec.c: Include gcc.h. Don't include gansidecl.h. + (do_spec, lang_specific_pre_link, lang_specific_driver, + input_filename, input_filename_length): Don't declare. + (main_class_name, jvgenmain_spec, lang_specific_driver): + Constify a char*. + (lang_specific_driver): All calls to the function pointer + parameter now explicitly call `fatal'. + Sat Sep 11 16:46:44 1999 Alexandre Petit-Bianco * parse.y (find_applicable_accessible_methods_list): Search diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index d787ba6..b55ee45 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -80,7 +80,7 @@ JAVA_SRCS = $(srcdir)/java/parse.y $(srcdir)/java/class.c \ jc1$(exeext): $(P) $(JAVA_SRCS) $(LIBDEPS) stamp-objlist ggc-callbacks.o cd java; $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jc1$(exeext) -jvspec.o: $(srcdir)/java/jvspec.c +jvspec.o: $(srcdir)/java/jvspec.c system.h gcc.h $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ $(INCLUDES) $(srcdir)/java/jvspec.c diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index 81b2b52..e3b3a23 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -24,10 +24,8 @@ of Sun Microsystems, Inc. in the United States and other countries. The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "config.h" - #include "system.h" - -#include "gansidecl.h" +#include "gcc.h" /* Name of spec file. */ #define SPEC_FILE "libgcj.spec" @@ -42,14 +40,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #define CLASS_FILE_ARG (1<<4) static char *find_spec_file PROTO ((const char *)); -extern int do_spec PROTO((char *)); -extern int lang_specific_pre_link PROTO((void)); -extern void lang_specific_driver PROTO ((void (*) (const char *, ...), - int *, char ***, int *)); -extern char *input_filename; -extern size_t input_filename_length; - -char *main_class_name = NULL; + +static const char *main_class_name = NULL; int lang_specific_extra_outfiles = 0; /* Once we have the proper support in jc1 (and gcc.c) working, @@ -57,7 +49,7 @@ int lang_specific_extra_outfiles = 0; and *.class input files to be passed to a single jc1 invocation. */ #define COMBINE_INPUTS 0 -char jvgenmain_spec[] = +const char jvgenmain_spec[] = "jvgenmain %i %{!pipe:%u.i} |\n\ cc1 %{!pipe:%U.i} %1 \ %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\ @@ -92,8 +84,7 @@ find_spec_file (dir) } void -lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) - void (*fn) PROTO ((const char *, ...)); +lang_specific_driver (in_argc, in_argv, in_added_libraries) int *in_argc; char ***in_argv; int *in_added_libraries; @@ -138,10 +129,11 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) /* Used to track options that take arguments, so we don't go wrapping those with -xc++/-xnone. */ - char *quote = NULL; + const char *quote = NULL; /* The new argument list will be contained in this. */ - char **arglist; + char **real_arglist; + const char **arglist; /* Non-zero if we saw a `-xfoo' language specification on the command line. Used to avoid adding our own -xc++ if the user @@ -149,16 +141,16 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) int saw_speclang = 0; /* "-lm" or "-lmath" if it appears on the command line. */ - char *saw_math ATTRIBUTE_UNUSED = 0; + const char *saw_math ATTRIBUTE_UNUSED = 0; /* "-lc" if it appears on the command line. */ - char *saw_libc ATTRIBUTE_UNUSED = 0; + const char *saw_libc ATTRIBUTE_UNUSED = 0; /* "-lgcjgc" if it appears on the command line. */ - char *saw_gc ATTRIBUTE_UNUSED = 0; + const char *saw_gc ATTRIBUTE_UNUSED = 0; /* Saw `-l' option for the thread library. */ - char *saw_threadlib ATTRIBUTE_UNUSED = 0; + const char *saw_threadlib ATTRIBUTE_UNUSED = 0; /* Saw `-lgcj' on command line. */ int saw_libgcj ATTRIBUTE_UNUSED = 0; @@ -337,7 +329,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) } if (quote) - (*fn) ("argument to `%s' missing\n", quote); + fatal ("argument to `%s' missing\n", quote); num_args = argc + added; if (saw_C) @@ -349,7 +341,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) num_args += 2; /* For -o NONE. */ #endif if (saw_o) - (*fn) ("cannot specify both -C and -o"); + fatal ("cannot specify both -C and -o"); } #if COMBINE_INPUTS if (saw_o && java_files_count + (saw_C ? 0 : class_files_count) > 1) @@ -385,7 +377,8 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) if (saw_g + saw_O == 0) num_args++; num_args++; - arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *)); + arglist = (const char **) + (real_arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *))); for (i = 0, j = 0; i < argc; i++, j++) { @@ -421,7 +414,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) if (strncmp (argv[i], "-fmain=", 7) == 0) { if (! will_link) - (*fn) ("cannot specify `main' class when not linking"); + fatal ("cannot specify `main' class when not linking"); --j; continue; } @@ -480,7 +473,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) arglist[j] = NULL; *in_argc = j; - *in_argv = arglist; + *in_argv = real_arglist; *in_added_libraries = added_libraries; } -- cgit v1.1