Mail Archives: djgpp/2000/12/17/01:57:10
Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk> wrote:
> Indeed there does seem to be a bug in gcc:
A bug? I don't see any bugs in the following:
> $ gcc -v
> Reading specs from d:/djgpp/lib/gcc-lib/djgpp/2.952/specs
> gcc version 2.95.2 19991024 (release)
> $ echo "int main(void){return 0;}" > foo.c
> $ cp foo.c ./-.c
> $ cp foo.c ./--.c
> $ cp foo.c ./---.c
> $ gcc foo.c
> $ gcc ./-.c
> $ gcc ./--.c
> $ gcc ./---.c
All correct so far, right?
> $ gcc -.c
> gcc.exe: unrecognized option `-.c'
> gcc.exe: No input files
A single dash means "gcc option" and .c is not a valid gcc option, so
this error is correct.
> $ gcc --.c
> gcc.exe: No input files
> $ gcc ---.c
> gcc.exe: No input files
> $ gcc ---
> gcc.exe: No input files
A double dash means "cc1 option" and it is passed to cc1 when cc1 is
invoked. Since you've given gcc no input files, cc1 is never given the
chance to reject the option.
However, there are several possible options beginning with -- which are
not passed to cc1, such as --version.
> $ gcc --
> gcc.exe: Ambiguous abbreviation --
> gcc.exe: No input files
> $ gcc -- foo.c
> gcc.exe: Ambiguous abbreviation --
And because of this, gcc can recognize several abbreviations beginning
with a double dash, and in this case it is ambiguous because more than
one option could follow the sequence given.
So this is correct as well.
> $ gcc --- foo.c
> cc1.exe: Invalid option `-f-'
That's how double dash options are translated into cc1 options, and is
correct behavior.
> Maybe the OP chose those filenames to demonstrate the bug??
What bug?
> For example: gxx ./-----.cpp -o ./-----.exe
Since you already know how to compile these, can I safely assume that
there is no invalid behavior causing you any problems? I have seen no
gcc bugs in the above.
--
naisbodo AT enteract DOT com
- Raw text -