c++/9302: -o and -c preclude use of -include
riceman+gcc@mail.rit.edu
riceman+gcc@mail.rit.edu
Tue Jan 14 08:46:00 GMT 2003
>Number: 9302
>Category: c++
>Synopsis: -o and -c preclude use of -include
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 14 00:46:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Tim
>Release: 3.4 20030113 (experimental)
>Organization:
RIT
>Environment:
System: Linux scragen 2.4.20 #9 Sun Jan 5 12:41:42 EST 2003 i686 unknown unknown GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/home/riceman --program-suffix=-cust
>Description:
When using -o in conjunction with -c, it is no longer possible to use
-include.
I would guess it's related to precompiled headers (PCH for
keyword-searchers), but I'll leave it to someone more experienced to
decide that and mark the description as appropriate.
Projects like mozilla, which compiled without error in 3.2, will fail to
compile without (at least Makefile) modification on 3.4 as a result of
this bug.
>How-To-Repeat:
$ cat abc.cpp
int main() {
return 0;
}
$ cat abc.h
#define ABC 0
$ g++ --version
2.95.4
$ g++-3.2 --version
g++-3.2 (GCC) 3.2.2 20030109 (Debian prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
$ g++ -o abc.o -c abc.cpp -include abc.h
$ rm abc.o
$ g++-3.2 -o abc.o -c abc.cpp -include abc.h
$ rm abc.o
$ g++-cust -o abc.o -c abc.cpp -include abc.h
g++-cust: cannot specify -o with -c or -S and multiple compilations
Note that g++ is debian package g++ version 2.95.4-17 (mentioned for
completeness).
g++-cust, as shown in the fields, is compiled from CVS and installed
into my home directory.
Though seemingly particularly useless, the preprocessor output is as
follows:
$ g++ -o - -E abc.cpp
# 1 "abc.cpp"
int main() {
return 0;
}
$ g++-cust -o - -E abc.cpp
# 1 "abc.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "abc.cpp"
int main() {
return 0;
}
Output similar to the last example can be seen from g++-3.2.
(above can be seen 'built-in' and 'command-line' within angle brackets,
which will probably be filtered out by the submission process).
>Fix:
Workaround: migrate the -include to a #include within the file to avoid
the error.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list