??Linux??????????????
???????????? ???????[ 2015/7/17 13:22:24 ] ??????????????
??????????Linux??????Щ??????????????????У????????????????Linux????coding style??????????????????????????CodingStyle???????????????????д??????????????????????????????? ???????????????????????????????????????drivers/staging?μ????????????????????????????????coding style???????????????????TODO??????????”checkpatch.pl fixes”???????????????checkpatch.pl??????????????????coding style????????
????????????coding style?????????????????????顣????Microsoft??????????????????????Linus????????????(brain damaged)????????????????????Linus?????coding style??????????????????????????????????????????????????????????????????????д???????????????????????????
?????Щ????????
??????????????????????????????????coding style???????????????????????????Щ?????????á?
????scripts/checkpatch.pl
?????????????????????????????淶?????????????壬checkpatch?????????patch????????????????????????????????????????“-f”????
???????????????????????(??????print_msg.c)??
????void print_msg(int a)
????{
????switch (a) {
????case 1:
????printf("a == 1
");
????break;
????case 2:
????printf("a == 2
");
????break;
????}
????}
??????δ????coding style??????????????checkpatch.pl???????£?
????scripts/checkpatch.pl -f print_msg.c
?????????????
????ERROR: switch and case should be at the same indent
????#3: FILE: switch.c:3:
????+ switch (a) {
????+ case 1:
????[...]
????+ case 2:
????total: 1 errors?? 0 warnings?? 12 lines checked
????switch.c has style problems?? please review. If any of these errors
????are false positives report them to the maintainer?? see
????CHECKPATCH in MAINTAINERS.
??????Linux????coding style??switch??case????????????????????????????????????????????????????????????????????????????
????scripts/Lindent
????scripts???μ????Lindent????????????????????????????£????Lindent????????indent????????
???????????????????????Lindent??????
????scripts/Lindent print_msg.c
??????????′??????
????void print_msg(int a)
????{
????switch (a) {
????case 1:
????printf("a == 1
");
????break;
????case 2:
????printf("a == 2
");
????break;
????}
????}
????sed
????sed???????????????????????????????????????????????????磬Linux????coding style?????β?????п??????Tab?????????Щ?????????sed??
????????????????????????????β?????Щ?????????д???????????????????????????????е????????????????????????????Kate??????????????????????е?????????????????Tab???????????
????????????Щ??β????????????????飬??????sed?????????????????????????£?
????sed ‘s/[ ]*$//g’ your_code.c
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11