Commit 37620334 by Zack Weinberg Committed by Zack Weinberg

gcc.h (lang_specific_driver): Constify second argument.

	* gcc.h (lang_specific_driver): Constify second argument.
	* gcc.c (translate_options, process_command, main): Likewise.
	Constify variables to match.  Cast second argument to
	pexecute.

	* cppspec.c, gccspec.c, g++spec.c, g77spec.c, jvspec.c: Adjust
	type of second argument to lang_specific_driver, and update
	code as necessary.

From-SVN: r35433
parent f9427d17
2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
* gcc.h (lang_specific_driver): Constify second argument.
* gcc.c (translate_options, process_command, main): Likewise.
Constify variables to match. Cast second argument to
pexecute.
* cppspec.c, gccspec.c: Adjust type of second argument to
lang_specific_driver, and update code as necessary.
2000-08-02 Jakub Jelinek <jakub@redhat.com> 2000-08-02 Jakub Jelinek <jakub@redhat.com>
* loop.c (scan_loop): Ensure update_end label does not * loop.c (scan_loop): Ensure update_end label does not
......
2000-08-02 Zack Weinberg <zack@wolery.cumb.org> 2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
* g++spec.c: Adjust type of second argument to
lang_specific_driver, and update code as necessary.
* cp-tree.h: Don't prototype min_precision here. * cp-tree.h: Don't prototype min_precision here.
(my_friendly_assert): Cast expression to void. (my_friendly_assert): Cast expression to void.
* semantics.c (do_poplevel): Initialize scope_stmts. * semantics.c (do_poplevel): Initialize scope_stmts.
......
...@@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */
void void
lang_specific_driver (in_argc, in_argv, in_added_libraries) lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc; int *in_argc;
char ***in_argv; const char *const **in_argv;
int *in_added_libraries; int *in_added_libraries;
{ {
int i, j; int i, j;
...@@ -62,7 +62,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -62,7 +62,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
const char *quote = NULL; const char *quote = NULL;
/* The new argument list will be contained in this. */ /* The new argument list will be contained in this. */
char **real_arglist;
const char **arglist; const char **arglist;
/* Non-zero if we saw a `-xfoo' language specification on the /* Non-zero if we saw a `-xfoo' language specification on the
...@@ -87,7 +86,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -87,7 +86,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
int argc; int argc;
/* The argument list. */ /* The argument list. */
char **argv; const char *const *argv;
/* The number of libraries added in. */ /* The number of libraries added in. */
int added_libraries; int added_libraries;
...@@ -203,14 +202,13 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -203,14 +202,13 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
/* Make sure to have room for the trailing NULL argument. */ /* Make sure to have room for the trailing NULL argument. */
num_args = argc + added + need_math + 1; num_args = argc + added + need_math + 1;
real_arglist = (char **) xmalloc (num_args * sizeof (char *)); arglist = (const char **) xmalloc (num_args * sizeof (char *));
arglist = (const char **) real_arglist;
i = 0; i = 0;
j = 0; j = 0;
/* Copy the 0th argument, i.e., the name of the program itself. */ /* Copy the 0th argument, i.e., the name of the program itself. */
arglist[i++] = arglist[j++]; arglist[i++] = argv[j++];
#if ENABLE_NEW_GXX_ABI #if ENABLE_NEW_GXX_ABI
/* If we should use the new ABI by default, add the appropriate flag /* If we should use the new ABI by default, add the appropriate flag
...@@ -274,7 +272,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -274,7 +272,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
arglist[j] = NULL; arglist[j] = NULL;
*in_argc = j; *in_argc = j;
*in_argv = real_arglist; *in_argv = arglist;
*in_added_libraries = added_libraries; *in_added_libraries = added_libraries;
} }
......
...@@ -72,12 +72,12 @@ static const char *const known_suffixes[] = ...@@ -72,12 +72,12 @@ static const char *const known_suffixes[] =
void void
lang_specific_driver (in_argc, in_argv, in_added_libraries) lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc; int *in_argc;
char ***in_argv; const char *const **in_argv;
int *in_added_libraries ATTRIBUTE_UNUSED; int *in_added_libraries ATTRIBUTE_UNUSED;
{ {
int argc = *in_argc; int argc = *in_argc;
char **argv = *in_argv; const char *const *argv = *in_argv;
/* Do we need to read stdin? */ /* Do we need to read stdin? */
int read_stdin = 1; int read_stdin = 1;
...@@ -100,7 +100,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -100,7 +100,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
int need_fixups = 1; int need_fixups = 1;
int i, j, quote = 0; int i, j, quote = 0;
char **real_new_argv;
const char **new_argv; const char **new_argv;
int new_argc; int new_argc;
...@@ -196,8 +195,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -196,8 +195,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
return; return;
/* One more slot for a terminating null. */ /* One more slot for a terminating null. */
real_new_argv = (char **) xmalloc ((new_argc + 1) * sizeof(char *)); new_argv = (const char **) xmalloc ((new_argc + 1) * sizeof(char *));
new_argv = (const char **) real_new_argv;
new_argv[0] = argv[0]; new_argv[0] = argv[0];
j = 1; j = 1;
...@@ -225,7 +223,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -225,7 +223,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
new_argv[j] = NULL; new_argv[j] = NULL;
*in_argc = new_argc; *in_argc = new_argc;
*in_argv = real_new_argv; *in_argv = new_argv;
} }
/* Called before linking. Returns 0 on success and -1 on failure. */ /* Called before linking. Returns 0 on success and -1 on failure. */
......
2000-08-02 Zack Weinberg <zack@wolery.cumb.org> 2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
* g77spec.c: Adjust type of second argument to
lang_specific_driver, and update code as necessary.
* expr.c (ffeexpr_finished_): Cast signed side of ?: * expr.c (ffeexpr_finished_): Cast signed side of ?:
expression to bool. expression to bool.
......
...@@ -86,14 +86,13 @@ typedef enum ...@@ -86,14 +86,13 @@ typedef enum
/* The original argument list and related info is copied here. */ /* The original argument list and related info is copied here. */
static int g77_xargc; static int g77_xargc;
static const char **g77_xargv; static const char *const *g77_xargv;
static void lookup_option PARAMS ((Option *, int *, const char **, static void lookup_option PARAMS ((Option *, int *, const char **,
const char *)); const char *));
static void append_arg PARAMS ((const char *)); static void append_arg PARAMS ((const char *));
/* The new argument list will be built here. */ /* The new argument list will be built here. */
static int g77_newargc; static int g77_newargc;
static char **real_g77_newargv;
static const char **g77_newargv; static const char **g77_newargv;
/* --- This comes from gcc.c (2.8.1) verbatim: */ /* --- This comes from gcc.c (2.8.1) verbatim: */
...@@ -240,8 +239,7 @@ append_arg (arg) ...@@ -240,8 +239,7 @@ append_arg (arg)
int i; int i;
newargsize = (g77_xargc << 2) + 20; /* This should handle all. */ newargsize = (g77_xargc << 2) + 20; /* This should handle all. */
real_g77_newargv = (char **) xmalloc (newargsize * sizeof (char *)); g77_newargv = (const char **) xmalloc (newargsize * sizeof (char *));
g77_newargv = (const char **) real_g77_newargv;
/* Copy what has been done so far. */ /* Copy what has been done so far. */
for (i = 0; i < g77_newargc; ++i) for (i = 0; i < g77_newargc; ++i)
...@@ -257,11 +255,11 @@ append_arg (arg) ...@@ -257,11 +255,11 @@ append_arg (arg)
void void
lang_specific_driver (in_argc, in_argv, in_added_libraries) lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc; int *in_argc;
char ***in_argv; const char *const **in_argv;
int *in_added_libraries ATTRIBUTE_UNUSED; int *in_added_libraries ATTRIBUTE_UNUSED;
{ {
int argc = *in_argc; int argc = *in_argc;
const char **argv = (const char **) *in_argv; const char *const *argv = *in_argv;
int i; int i;
int verbose = 0; int verbose = 0;
Option opt; Option opt;
...@@ -302,12 +300,10 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -302,12 +300,10 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
fprintf (stderr, "\n"); fprintf (stderr, "\n");
#endif #endif
real_g77_newargv = *in_argv;
g77_xargc = argc; g77_xargc = argc;
g77_xargv = argv; g77_xargv = argv;
g77_newargc = 0; g77_newargc = 0;
g77_newargv = argv; g77_newargv = (const char **) argv;
/* First pass through arglist. /* First pass through arglist.
...@@ -572,7 +568,7 @@ For bug reporting instructions, please see:\n\ ...@@ -572,7 +568,7 @@ For bug reporting instructions, please see:\n\
} }
*in_argc = g77_newargc; *in_argc = g77_newargc;
*in_argv = real_g77_newargv; *in_argv = g77_newargv;
} }
/* Called before linking. Returns 0 on success and -1 on failure. */ /* Called before linking. Returns 0 on success and -1 on failure. */
......
...@@ -210,7 +210,7 @@ static int access_check PARAMS ((const char *, int)); ...@@ -210,7 +210,7 @@ static int access_check PARAMS ((const char *, int));
static char *find_a_file PARAMS ((struct path_prefix *, const char *, int)); static char *find_a_file PARAMS ((struct path_prefix *, const char *, int));
static void add_prefix PARAMS ((struct path_prefix *, const char *, static void add_prefix PARAMS ((struct path_prefix *, const char *,
const char *, int, int, int *)); const char *, int, int, int *));
static void translate_options PARAMS ((int *, const char ***)); static void translate_options PARAMS ((int *, const char *const **));
static char *skip_whitespace PARAMS ((char *)); static char *skip_whitespace PARAMS ((char *));
static void record_temp_file PARAMS ((const char *, int, int)); static void record_temp_file PARAMS ((const char *, int, int));
static void delete_if_ordinary PARAMS ((const char *)); static void delete_if_ordinary PARAMS ((const char *));
...@@ -242,7 +242,7 @@ static void display_help PARAMS ((void)); ...@@ -242,7 +242,7 @@ static void display_help PARAMS ((void));
static void add_preprocessor_option PARAMS ((const char *, int)); static void add_preprocessor_option PARAMS ((const char *, int));
static void add_assembler_option PARAMS ((const char *, int)); static void add_assembler_option PARAMS ((const char *, int));
static void add_linker_option PARAMS ((const char *, int)); static void add_linker_option PARAMS ((const char *, int));
static void process_command PARAMS ((int, const char **)); static void process_command PARAMS ((int, const char *const *));
static int execute PARAMS ((void)); static int execute PARAMS ((void));
static void unused_prefix_warnings PARAMS ((struct path_prefix *)); static void unused_prefix_warnings PARAMS ((struct path_prefix *));
static void clear_args PARAMS ((void)); static void clear_args PARAMS ((void));
...@@ -854,11 +854,11 @@ struct option_map option_map[] = ...@@ -854,11 +854,11 @@ struct option_map option_map[] =
static void static void
translate_options (argcp, argvp) translate_options (argcp, argvp)
int *argcp; int *argcp;
const char ***argvp; const char *const **argvp;
{ {
int i; int i;
int argc = *argcp; int argc = *argcp;
const char **argv = *argvp; const char *const *argv = *argvp;
const char **newv = const char **newv =
(const char **) xmalloc ((argc + 2) * 2 * sizeof (const char *)); (const char **) xmalloc ((argc + 2) * 2 * sizeof (const char *));
int newindex = 0; int newindex = 0;
...@@ -2492,7 +2492,7 @@ execute () ...@@ -2492,7 +2492,7 @@ execute ()
/* Print each piped command as a separate line. */ /* Print each piped command as a separate line. */
for (i = 0; i < n_commands ; i++) for (i = 0; i < n_commands ; i++)
{ {
const char **j; const char *const *j;
for (j = commands[i].argv; *j; j++) for (j = commands[i].argv; *j; j++)
fprintf (stderr, " %s", *j); fprintf (stderr, " %s", *j);
...@@ -2523,7 +2523,9 @@ execute () ...@@ -2523,7 +2523,9 @@ execute ()
char *errmsg_fmt, *errmsg_arg; char *errmsg_fmt, *errmsg_arg;
const char *string = commands[i].argv[0]; const char *string = commands[i].argv[0];
commands[i].pid = pexecute (string, commands[i].argv, /* For some bizarre reason, the second argument of execvp() is
char *const *, not const char *const *. */
commands[i].pid = pexecute (string, (char *const *) commands[i].argv,
programname, temp_filename, programname, temp_filename,
&errmsg_fmt, &errmsg_arg, &errmsg_fmt, &errmsg_arg,
((i == 0 ? PEXECUTE_FIRST : 0) ((i == 0 ? PEXECUTE_FIRST : 0)
...@@ -2860,7 +2862,7 @@ add_linker_option (option, len) ...@@ -2860,7 +2862,7 @@ add_linker_option (option, len)
static void static void
process_command (argc, argv) process_command (argc, argv)
int argc; int argc;
const char **argv; const char *const *argv;
{ {
register int i; register int i;
const char *temp; const char *temp;
...@@ -5088,12 +5090,12 @@ fatal_error (signum) ...@@ -5088,12 +5090,12 @@ fatal_error (signum)
kill (getpid (), signum); kill (getpid (), signum);
} }
extern int main PARAMS ((int, char **)); extern int main PARAMS ((int, const char *const *));
int int
main (argc, argv) main (argc, argv)
int argc; int argc;
char **argv; const char *const *argv;
{ {
size_t i; size_t i;
int value; int value;
...@@ -5213,7 +5215,7 @@ main (argc, argv) ...@@ -5213,7 +5215,7 @@ main (argc, argv)
first_time = TRUE; first_time = TRUE;
for (i = 0; (int)i < n_switches; i++) for (i = 0; (int)i < n_switches; i++)
{ {
const char **args; const char *const *args;
const char *p, *q; const char *p, *q;
if (!first_time) if (!first_time)
obstack_grow (&collect_obstack, " ", 1); obstack_grow (&collect_obstack, " ", 1);
......
...@@ -34,7 +34,7 @@ extern void fatal PARAMS ((const char *, ...)) ...@@ -34,7 +34,7 @@ extern void fatal PARAMS ((const char *, ...))
/* Spec files linked with gcc.c must provide definitions for these. */ /* Spec files linked with gcc.c must provide definitions for these. */
/* Called before processing to change/add/remove arguments. */ /* Called before processing to change/add/remove arguments. */
extern void lang_specific_driver PARAMS ((int *, char ***, int *)); extern void lang_specific_driver PARAMS ((int *, const char *const **, int *));
/* Called before linking. Returns 0 on success and -1 on failure. */ /* Called before linking. Returns 0 on success and -1 on failure. */
extern int lang_specific_pre_link PARAMS ((void)); extern int lang_specific_pre_link PARAMS ((void));
......
...@@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. */
void void
lang_specific_driver (in_argc, in_argv, in_added_libraries) lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc ATTRIBUTE_UNUSED; int *in_argc ATTRIBUTE_UNUSED;
char ***in_argv ATTRIBUTE_UNUSED; const char *const **in_argv ATTRIBUTE_UNUSED;
int *in_added_libraries ATTRIBUTE_UNUSED; int *in_added_libraries ATTRIBUTE_UNUSED;
{ {
return; /* Not used for C. */ return; /* Not used for C. */
......
2000-08-02 Zack Weinberg <zack@wolery.cumb.org> 2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
* jvspec.c: Adjust type of second argument to
lang_specific_driver, and update code as necessary.
* class.c (build_dtable_decl): Initialize dummy. * class.c (build_dtable_decl): Initialize dummy.
2000-07-27 Tom Tromey <tromey@cygnus.com> 2000-07-27 Tom Tromey <tromey@cygnus.com>
......
...@@ -93,7 +93,7 @@ find_spec_file (dir) ...@@ -93,7 +93,7 @@ find_spec_file (dir)
void void
lang_specific_driver (in_argc, in_argv, in_added_libraries) lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc; int *in_argc;
char ***in_argv; const char *const **in_argv;
int *in_added_libraries; int *in_added_libraries;
{ {
int i, j; int i, j;
...@@ -139,7 +139,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -139,7 +139,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
const char *quote = NULL; const char *quote = NULL;
/* The new argument list will be contained in this. */ /* The new argument list will be contained in this. */
char **real_arglist;
const char **arglist; const char **arglist;
/* Non-zero if we saw a `-xfoo' language specification on the /* Non-zero if we saw a `-xfoo' language specification on the
...@@ -181,7 +180,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -181,7 +180,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
int argc; int argc;
/* The argument list. */ /* The argument list. */
char **argv; const char *const *argv;
/* The number of libraries added in. */ /* The number of libraries added in. */
int added_libraries; int added_libraries;
...@@ -392,8 +391,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -392,8 +391,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
if (saw_g + saw_O == 0) if (saw_g + saw_O == 0)
num_args++; num_args++;
num_args++; num_args++;
arglist = (const char **)
(real_arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *))); arglist = (const char **) xmalloc ((num_args + 1) * sizeof (char *));
for (i = 0, j = 0; i < argc; i++, j++) for (i = 0, j = 0; i < argc; i++, j++)
{ {
...@@ -488,7 +487,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -488,7 +487,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
arglist[j] = NULL; arglist[j] = NULL;
*in_argc = j; *in_argc = j;
*in_argv = real_arglist; *in_argv = arglist;
*in_added_libraries = added_libraries; *in_added_libraries = added_libraries;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment