From 6efac7672f1aaf2d4762ac94c3038ffe283fe41e Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 31 Dec 2013 16:34:35 +0100 Subject: [PATCH] tool/fix_include_ifndef: consider license header --- tool/fix_include_ifndef | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tool/fix_include_ifndef b/tool/fix_include_ifndef index 3a96ed9cc..f11765e7c 100755 --- a/tool/fix_include_ifndef +++ b/tool/fix_include_ifndef @@ -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