]> git.ipfire.org Git - thirdparty/ccache.git/commit
Write debug log file in most argument processing error scenarios
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 4 Mar 2021 20:34:07 +0000 (21:34 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 5 Mar 2021 06:28:56 +0000 (07:28 +0100)
commit9f19f94ba7c795ce86c5aec5e274548745a3b809
treefdf2352ee1c1853a9192e8b454e25917b47fda3c
parent577656afb5f4a0ccdebe24409fa15b2ea60a3f58
Write debug log file in most argument processing error scenarios

When the debug mode is enabled, ccache writes the log to
<objectfile>.ccache-log, but that can only be done if the object file
location has been determined. If an unsupported compiler option is
detected, ccache exits early and may not yet have determined the output
object filename.

Fix this by parsing all compiler options, then determining the object
file location and only then return an error from the process_args
function with. This will in practice make the debug mode work for most
invocations. There are still edge cases where it won’t work or will be
potentially confusing, for instance these:

    ccache gcc -dumpspecs
    ccache gcc -c nonexistent.c
    ccache gcc -c foo.c bar.c

Naturally, no debug log file will be written in the first case. In the
second case no debug log file will be written either since ccache
doesn’t consider a nonexistent file to be an input file. In the third
case the debug log file will be written foo.o.ccache-log but not
bar.o.ccache-log.

As mentioned in issue #806.
src/argprocessing.cpp
test/suites/base.bash