tool/fix_include_ifndef: consider license header

This commit is contained in:
Norman Feske 2013-12-31 16:34:35 +01:00 committed by Christian Helmuth
parent 8ca0f04ba0
commit 6efac7672f
1 changed files with 36 additions and 1 deletions

View File

@ -37,7 +37,7 @@ proc out {txtline} {
foreach line $lines {
incr i
if {$state == "comment_header_begin"} {
if {[regexp {^/*} $line]} {
set state comment_header
@ -68,6 +68,41 @@ foreach line $lines {
puts "Error (line $i): no empty line after comment header"
exit -1;
}
set state license_header_begin
out $line
continue
}
if {$state == "license_header_begin"} {
if {[regexp {^/*} $line]} {
set state license_header
out $line
continue
} else {
puts stderr "Error (line $i): missing license header"
exit -1;
}
}
if {$state == "license_header"} {
if {[regexp {^ \*/} $line]} {
set state empty_line_after_license_header
out $line
continue;
}
if {[regexp {^ \*[^/]*} $line]} {
out $line
continue
}
puts "Error (line $i): non-complient license header"
exit -1;
}
if {$state == "empty_line_after_license_header"} {
if {![regexp {^$} $line]} {
puts "Error (line $i): no empty line after license header"
exit -1;
}
set state ifndef
out $line
continue