Commit bc4a5ed3 authored by Richard Levitte's avatar Richard Levitte
Browse files

Transfer the changes to detect multiline comments and the GCC

extension __attribute__.
parent d5157a62
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -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;
+6 −6
Original line number Diff line number Diff line
@@ -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;