public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* default output file of gcc in the absence of -o
@ 2003-01-27 14:31 Jan Beulich
  2003-01-27 15:02 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2003-01-27 14:31 UTC (permalink / raw)
  To: gcc

Hello,

on platforms which (traditionally) do not use fixed default linker
output names (like a.out) we found it impossible to teach gcc to derive
the name so it can be properly passed to the linker; the only
alternative was to instead modify the asm_options spec to prevent using
random temporary file names (instead have the assembler produce output
file names derived from the input ones) and then have the linker do the
name derivation. (As a side note, GNU ld on Cygwin produces a.exe by
default, rather than a sensefully named executable as would be the
'normal', that is Microsoft's, behavior - perhaps a result of the same
problem?) This doesn't seem ideal, though. It would thus seem rather
desirable to have gcc support an additional '%'-sequence for expressing
references to the first 'real' input file ('real' because internally
other things get stored as if they were input files).

Looking forward to opinions,
Jan

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

* default output file of gcc in the absence of -o
  2003-01-27 14:31 default output file of gcc in the absence of -o Jan Beulich
@ 2003-01-27 15:02 ` Andrew Haley
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2003-01-27 15:02 UTC (permalink / raw)
  To: Jan Beulich; +Cc: gcc

Jan Beulich writes:
 > 
 > on platforms which (traditionally) do not use fixed default linker
 > output names (like a.out) we found it impossible to teach gcc to derive
 > the name so it can be properly passed to the linker; the only
 > alternative was to instead modify the asm_options spec to prevent using
 > random temporary file names (instead have the assembler produce output
 > file names derived from the input ones) and then have the linker do the
 > name derivation. (As a side note, GNU ld on Cygwin produces a.exe by
 > default, rather than a sensefully named executable as would be the
 > 'normal', that is Microsoft's, behavior - perhaps a result of the same
 > problem?) This doesn't seem ideal, though. It would thus seem rather
 > desirable to have gcc support an additional '%'-sequence for expressing
 > references to the first 'real' input file ('real' because internally
 > other things get stored as if they were input files).

I don't understand what you are trying to do.  If the compiler line
has a list of file names as input, such as

   gcc foo.o bar.c baz.o

there is no way to determine whether the ouput file should be named
foo, bar, or baz -- it makes just as much sense to name the output
file a.exe.  And if you really care what the ouput file is to be
called, you give it a name with "-o".

Also, giving the output file a name such as foo.exe if the user by
mistake fails to provide a name for the output is risky.  The user
might already have a file called foo.exe and now it's been deleted
because of a small mistake.  Okay, that would also be true if there
was a file called a.exe, but no-one should do that.

So, in my opinion this convention solves no problems and causes an
additional risk.

Andrew.

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

* Re: default output file of gcc in the absence of -o
@ 2003-01-27 17:39 Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2003-01-27 17:39 UTC (permalink / raw)
  To: aph; +Cc: gcc

Take for given that the convention is that way. The point is not to make
gcc default to that, but to permit the specs to be written to conform to
that convention for certain platforms. I for myself consider it rather
useful especially when there is just a single input file - i.e. "gcc
test.c" would result in test or test.some-extension rather than a.out,
a.exe, or whetherever else hard coded output name defaults exist, and I
am appearantly not alone since I have others requesting this
functionality for our platform.

Thanks, Jan

>>> Andrew Haley <aph@redhat.com> 27.01.03 12:55:02 >>>
Jan Beulich writes:
 > 
 > on platforms which (traditionally) do not use fixed default linker
 > output names (like a.out) we found it impossible to teach gcc to
derive
 > the name so it can be properly passed to the linker; the only
 > alternative was to instead modify the asm_options spec to prevent
using
 > random temporary file names (instead have the assembler produce
output
 > file names derived from the input ones) and then have the linker do
the
 > name derivation. (As a side note, GNU ld on Cygwin produces a.exe
by
 > default, rather than a sensefully named executable as would be the
 > 'normal', that is Microsoft's, behavior - perhaps a result of the
same
 > problem?) This doesn't seem ideal, though. It would thus seem
rather
 > desirable to have gcc support an additional '%'-sequence for
expressing
 > references to the first 'real' input file ('real' because
internally
 > other things get stored as if they were input files).

I don't understand what you are trying to do.  If the compiler line
has a list of file names as input, such as

   gcc foo.o bar.c baz.o

there is no way to determine whether the ouput file should be named
foo, bar, or baz -- it makes just as much sense to name the output
file a.exe.  And if you really care what the ouput file is to be
called, you give it a name with "-o".

Also, giving the output file a name such as foo.exe if the user by
mistake fails to provide a name for the output is risky.  The user
might already have a file called foo.exe and now it's been deleted
because of a small mistake.  Okay, that would also be true if there
was a file called a.exe, but no-one should do that.

So, in my opinion this convention solves no problems and causes an
additional risk.

Andrew.

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

end of thread, other threads:[~2003-01-27 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-27 14:31 default output file of gcc in the absence of -o Jan Beulich
2003-01-27 15:02 ` Andrew Haley
2003-01-27 17:39 Jan Beulich

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