summaryrefslogtreecommitdiff
path: root/check_inits_clears
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-08-11 22:38:54 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-08-11 22:38:54 +0000
commit53d54b5d275d48882cfb30de4dfc8d829af99805 (patch)
tree1fd36298c36d6c47ec169348ce1c38a05df3dadb /check_inits_clears
parent0db3b2aa219482635c77b03f14aefd943d32ac4a (diff)
downloadmpfr-53d54b5d275d48882cfb30de4dfc8d829af99805.tar.gz
Added check_inits_clears Perl script to check that a cast is performed
for the last argument of mpfr_inits, mpfr_inits2 and mpfr_clears. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4751 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'check_inits_clears')
-rwxr-xr-xcheck_inits_clears27
1 files changed, 27 insertions, 0 deletions
diff --git a/check_inits_clears b/check_inits_clears
new file mode 100755
index 000000000..139563947
--- /dev/null
+++ b/check_inits_clears
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+
+# Check that a cast is performed for the last argument of
+# mpfr_inits, mpfr_inits2 and mpfr_clears.
+
+use strict;
+use warnings;
+use File::Find;
+
+my $err = 0;
+find(\&wanted, '.');
+exit $err;
+
+sub wanted
+ {
+ /\.c$/ or return;
+ my $ctr = 0;
+ open FILE, '<', $_ or die;
+ while (<FILE>)
+ {
+ /^ +mpfr_(init|clear)s/ && ! /\) *(0|NULL)/ or next;
+ $ctr++ or print "Error found in $File::Find::name\n";
+ print;
+ $err = 1;
+ }
+ close FILE or die;
+ }