* Having the driver output environment variables when using -v -v?
@ 2007-08-23 17:10 François-Xavier Coudert
2007-08-31 3:39 ` Mark Mitchell
0 siblings, 1 reply; 2+ messages in thread
From: François-Xavier Coudert @ 2007-08-23 17:10 UTC (permalink / raw)
To: gcc-patches
Hi all,
As part of a recent debugging, I modified gcc/gcc.c so that when -v is
used twice, environment variables modification are output, such as:
$ gfortran.exe -v -v a.f90
Driving: C:\msys\1.0.10\home\FX\irun\mingw\bin\gfortran.exe -v -v
a.f90 -lgfortranbegin -lgfortran
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/FX/local
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --disable-nls
--build=i386-pc-mingw32 --enable-libgomp
Thread model: win32
gcc version 4.3.0 20070822 (experimental) (GCC)
Setting environment variable COLLECT_GCC_OPTIONS='-v' '-v' '-mtune=i386'
c:/msys/1.0.10/home/fx/irun/mingw/bin/../libexec/gcc/i386-pc-mingw32/4.3.0/f951.exe
a.f90 -quiet -dumpbase a.f90 -mtune=i386 -auxbase a -version
-fintrinsic-modules-path
c:/msys/1.0.10/home/fx/irun/mingw/bin/../lib/gcc/i386-pc-mingw32/4.3.0/finclude
-o C:/DOCUME~1/FX/LOCALS~1/Temp/ccpEQksF.s
[...]
I thought it would be nice to have in mainline; what do you think?
FX
Index: gcc.c
===================================================================
--- gcc.c (revision 127707)
+++ gcc.c (working copy)
@@ -2632,7 +2632,12 @@
putenv_from_prefixes (const struct path_prefix *paths, const char *env_var,
bool do_multi)
{
- putenv (build_search_list (paths, env_var, true, do_multi));
+ const char *str;
+
+ str = build_search_list (paths, env_var, true, do_multi);
+ putenv (str);
+ if (verbose_flag >= 2)
+ notice ("Setting environment variable %s\n", str);
}
/* Check whether NAME can be accessed in MODE. This is like access,
@@ -3413,7 +3418,12 @@
standard_bindir_prefix,
standard_libexec_prefix);
if (gcc_exec_prefix)
- putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
+ {
+ const char *str = concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL);
+ putenv (str);
+ if (verbose_flag >= 2)
+ notice ("Setting environment variable %s\n", str);
+ }
}
else
{
@@ -4286,6 +4296,7 @@
{
int i;
int first_time;
+ const char *str;
/* Build COLLECT_GCC_OPTIONS to have all of the options specified to
the compiler. */
@@ -4332,7 +4343,10 @@
}
}
obstack_grow (&collect_obstack, "\0", 1);
- putenv (XOBFINISH (&collect_obstack, char *));
+ str = XOBFINISH (&collect_obstack, char *);
+ putenv (str);
+ if (verbose_flag >= 2)
+ notice ("Setting environment variable %s\n", str);
}
/* Process a spec string, accumulating and running commands. */
@@ -6118,6 +6132,7 @@
int num_linker_inputs = 0;
char *explicit_link_files;
char *specs_file;
+ const char *str;
const char *p;
struct user_specs *uptr;
char **old_argv = argv;
@@ -6218,11 +6233,16 @@
obstack_init (&collect_obstack);
obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1);
obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1);
- putenv (XOBFINISH (&collect_obstack, char *));
+ str = XOBFINISH (&collect_obstack, char *);
+ putenv (str);
+ if (verbose_flag >= 2)
+ notice ("Setting environment variable %s\n", str);
#ifdef INIT_ENVIRONMENT
/* Set up any other necessary machine specific environment variables. */
putenv (INIT_ENVIRONMENT);
+ if (verbose_flag >= 2)
+ notice ("Setting environment variable %s\n", INIT_ENVIRONMENT);
#endif
/* Make a table of what switches there are (switches, n_switches).
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Having the driver output environment variables when using -v -v?
2007-08-23 17:10 Having the driver output environment variables when using -v -v? François-Xavier Coudert
@ 2007-08-31 3:39 ` Mark Mitchell
0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2007-08-31 3:39 UTC (permalink / raw)
To: François-Xavier Coudert; +Cc: gcc-patches
François-Xavier Coudert wrote:
> Hi all,
>
> As part of a recent debugging, I modified gcc/gcc.c so that when -v is
> used twice, environment variables modification are output, such as:
> I thought it would be nice to have in mainline; what do you think?
I think it's a nice idea. I don't think you need to have the extra v;
you can just always do it:
Also, I suggest printing the environment variable assignment as a valid
Bourne shell assignment:
COLLECT_GCC="-v -mtune=i386"
Then, many readers will be able to just paste that into their shell.
And, other users (say C shell) can make an easy transformation.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-31 3:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-23 17:10 Having the driver output environment variables when using -v -v? François-Xavier Coudert
2007-08-31 3:39 ` Mark Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).