Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
343e53ab
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
343e53ab
编写于
11月 14, 2014
作者:
M
Martin Kletzander
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bracket-spacing-check: Print out more specific error message
Signed-off-by:
N
Martin Kletzander
<
mkletzan@redhat.com
>
上级
5e1af759
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
1 deletion
+9
-1
build-aux/bracket-spacing.pl
build-aux/bracket-spacing.pl
+8
-0
cfg.mk
cfg.mk
+1
-1
未找到文件。
build-aux/bracket-spacing.pl
浏览文件 @
343e53ab
...
@@ -89,6 +89,7 @@ foreach my $file (@ARGV) {
...
@@ -89,6 +89,7 @@ foreach my $file (@ARGV) {
if
(
$kw
=~
/^(if|for|while|switch|return)$/
)
{
if
(
$kw
=~
/^(if|for|while|switch|return)$/
)
{
$tmpdata
=~
s/($kw\s\()/XXX(/
;
$tmpdata
=~
s/($kw\s\()/XXX(/
;
}
else
{
}
else
{
print
"
Whitespace after non-keyword:
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
last
;
last
;
...
@@ -99,12 +100,14 @@ foreach my $file (@ARGV) {
...
@@ -99,12 +100,14 @@ foreach my $file (@ARGV) {
# but none after the opening bracket
# but none after the opening bracket
if
(
$data
=~
/\b(if|for|while|switch|return)\(/
||
if
(
$data
=~
/\b(if|for|while|switch|return)\(/
||
$data
=~
/\b(if|for|while|switch|return)\s+\(\s/
)
{
$data
=~
/\b(if|for|while|switch|return)\s+\(\s/
)
{
print
"
No whitespace after keyword:
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
# Forbid whitespace between )( of a function typedef
# Forbid whitespace between )( of a function typedef
if
(
$data
=~
/\(\*\w+\)\s+\(/
)
{
if
(
$data
=~
/\(\*\w+\)\s+\(/
)
{
print
"
Whitespace between ')' and '(':
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
...
@@ -112,6 +115,7 @@ foreach my $file (@ARGV) {
...
@@ -112,6 +115,7 @@ foreach my $file (@ARGV) {
# Forbid whitespace following ( or prior to )
# Forbid whitespace following ( or prior to )
if
(
$data
=~
/\S\s+\)/
||
if
(
$data
=~
/\S\s+\)/
||
$data
=~
/\(\s+\S/
)
{
$data
=~
/\(\s+\S/
)
{
print
"
Whitespace after '(' or before ')':
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
...
@@ -127,6 +131,7 @@ foreach my $file (@ARGV) {
...
@@ -127,6 +131,7 @@ foreach my $file (@ARGV) {
# ;
# ;
#
#
if
(
$data
=~
/[^;\s]\s+[;,]/
)
{
if
(
$data
=~
/[^;\s]\s+[;,]/
)
{
print
"
Whitespace before (semi)colon:
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
...
@@ -134,12 +139,14 @@ foreach my $file (@ARGV) {
...
@@ -134,12 +139,14 @@ foreach my $file (@ARGV) {
# Require EOL, macro line continuation, or whitespace after ";".
# Require EOL, macro line continuation, or whitespace after ";".
# Allow "for (;;)" as an exception.
# Allow "for (;;)" as an exception.
if
(
$data
=~
/;[^ \\\n;)]/
)
{
if
(
$data
=~
/;[^ \\\n;)]/
)
{
print
"
Invalid character after semicolon:
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
# Require EOL, space, or enum/struct end after comma.
# Require EOL, space, or enum/struct end after comma.
if
(
$data
=~
/,[^ \\\n)}]/
)
{
if
(
$data
=~
/,[^ \\\n)}]/
)
{
print
"
Invalid character after comma:
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
...
@@ -150,6 +157,7 @@ foreach my $file (@ARGV) {
...
@@ -150,6 +157,7 @@ foreach my $file (@ARGV) {
$tmpdata
=~
s/(virAssertCmpInt\(.* ).?=,/$1op,/
;
$tmpdata
=~
s/(virAssertCmpInt\(.* ).?=,/$1op,/
;
if
(
$tmpdata
=~
/[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/
||
if
(
$tmpdata
=~
/[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/
||
$tmpdata
=~
/=[^= \\\n]/
)
{
$tmpdata
=~
/=[^= \\\n]/
)
{
print
"
Spacing around '=' or '==':
\n
";
print
"
$file
:$.:
$line
";
print
"
$file
:$.:
$line
";
$ret
=
1
;
$ret
=
1
;
}
}
...
...
cfg.mk
浏览文件 @
343e53ab
...
@@ -1030,7 +1030,7 @@ endif
...
@@ -1030,7 +1030,7 @@ endif
bracket-spacing-check
:
bracket-spacing-check
:
$(AM_V_GEN)files
=
`
$(VC_LIST)
|
grep
'\.c$$'
`
;
\
$(AM_V_GEN)files
=
`
$(VC_LIST)
|
grep
'\.c$$'
`
;
\
$(PERL)
$(top_srcdir)
/build-aux/bracket-spacing.pl
$$
files
||
\
$(PERL)
$(top_srcdir)
/build-aux/bracket-spacing.pl
$$
files
||
\
{
echo
'
$(ME)
: incorrect
whitespace
, see HACKING for rules'
1>&2
;
\
{
echo
'
$(ME)
: incorrect
formatting
, see HACKING for rules'
1>&2
;
\
exit
1
;
}
exit
1
;
}
# sc_po_check can fail if generated files are not built first
# sc_po_check can fail if generated files are not built first
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录