Transfer the changes to detect multiline comments and the GCC

extension __attribute__.
This commit is contained in:
Richard Levitte 2003-04-04 14:21:04 +00:00
parent d5157a6244
commit bc4a5ed341
2 changed files with 16 additions and 11 deletions

View file

@ -440,7 +440,12 @@ sub do_defs
}
s/\/\*.*?\*\///gs; # ignore comments
if (/\/\*/) { # if we have part
$line = $_; # of a comment,
next; # continue reading
}
s/{[^{}]*}//gs; # ignore {} blocks
print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne "";
print STDERR "DEBUG: \$_=\"$_\"\n" if $debug;
if (/^\#\s*ifndef\s+(.*)/) {
push(@tag,"-");
@ -814,14 +819,14 @@ sub do_defs
} elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) {
$s = $1;
print STDERR "DEBUG: found ANSI C function $s\n" if $debug;
} elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) {
} elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s) {
# K&R C
print STDERR "DEBUG: found K&R C function $s\n" if $debug;
next;
} elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)$/s) {
while (not /\(\)$/s) {
s/[^\(\)]*\)$/\)/s;
s/\([^\(\)]*\)\)$/\)/s;
} elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) {
while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) {
s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
}
s/\(void\)//;
/(\w+(\{[0-9]+\})?)\W*\(\)/s;

View file

@ -132,16 +132,16 @@ while (($hdr, $lib) = each %libinc)
my $name = $1;
$name =~ tr/[a-z]/[A-Z]/;
$ftrans{$name} = $1;
} elsif (/\w+\W+(\w+)\W*\(\s*\)$/s){
} elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s){
# K&R C
next ;
} elsif (/\w+\W+\w+\W*\(.*\)$/s) {
while (not /\(\)$/s) {
s/[^\(\)]*\)$/\)/s;
s/\([^\(\)]*\)\)$/\)/s;
} elsif (/\w+\W+\w+\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) {
while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) {
s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
}
s/\(void\)//;
/(\w+)\W*\(\)/s;
/(\w+(\{[0-9]+\})?)\W*\(\)/s;
my $name = $1;
$name =~ tr/[a-z]/[A-Z]/;
$ftrans{$name} = $1;