This is an archive of the discontinued LLVM Phabricator instance.

Use gcc's rules for parsing gcc-style response files
ClosedPublic

Authored by thakis on Apr 22 2016, 9:21 AM.

Details

Reviewers
rnk
Summary

In gcc, \ escapes every character. It is true that this makes it harder to mention Windows files in rsp files, but not doing this means clang disagrees with gcc, and also disagrees with the shell (on non-Windows) which rsp file quoting is supposed to match. clang isn't free to choose what to do here.

In general, the idea for response files is to take bits of your command line and write them to a file unchanged, and have things work the same way. Since the command line would've been interpreted by the shell, things in the rsp file need to be subject to the same shell quoting rules.

People who want to put Windows-style paths in their response files either need to escape their backslashes, or use clang-cl which uses cl.exe/cmd.exe quoting rules.

Fixes PR27464.

Diff Detail

Event Timeline

thakis updated this revision to Diff 54668.Apr 22 2016, 9:21 AM
thakis retitled this revision from to Use gcc's rules for parsing gcc-style response files.
thakis updated this object.
thakis added a reviewer: rnk.
thakis updated this object.
thakis added a subscriber: llvm-commits.
rnk accepted this revision.Apr 22 2016, 10:25 AM
rnk edited edge metadata.

lgtm

I guess my change was a bad idea. This is changing three year old behavior, but I don't think it will cause too much breakage.

This revision is now accepted and ready to land.Apr 22 2016, 10:25 AM

In principle it's hard to disagree but this might be a backward-compatibility problem for PS4 (Windows hosted but using gcc style driver). At this point I honestly can't remember what our story is for response files. :-) but might not have a chance to investigate until Monday. Would you mind holding off just a bit?

lib/Support/CommandLine.cpp
535

Typo

Sure, no rush. I'm also adding an rsp quoting override flag in http://reviews.llvm.org/D19425 , maybe you could use that if this change is otherwise a problem for you?

Sure, no rush. I'm also adding an rsp quoting override flag in http://reviews.llvm.org/D19425 , maybe you could use that if this change is otherwise a problem for you?

Thanks for waiting. We force Windows parsing and can use the rsp-quoting flag to set our default accordingly. So, this change is no problem on our part.

thakis closed this revision.Apr 26 2016, 7:00 AM

Thanks for checking! Landed in r267556 and update clang's tests to match in r267557.