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