[glibmm/gmmproc-refactor] Fix a bunch of smaller issues.



commit 7e32d56a4fa9687c33ec1f3635f2029ba98d16ca
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Sun Jul 22 17:32:54 2012 +0200

    Fix a bunch of smaller issues.

 tools/pm/Common/Output/Method.pm |    5 +++--
 tools/pm/Common/Output/Shared.pm |   26 +++++++++++++++++++-------
 tools/pm/Common/WrapParser.pm    |   14 ++++++++------
 3 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/tools/pm/Common/Output/Method.pm b/tools/pm/Common/Output/Method.pm
index e6ab06a..09ed11d 100644
--- a/tools/pm/Common/Output/Method.pm
+++ b/tools/pm/Common/Output/Method.pm
@@ -209,7 +209,7 @@ sub _output_cc ($$$$$$$$$$$$$$$$$)
       unless ($ret_void)
       {
         $code_string .= nl () .
-                        nl ('return retvalue;');
+                        nl ('  return retvalue;');
       }
     }
     else
@@ -228,7 +228,8 @@ sub _output_cc ($$$$$$$$$$$$$$$$$)
       }
     }
   }
-  $code_string .= nl ('}');
+  $code_string .= nl ('}') .
+                  nl ();
   if ($ifdef)
   {
     $code_string .= nl ('#endif // ' . $ifdef);
diff --git a/tools/pm/Common/Output/Shared.pm b/tools/pm/Common/Output/Shared.pm
index 30aeb2d..007c06c 100644
--- a/tools/pm/Common/Output/Shared.pm
+++ b/tools/pm/Common/Output/Shared.pm
@@ -48,10 +48,9 @@ sub doxy_skip_end ()
   return '#endif // DOXYGEN_SHOULD_SKIP_THIS';
 }
 
-sub open_namespaces ($)
+sub open_some_namespaces
 {
-  my ($wrap_parser) = @_;
-  my $namespaces = $wrap_parser->get_namespaces;
+  my ($namespaces) = @_;
   my $code_string = '';
 
   foreach my $opened_name (@{$namespaces})
@@ -63,10 +62,16 @@ sub open_namespaces ($)
   return $code_string;
 }
 
-sub close_namespaces ($)
+sub open_namespaces
 {
   my ($wrap_parser) = @_;
-  my $namespaces = $wrap_parser->get_namespaces;
+
+  return open_some_namespaces ($wrap_parser->get_namespaces ());
+}
+
+sub close_some_namespaces
+{
+  my ($namespaces) = @_;
   my $code_string = '';
 
   foreach my $closed_name (reverse @{$namespaces})
@@ -77,6 +82,13 @@ sub close_namespaces ($)
   return $code_string;
 }
 
+sub close_namespaces
+{
+  my ($wrap_parser, $namespaces) = @_;
+
+  return close_some_namespaces ($wrap_parser->get_namespaces ());
+}
+
 sub get_first_class ($)
 {
   my ($wrap_parser) = @_;
@@ -210,6 +222,7 @@ sub convert_members_to_strings ($)
   return \ strings;
 }
 
+# TODO: reorder the functions, so we don't have to declare them first.
 sub get_section ($$);
 sub get_variable ($$);
 
@@ -678,8 +691,7 @@ sub convzipstr ($$$$$)
   my $transfers_count = @{$transfers};
   my $substs_count = @{$substs};
 
-# TODO: throw runtime error or internal error or whatever.
-  #die if $from_types_count != $to_types_count or $to_types_count != $transfers_count or $transfers_count != $substs_count;
+# TODO: internal error.
   if ($from_types_count != $to_types_count)
   {
     $wrap_parser->fixed_error ('From types count should be equal to to types count.');
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 25f6548..60d9837 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -773,6 +773,10 @@ sub _maybe_warn_about_refreturn ($$$$)
 sub _maybe_warn_about_errthrow ($$$)
 {
   my ($self, $throws, $errthrow) = @_;
+  my $module = $self->{'module'};
+  my @silent_modules = ('GLib-2.0', 'GModule-2.0');
+
+  return if ($module ~~ @silent_modules);
 
   if (not $throws and $errthrow)
   {
@@ -883,8 +887,7 @@ sub _on_wrap_method ($)
     shift (@{$c_param_types});
     shift (@{$c_param_transfers});
   }
-
-  if ($cxx_function->get_static () and not $is_a_function)
+  elsif ($cxx_function->get_static () and not $is_a_function)
   {
     if (index ($c_function_name, '_new') >= 0)
     {
@@ -1427,7 +1430,7 @@ sub _on_wrap_gerror ($)
   {
     my $arg = $args[0];
 
-    if ($arg ne 'NO_GTYPE' and $arg !~ /^\s*s#[^#]+#[^#]*#\s*$/ and $arg !~ /^\s*get_type_func=.*$/)
+    if ($arg ne 'NO_GTYPE' and $arg !~ /^\s*s#[^#]*#[^#]*#\s*$/ and $arg !~ /^\s*get_type_func=.*$/ and $arg !~ '^sed')
     {
       $self->fixed_warning ('Domain parameter is deprecated.');
       shift @args;
@@ -2663,8 +2666,6 @@ sub _on_class_keyword ($)
   # declaration this is.
   foreach my $token (@{$tokens})
   {
-    next if (not defined $token or $token eq '');
-
     if ($in_s_comment)
     {
       if ($token eq "\n")
@@ -2693,6 +2694,7 @@ sub _on_class_keyword ($)
       my $classes = $self->get_classes;
       my $class_levels = $self->get_class_levels;
 
+# TODO: rather use type fixup
       $name =~ s/\s+//g;
       push @{$classes}, $name;
       push @{$class_levels}, $level + 1;
@@ -2716,7 +2718,7 @@ sub _on_class_keyword ($)
     {
       $colon_met = 1;
     }
-    elsif ($token !~ /\s/)
+    elsif ($token !~ /^\s+$/)
     {
       unless ($colon_met)
       {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]