On 1/19/21 6:27 PM, Joseph Myers wrote:
On Tue, 19 Jan 2021, Nathan Sidwell wrote:
Joseph,
I was relying on this patch on the modules branch, but didn't realize the
implications when merging and thought it was just a cleanup. I'm not sure why
the driver wants to check here, rather than leave it to the compiler. Seems
optimizing for failure? The only difference I can think is that the diagnostic
might mention the driver name, rather than say (cc1plus), but that's a
different problem that I've also reported.
What do the error messages look like, before and after this patch, for the
various cases? (Response file missing; file handled by e.g. cc1plus
missing; file handled by the linker missing.)
here are some experiments:
known C++ non-existent file
OLD:
(1)devvm293:279>g++ -c nothing.cc
g++: error: nothing.cc: No such file or directory
g++: fatal error: no input files
compilation terminated.
NEW:
devvm293:277>./xg++ -B./ -c nothing.cc
cc1plus: fatal error: nothing.cc: No such file or directory
compilation terminated.
Specified as C++ non-existent file:
OLD:
(1)devvm293:280>g++ -c -x c++ nothing
g++: error: nothing: No such file or directory
g++: fatal error: no input files
compilation terminated.
NEW:
(1)devvm293:278>./xg++ -B./ -c -x c++ nothing
cc1plus: fatal error: nothing: No such file or directory
compilation terminated.
Unspecified non-existent file:
OLD:
1)devvm293:292>g++ -c nothing
g++: error: nothing: No such file or directory
g++: fatal error: no input files
compilation terminated.
NEW:
(1)devvm293:293>./xg++ -B./ -c nothing
xg++: warning: nothing: linker input file unused because linking not done
Specified as C++ non-existent response file:
OLD:
(1)devvm293:281>g++ -c -x c++ @nothing
g++: error: nothing: No such file or directory
g++: fatal error: no input files
compilation terminated.
NEW:
(1)devvm293:283>./xg++ -B./ -c -x c++ @nothing
cc1plus: fatal error: @nothing: No such file or directory
compilation terminated.
Unspecified non-existent response file:
OLD:
(1)devvm293:282>g++ -c @nothing
g++: error: nothing: No such file or directory
g++: fatal error: no input files
compilation terminated.
NEW:
(1)devvm293:284>./xg++ -B./ -c @nothing
xg++: warning: @nothing: linker input file unused because linking not done
Non-existent linker file:
OLD:
1)devvm293:300>g++ nothing gcc.o
g++: error: nothing: No such file or directory
NEW:
1)devvm293:299>./xg++ -B./ nothing gcc.o
/data/users/nathans/tools/lib/gcc/x86_64-pc-linux-gnu/10.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
cannot find nothing: No such file or directory
collect2: error: ld returned 1 exit status
We already have ways of making 'cc1plus' appear on the error line,
here's a module-specific case, but I'm sure there are others?
(1)devvm293:298>./xg++ -B./ -c n.cc -fmodule-header=bob
cc1plus: error: unknown header kind 'bob'
The check here dates back to commit
48fb792a91a6b0850d723dc87bcc18eeab7ac3f5 from 1993, so we don't have any
further explanation of what motivated it.
wow, ancient history :)
nathan
--
Nathan Sidwell