<div dir="ltr">LGTM </div><div class="gmail_extra"><br><div class="gmail_quote">On 2 June 2015 at 08:58, Russell Gallop <span dir="ltr"><<a href="mailto:russell.gallop@gmail.com" target="_blank">russell.gallop@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi rafael,<br>
<br>
This revision has a couple of small changes to make check_cfc.py made so it works better with build systems.<br>
<br>
gcc/clang options which output dependency files instead of object files (e.g. -M, -MM) are identified and checks are not performed in these cases.<br>
<br>
When reporting a check failure, the input file name is reported which can help to identify where the problem was in large build logs, particularly with parallel builds.<br>
<br>
Please let me know if okay to commit?<br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10183&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=EfULTwfHZ0eLZZuHI0eSLUCJaGpmEeuRx22xyuha7pk&s=5GT9Ix87R3JxKYWECw8SPq1udIbnNNcen4XZUwmFGPg&e=" target="_blank">http://reviews.llvm.org/D10183</a><br>
<br>
Files:<br>
utils/check_cfc/check_cfc.py<br>
utils/check_cfc/test_check_cfc.py<br>
<br>
Index: utils/check_cfc/check_cfc.py<br>
===================================================================<br>
--- utils/check_cfc/check_cfc.py<br>
+++ utils/check_cfc/check_cfc.py<br>
@@ -213,16 +213,18 @@<br>
<br>
def is_normal_compile(args):<br>
"""Check if this is a normal compile which will output an object file rather<br>
- than a preprocess or link."""<br>
+ than a preprocess or link. args is a list of command line arguments."""<br>
compile_step = '-c' in args<br>
# Bitcode cannot be disassembled in the same way<br>
bitcode = '-flto' in args or '-emit-llvm' in args<br>
# Version and help are queries of the compiler and override -c if specified<br>
query = '--version' in args or '--help' in args<br>
+ # Options to output dependency files for make<br>
+ dependency = '-M' in args or '-MM' in args<br>
# Check if the input is recognised as a source file (this may be too<br>
# strong a restriction)<br>
input_is_valid = bool(get_input_file(args))<br>
- return compile_step and not bitcode and not query and input_is_valid<br>
+ return compile_step and not bitcode and not query and not dependency and input_is_valid<br>
<br>
def run_step(command, my_env, error_on_failure):<br>
"""Runs a step of the compilation. Reports failure as exception."""<br>
@@ -367,7 +369,7 @@<br>
checker.perform_check(arguments_a, my_env)<br>
except WrapperCheckException as e:<br>
# Check failure<br>
- print(e.msg, file=sys.stderr)<br>
+ print("{} {}".format(get_input_file(arguments_a), e.msg), file=sys.stderr)<br>
<br>
# Remove file to comply with build system expectations (no<br>
# output file if failed)<br>
Index: utils/check_cfc/test_check_cfc.py<br>
===================================================================<br>
--- utils/check_cfc/test_check_cfc.py<br>
+++ utils/check_cfc/test_check_cfc.py<br>
@@ -103,6 +103,16 @@<br>
check_cfc.is_normal_compile(['clang', '-c', 'test.cpp', '--version']))<br>
self.assertFalse(<br>
check_cfc.is_normal_compile(['clang', '-c', 'test.cpp', '--help']))<br>
+ # Outputting dependency files is not a normal compile<br>
+ self.assertFalse(<br>
+ check_cfc.is_normal_compile(['clang', '-c', '-M', 'test.cpp']))<br>
+ self.assertFalse(<br>
+ check_cfc.is_normal_compile(['clang', '-c', '-MM', 'test.cpp']))<br>
+ # Creating a dependency file as a side effect still outputs an object file<br>
+ self.assertTrue(<br>
+ check_cfc.is_normal_compile(['clang', '-c', '-MD', 'test.cpp']))<br>
+ self.assertTrue(<br>
+ check_cfc.is_normal_compile(['clang', '-c', '-MMD', 'test.cpp']))<br>
<br>
def test_replace_output_file(self):<br>
self.assertEqual(check_cfc.replace_output_file(<br>
<br>
EMAIL PREFERENCES<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=EfULTwfHZ0eLZZuHI0eSLUCJaGpmEeuRx22xyuha7pk&s=Xts_EQHeJ07H7le-IwXuYsqKgicNDJ8PRfG6ERqWejI&e=" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</blockquote></div><br></div>