File: check_init_asserts

package info (click to toggle)
rust-gtk 0.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,792 kB
  • sloc: makefile: 20; sh: 17
file content (19 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

perl -0777 -ne '
BEGIN { $e = 0 }
while (/^(\N*)\V*fn\s+(\w+)\s*(<[^(]+>)?\s*(\([^{;]+)\{\N*\n^(\N*)$/gms) {
	($modifiers, $name, $signature, $first_line) = ($1, $2, $4, $5);
	unless ($modifiers =~ /^\s*(\/\/|(pub )?unsafe)/ ||
		$signature =~ /^\((&(\x27\w+ )?)?(mut )?self\b/ ||
		$signature =~ /^\(\)/ ||
		$first_line =~ /^\s*(
			assert_initialized_main_thread |
			assert_not_initialized |
			skip_assert_initialized
		)!\(\)/x) {
		print "$ARGV: $name$signature\n";
		$e = 1
	}
}
END { exit $e }' src/*.rs src/auto/*.rs