public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* where gcc -save-temps puts temporary files
@ 2008-01-14 16:10 Marty Leisner
  2008-01-15 12:40 ` Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: Marty Leisner @ 2008-01-14 16:10 UTC (permalink / raw)
  To: gcc-help; +Cc: leisner

gcc -save-temps is defined to leave temporaries in the current directory.
This works intuitively where the build writes the output files into the current
directory.  Not everything works that way.

It seems it makes more sense to always leave it alongside the output...

If I'm debugging a build (of something like the linux kernel) its
calling the C compiler with

gcc <flags> foo/bar/src.c -c  -o <dest>foo/bar/src.o

If I add -save-temps, it puts the .i and .s in the current directory...

I found this not intuitive and has the following problems:
   1) if current directory isn't writable, -save-temps won't work
   2) if multiple files in subdirectories have the same name (and different
paths) -save-temps will overwrite temporary files

Comments?  This would be an easy change to make.  Would it be desirable
to change the behavior of -save-temps?

marty

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: where gcc -save-temps puts temporary files
  2008-01-14 16:10 where gcc -save-temps puts temporary files Marty Leisner
@ 2008-01-15 12:40 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2008-01-15 12:40 UTC (permalink / raw)
  To: Marty Leisner; +Cc: gcc-help

Marty Leisner writes:
 > gcc -save-temps is defined to leave temporaries in the current directory.
 > This works intuitively where the build writes the output files into the current
 > directory.  Not everything works that way.
 > 
 > It seems it makes more sense to always leave it alongside the output...
 > 
 > If I'm debugging a build (of something like the linux kernel) its
 > calling the C compiler with
 > 
 > gcc <flags> foo/bar/src.c -c  -o <dest>foo/bar/src.o
 > 
 > If I add -save-temps, it puts the .i and .s in the current directory...
 > 
 > I found this not intuitive and has the following problems:
 >    1) if current directory isn't writable, -save-temps won't work
 >    2) if multiple files in subdirectories have the same name (and different
 > paths) -save-temps will overwrite temporary files
 > 
 > Comments?  This would be an easy change to make.  Would it be desirable
 > to change the behavior of -save-temps?

I don't agree.  It would make it impossible to follow a common
practice of cd'ing to a tmpdir and doing

   gcc /foo/bar/baz.c -o /foo/build/baz.o -save-temps

This suggested change is a bad idea.  Emitting to cwd is the most
convenient default for my usage.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-14 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-14 16:10 where gcc -save-temps puts temporary files Marty Leisner
2008-01-15 12:40 ` Andrew Haley

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).