winapi: Skip #if 0 sections.

They are typically used as 'super comments' and may not contain C code.
They are also typically not nested so this ignores nesting.

Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2020-04-14 16:57:12 +02:00 committed by Alexandre Julliard
parent 4c554940d4
commit 1c9077f13d
1 changed files with 15 additions and 1 deletions

View File

@ -240,7 +240,21 @@ sub parse_c_file($$) {
# remove preprocessor directives # remove preprocessor directives
if(s/^\s*\#/\#/s) { if(s/^\s*\#/\#/s) {
if(/^(\#.*?)\\$/s) { if (/^#\s*if\s+0\s*$/ms) {
# Skip #if 0 ... #endif sections entirely.
# They are typically used as 'super comments' and may not
# contain C code. This totally ignores nesting.
if(s/^(\s*#\s*if\s+0\s*\n.*?\n\s*#\s*endif\s*)\n//s) {
my @lines = split(/\n/, $1);
$_ = "\n" x $#lines;
&$preprocessor_found_callback("if", "0");
$again = 1;
} else {
$lookahead = 1;
}
next readmore;
}
elsif(/^(\#.*?)\\$/s) {
$_ = "$1\n"; $_ = "$1\n";
$lookahead = 1; $lookahead = 1;
next; next;