aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-09-13 03:57:40 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-09-13 03:57:40 +0000
commit9257393c20357f1f5c454d252da8089dcc22c1fd (patch)
tree6e552cd6afac414afba22bf962c7bef94bf8e7f5 /gcc/gcc.c
parent5d73aa6323d0795b477d1725ed9e62fcb7e9494c (diff)
downloadgcc-9257393c20357f1f5c454d252da8089dcc22c1fd.zip
gcc-9257393c20357f1f5c454d252da8089dcc22c1fd.tar.gz
gcc-9257393c20357f1f5c454d252da8089dcc22c1fd.tar.bz2
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
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c52
1 files changed, 18 insertions, 34 deletions
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 ("<URL:http://www.gnu.org/software/gcc/faq.html#bugreport>.\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 ("<URL:http://www.gnu.org/software/gcc/faq.html#bugreport>\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