public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc-3.2 -MD -o misbehaviour
       [not found]           ` <2960.198.102.182.102.1033495681.squirrel@mercury.axian.com>
@ 2002-10-01 22:56             ` Martin Pool
  2002-10-14 13:09               ` Neil Booth
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Pool @ 2002-10-01 22:56 UTC (permalink / raw)
  To: bje, gcc, Alexandre Oliva; +Cc: distcc

The manual from Debian Sid's gcc-3.2 (3.2.1-0pre3) says

     If `-MD' is used in conjunction with `-E', any `-o' switch is
     understood to specify the dependency output file (but *note
     -MF::), but if used without `-E', each `-o' is understood to
     specify a target object file.

But this doesn't happen:

    !1169 15:18 /tmp/test% ls -l
    total 4
    -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
    !1171 15:18 /tmp/test% gcc-3.2 -MD -E -o hello.out hello.c
    !1172 15:18 /tmp/test% ls -la
    total 80
    drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 15:18 .
    drwxrwxrwt   15 root     root        49152 2002-10-02 15:17 ..
    -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
    -rw-r--r--    1 mbp      mbp           536 2002-10-02 15:18 hello.d
    -rw-r--r--    1 mbp      mbp         18019 2002-10-02 15:18 hello.out

Actually I'm glad, this doesn't work.  Overriding -o to specify the
destination of dependency output seems needlessly complex since there
is already -MF.  Personally I'd prefer you pull this out of the
documentation rather than making -o actually specify the output file.

-- 
Martin 

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

* Re: gcc-3.2 -MD -o misbehaviour
  2002-10-01 22:56             ` gcc-3.2 -MD -o misbehaviour Martin Pool
@ 2002-10-14 13:09               ` Neil Booth
  2002-10-15  1:29                 ` Martin Pool
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Booth @ 2002-10-14 13:09 UTC (permalink / raw)
  To: Martin Pool; +Cc: gcc, Zack Weinberg

Martin Pool wrote:-

> The manual from Debian Sid's gcc-3.2 (3.2.1-0pre3) says
> 
>      If `-MD' is used in conjunction with `-E', any `-o' switch is
>      understood to specify the dependency output file (but *note
>      -MF::), but if used without `-E', each `-o' is understood to
>      specify a target object file.
> 
> But this doesn't happen:
> 
>     !1169 15:18 /tmp/test% ls -l
>     total 4
>     -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
>     !1171 15:18 /tmp/test% gcc-3.2 -MD -E -o hello.out hello.c
>     !1172 15:18 /tmp/test% ls -la
>     total 80
>     drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 15:18 .
>     drwxrwxrwt   15 root     root        49152 2002-10-02 15:17 ..
>     -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
>     -rw-r--r--    1 mbp      mbp           536 2002-10-02 15:18 hello.d
>     -rw-r--r--    1 mbp      mbp         18019 2002-10-02 15:18 hello.out
> 
> Actually I'm glad, this doesn't work.  Overriding -o to specify the
> destination of dependency output seems needlessly complex since there
> is already -MF.  Personally I'd prefer you pull this out of the
> documentation rather than making -o actually specify the output file.

Yeah, it's a doc bug.  The behaviour of -M and -MD with or without -o
and/or -E is kinda complicated and is different for almost each case; but
I believe that gcc != 3.0.x all agree behaviour, and there is some kind
of coherent underlying logic though it may not be obvious.  I spent ages
with Chris Demetriou sorting this mess out.

Zack, could you have a go at fixing this?  I'm frozen out until I get
paperwork through the system.

Thanks,

Neil.

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

* Re: gcc-3.2 -MD -o misbehaviour
  2002-10-14 13:09               ` Neil Booth
@ 2002-10-15  1:29                 ` Martin Pool
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Pool @ 2002-10-15  1:29 UTC (permalink / raw)
  To: Neil Booth; +Cc: gcc, Zack Weinberg

On 14 Oct 2002, Neil Booth <neil@daikokuya.co.uk> wrote:
> Martin Pool wrote:-
> 
> > The manual from Debian Sid's gcc-3.2 (3.2.1-0pre3) says
> > 
> >      If `-MD' is used in conjunction with `-E', any `-o' switch is
> >      understood to specify the dependency output file (but *note
> >      -MF::), but if used without `-E', each `-o' is understood to
> >      specify a target object file.
> > 
> > But this doesn't happen:
> > 
> >     !1169 15:18 /tmp/test% ls -l
> >     total 4
> >     -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
> >     !1171 15:18 /tmp/test% gcc-3.2 -MD -E -o hello.out hello.c
> >     !1172 15:18 /tmp/test% ls -la
> >     total 80
> >     drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 15:18 .
> >     drwxrwxrwt   15 root     root        49152 2002-10-02 15:17 ..
> >     -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
> >     -rw-r--r--    1 mbp      mbp           536 2002-10-02 15:18 hello.d
> >     -rw-r--r--    1 mbp      mbp         18019 2002-10-02 15:18 hello.out
> > 
> > Actually I'm glad, this doesn't work.  Overriding -o to specify the
> > destination of dependency output seems needlessly complex since there
> > is already -MF.  Personally I'd prefer you pull this out of the
> > documentation rather than making -o actually specify the output file.
> 
> Yeah, it's a doc bug.  The behaviour of -M and -MD with or without -o
> and/or -E is kinda complicated and is different for almost each case; but
> I believe that gcc != 3.0.x all agree behaviour, and there is some kind
> of coherent underlying logic though it may not be obvious.  I spent ages
> with Chris Demetriou sorting this mess out.

I would very much like you to keep it working as it actually does in
3.2, rather than as documented.  

At the risk of flogging a dead horse, here are some reasons against
making -o specify the dependency output:

 - This breaks existing behaviour which distcc and possibly other
   programs or Makefiles depend upon.

 - Doing it that way denies a useful behaviour (producing both
   preprocessed source and dependencies), without adding anything
   useful in return.
 
 - The distcc client needs to generate both preprocessed source and
   dependencies, if the user wants dependencies.  If "-MD -E" causes
   preprocessed output to go nowhere, then apparently the only
   possibility is to call gcc twice, which is wasteful.  I think
   distcc is a useful program, and will be better in the
   future, so I hope the gcc team might pay a little attention to not
   breaking it.  (I realize it's not your most important customer.)

 - The "intention" of the -MD option, as far as I can see, is to turn
   on a side-effect of cpp, rather than changing the whole action of
   the compiler (as -E does).  To me (ignorant of the internals),
   generating dependencies as a side-effect makes a lot of sense.
   Interfering with -o changes the whole feeling of the thing.  Making
   it sometimes a sideeffect and sometimes not sounds crazy.

-- 
Martin					Discontent Provider
(please cc me on replies)

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

end of thread, other threads:[~2002-10-15  6:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2683.198.102.182.67.1033413284.squirrel@mercury.axian.com>
     [not found] ` <20020930220940.GA1213@toey.sourcefrog.net>
     [not found]   ` <4710.198.102.182.67.1033427430.squirrel@mercury.axian.com>
     [not found]     ` <20020930234356.GA14232@samba.org>
     [not found]       ` <62621.216.99.197.112.1033440272.squirrel@mercury.axian.com>
     [not found]         ` <20021001060338.GE14232@samba.org>
     [not found]           ` <2960.198.102.182.102.1033495681.squirrel@mercury.axian.com>
2002-10-01 22:56             ` gcc-3.2 -MD -o misbehaviour Martin Pool
2002-10-14 13:09               ` Neil Booth
2002-10-15  1:29                 ` Martin Pool

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