>On Tue, Jul 03, 2018 at 04:23:07PM +0800, 王翔 wrote:<br><div><includetail><div style="font:Verdana normal 14px;color:#000;"><div style="position:relative;"><div><div style="font:Verdana normal 14px;color:#000;"><div style="position:relative;">>> I want submit some code to support temporarily block multiple-threads.<br>> >But this code can't pass check by `checkpatch`.<br><br>>What is the error that checkpatch prints out?<br><br>>If you can't see it, try running<br><br>>  util/lint/checkpatch.pl -f src/path/to/your/file.h<br><br>>directly.<br><br><br>>Hope that helps,<br>>Jonathan Neuschäfer</div><div style="position:relative;"><br></div><div style="position:relative;">Error print like this: <br></div><div style="position:relative;">```<br></div><div style="position:relative;">WARNING: Macros with flow control statements should be avoided<br>#43: FILE: src/arch/riscv/include/smp.h:43:<br>+#define SMP_PAUSE(active) do \<br>+{ \<br>+    __label__ l_entry, l_exit; \<br>+    static int _flag_; \<br>+    if (active == read_csr(mhartid)) \<br>+        goto l_entry; \<br>+    do {barrier(); } while (!_flag_); \<br>+    goto l_exit; \<br>+l_entry:<br><br>WARNING: please, no spaces at the start of a line<br>#45: FILE: src/arch/riscv/include/smp.h:45:<br>+    __label__ l_entry, l_exit; \$<br><br>WARNING: please, no spaces at the start of a line<br>#46: FILE: src/arch/riscv/include/smp.h:46:<br>+    static int _flag_; \$<br><br>WARNING: please, no spaces at the start of a line<br>#47: FILE: src/arch/riscv/include/smp.h:47:<br>+    if (active == read_csr(mhartid)) \$<br><br>ERROR: code indent should use tabs where possible<br>#48: FILE: src/arch/riscv/include/smp.h:48:<br>+        goto l_entry; \$<br><br>WARNING: please, no spaces at the start of a line<br>#48: FILE: src/arch/riscv/include/smp.h:48:<br>+        goto l_entry; \$<br><br>WARNING: please, no spaces at the start of a line<br>#49: FILE: src/arch/riscv/include/smp.h:49:<br>+    do {barrier(); } while (!_flag_); \$<br><br>WARNING: please, no spaces at the start of a line<br>#50: FILE: src/arch/riscv/include/smp.h:50:<br>+    goto l_exit; \$<br><br>ERROR: Macros with multiple statements should be enclosed in a do - while loop<br>#54: FILE: src/arch/riscv/include/smp.h:54:<br>+#define SMP_RESUME() \<br>+    _flag_ = 1; \<br>+l_exit: \<br>+    barrier(); \<br>+} while (0)<br><br>WARNING: please, no spaces at the start of a line<br>#55: FILE: src/arch/riscv/include/smp.h:55:<br>+    _flag_ = 1; \$<br><br>WARNING: please, no spaces at the start of a line<br>#57: FILE: src/arch/riscv/include/smp.h:57:<br>+    barrier(); \$<br><br>total: 2 errors, 9 warnings, 65 lines checked<br>```<br></div></div></div></div></div><!--<![endif]--></includetail></div>