Commit 47d33318 by Francois-Xavier Coudert Committed by François-Xavier Coudert

gcc.c (xputenv): New function.

	* gcc.c (xputenv): New function.
	(putenv_from_prefixes): Use xputenv instead of putenv.
	(process_command): Use xputenv instead of putenv.
	(set_collect_gcc_options): Use xputenv instead of putenv.
	(main): Use xputenv instead of putenv.

From-SVN: r128046
parent 7ddb8778
2007-09-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* gcc.c (xputenv): New function.
(putenv_from_prefixes): Use xputenv instead of putenv.
(process_command): Use xputenv instead of putenv.
(set_collect_gcc_options): Use xputenv instead of putenv.
(main): Use xputenv instead of putenv.
2007-09-03 Jesper Nilsson <jesper.nilsson@axis.com> 2007-09-03 Jesper Nilsson <jesper.nilsson@axis.com>
* config/cris/cris.h (TARGET_HAS_SWAP): Defined to describe * config/cris/cris.h (TARGET_HAS_SWAP): Defined to describe
......
...@@ -297,6 +297,7 @@ static void set_spec (const char *, const char *); ...@@ -297,6 +297,7 @@ static void set_spec (const char *, const char *);
static struct compiler *lookup_compiler (const char *, size_t, const char *); static struct compiler *lookup_compiler (const char *, size_t, const char *);
static char *build_search_list (const struct path_prefix *, const char *, static char *build_search_list (const struct path_prefix *, const char *,
bool, bool); bool, bool);
static void xputenv (char *);
static void putenv_from_prefixes (const struct path_prefix *, const char *, static void putenv_from_prefixes (const struct path_prefix *, const char *,
bool); bool);
static int access_check (const char *, int); static int access_check (const char *, int);
...@@ -2598,6 +2599,16 @@ add_to_obstack (char *path, void *data) ...@@ -2598,6 +2599,16 @@ add_to_obstack (char *path, void *data)
return NULL; return NULL;
} }
/* Add or change the value of an environment variable, outputting the
change to standard error if in verbose mode. */
static void
xputenv (char *string)
{
if (verbose_flag)
notice ("%s\n", string);
putenv (string);
}
/* Build a list of search directories from PATHS. /* Build a list of search directories from PATHS.
PREFIX is a string to prepend to the list. PREFIX is a string to prepend to the list.
If CHECK_DIR_P is true we ensure the directory exists. If CHECK_DIR_P is true we ensure the directory exists.
...@@ -2632,7 +2643,7 @@ static void ...@@ -2632,7 +2643,7 @@ static void
putenv_from_prefixes (const struct path_prefix *paths, const char *env_var, putenv_from_prefixes (const struct path_prefix *paths, const char *env_var,
bool do_multi) bool do_multi)
{ {
putenv (build_search_list (paths, env_var, true, do_multi)); xputenv (build_search_list (paths, env_var, true, do_multi));
} }
/* Check whether NAME can be accessed in MODE. This is like access, /* Check whether NAME can be accessed in MODE. This is like access,
...@@ -3413,7 +3424,7 @@ process_command (int argc, const char **argv) ...@@ -3413,7 +3424,7 @@ process_command (int argc, const char **argv)
standard_bindir_prefix, standard_bindir_prefix,
standard_libexec_prefix); standard_libexec_prefix);
if (gcc_exec_prefix) if (gcc_exec_prefix)
putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL)); xputenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
} }
else else
{ {
...@@ -4332,7 +4343,7 @@ set_collect_gcc_options (void) ...@@ -4332,7 +4343,7 @@ set_collect_gcc_options (void)
} }
} }
obstack_grow (&collect_obstack, "\0", 1); obstack_grow (&collect_obstack, "\0", 1);
putenv (XOBFINISH (&collect_obstack, char *)); xputenv (XOBFINISH (&collect_obstack, char *));
} }
/* Process a spec string, accumulating and running commands. */ /* Process a spec string, accumulating and running commands. */
...@@ -6218,11 +6229,11 @@ main (int argc, char **argv) ...@@ -6218,11 +6229,11 @@ main (int argc, char **argv)
obstack_init (&collect_obstack); obstack_init (&collect_obstack);
obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1); obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1);
obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1); obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1);
putenv (XOBFINISH (&collect_obstack, char *)); xputenv (XOBFINISH (&collect_obstack, char *));
#ifdef INIT_ENVIRONMENT #ifdef INIT_ENVIRONMENT
/* Set up any other necessary machine specific environment variables. */ /* Set up any other necessary machine specific environment variables. */
putenv (INIT_ENVIRONMENT); xputenv (INIT_ENVIRONMENT);
#endif #endif
/* Make a table of what switches there are (switches, n_switches). /* Make a table of what switches there are (switches, n_switches).
......
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