Bug 29270 - "--" does not end option parsing
Summary: "--" does not end option parsing
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-09-28 11:16 UTC by Andreas Schwab
Modified: 2021-09-11 23:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-10-02 17:46:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2006-09-28 11:16:01 UTC
$ gcc hello.c -- -MM
hello.o: hello.c
gcc: ambiguous abbreviation --
Comment 1 Andreas Schwab 2006-09-28 11:21:07 UTC
See also the thread at <http://lists.gnu.org/archive/html/automake/2006-09/msg00081.html>.
Comment 2 Andrew Pinski 2006-09-28 14:59:13 UTC
Hmm, one problem is that we need to know when we should pass -- on to cc1, etc. also.  For an example:

gcc t.c -- -l.c

is that -l.c a c source or a library for ld to have at and how do we invoke ld then:
with "-- -l.c" or just "-l.c"
Comment 3 jsm-csl@polyomino.org.uk 2006-09-28 15:04:40 UTC
Subject: Re:  "--" does not end option parsing

On Thu, 28 Sep 2006, pinskia at gcc dot gnu dot org wrote:

> Hmm, one problem is that we need to know when we should pass -- on to cc1, etc.
> also.  For an example:
> 
> gcc t.c -- -l.c
> 
> is that -l.c a c source or a library for ld to have at and how do we invoke ld
> then:
> with "-- -l.c" or just "-l.c"

It's a source file - everything after -- should be a source or object file 
according to the suffix.  -lfoo would mean that an object file called 
literally -lfoo is to be linked, not libfoo.a.  You could either pass -- 
to ld or change -lfoo to ./-lfoo.

Comment 4 Andrew Pinski 2006-10-02 17:46:28 UTC
Confirmed.