check g_signal_new() calls

Original commit message from CVS:
check g_signal_new() calls
This commit is contained in:
David Schleef 2003-11-22 04:08:11 +00:00
parent 3863b258b2
commit 04d02e08b6
2 changed files with 44 additions and 0 deletions

View file

@ -38,6 +38,7 @@ sub check_debugging();
sub check_old_typefind(); sub check_old_typefind();
sub check_bad_casts(); sub check_bad_casts();
sub check_old_plugin(); sub check_old_plugin();
sub check_signal_new();
sub m_check_plugindir(); sub m_check_plugindir();
@ -69,6 +70,7 @@ foreach $filename (<FIND>) {
check_old_typefind(); check_old_typefind();
check_bad_casts(); check_bad_casts();
check_old_plugin(); check_old_plugin();
check_signal_new();
} }
open FIND, "find . -name \"Makefile.am\" -print|"; open FIND, "find . -name \"Makefile.am\" -print|";
@ -377,3 +379,23 @@ sub check_old_plugin()
} }
} }
#
# Check for calls to g_signal_new() with a callback type of G_TYPE_POINTER
#
sub check_signal_new()
{
my $n = 0;
my $lineno = 1;
foreach $line (@lines){
if($line =~ /g_signal_new/){
$n=5;
}
if($n>0 && $line =~ /G_TYPE_POINTER/){
print "W: ($lineno) g_signal_new() with callback type of G_TYPE_POINTER. Register and use a boxed type instead.\n";
return;
}
$n--;
$lineno++;
}
}

View file

@ -38,6 +38,7 @@ sub check_debugging();
sub check_old_typefind(); sub check_old_typefind();
sub check_bad_casts(); sub check_bad_casts();
sub check_old_plugin(); sub check_old_plugin();
sub check_signal_new();
sub m_check_plugindir(); sub m_check_plugindir();
@ -69,6 +70,7 @@ foreach $filename (<FIND>) {
check_old_typefind(); check_old_typefind();
check_bad_casts(); check_bad_casts();
check_old_plugin(); check_old_plugin();
check_signal_new();
} }
open FIND, "find . -name \"Makefile.am\" -print|"; open FIND, "find . -name \"Makefile.am\" -print|";
@ -377,3 +379,23 @@ sub check_old_plugin()
} }
} }
#
# Check for calls to g_signal_new() with a callback type of G_TYPE_POINTER
#
sub check_signal_new()
{
my $n = 0;
my $lineno = 1;
foreach $line (@lines){
if($line =~ /g_signal_new/){
$n=5;
}
if($n>0 && $line =~ /G_TYPE_POINTER/){
print "W: ($lineno) g_signal_new() with callback type of G_TYPE_POINTER. Register and use a boxed type instead.\n";
return;
}
$n--;
$lineno++;
}
}