fabiensanglard / dc

Driving Compilers
Apache License 2.0
30 stars 15 forks source link

driver.php: updated gcc -v example #25

Closed denilsonsa closed 1 year ago

denilsonsa commented 1 year ago

The original example omitted the important cc1 step, which was probably an oversight. It also had different temporary filenames between the executions, also an oversight.

This commit here tries to make the output more faithful (all three steps are visible), while redacting a lot of extra fluff from the output. In fact, we can dynamically filter it using this command:

gcc -v hello.c 2>&1 | grep '^ [^ ].* '

That will output just the lines starting with a single space, and that contain at least another space somewhere. That's enough to extract the three execution lines from the noisy output. They still have countless parameters in them, which need to be cleaned up manually.

This commit obsoletes the previous pull request https://github.com/fabiensanglard/dc/pull/16

You can see from the comments on that PR that both clang and gcc have similarly noisy outputs, and thus both were cleaned up for the article purposes (e.g. removed absolute paths, removed countless parameters, removed environment variables, …)