[glibmm/gmmproc-refactor] Warn when something could be easily fixed in C library.



commit 72f2300d0f0be4fa6b631d5ce4f628bd429f113b
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Sat Jul 14 17:27:05 2012 +0200

    Warn when something could be easily fixed in C library.
    
    For now gmmproc warns when there is missing transfer annotation or
    constructor is incorrectly parsed as a method.

 tools/pm/Common/Output/Shared.pm |    2 +-
 tools/pm/Common/WrapParser.pm    |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/tools/pm/Common/Output/Shared.pm b/tools/pm/Common/Output/Shared.pm
index 41ccb1f..e4ae92b 100644
--- a/tools/pm/Common/Output/Shared.pm
+++ b/tools/pm/Common/Output/Shared.pm
@@ -616,7 +616,7 @@ sub convert_or_die
 
   unless ($transfer ~~ @good_range)
   {
-    my $message = join ('', 'Got invalid transfer for conversion from `', $from, '\' to `', $to, '\' for substitution `', $subst, '\'');
+    my $message = join ('', 'Got invalid transfer for conversion from `', $from, '\' to `', $to, '\' for substitution `', $subst, '\'. Please fix it in C library by adding correct transfer annotation.');
     $wrap_parser->fixed_error ($message);
   }
 
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 475cbf1..643b812 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -852,7 +852,9 @@ sub _on_wrap_method ($)
   if ($cxx_function->get_static () and not $is_a_function)
   {
     my $guessed_c_type = join ('', 'const ', $gir_entity->get_a_c_type (), '*');
+    my $message = 'This is marked as <method> instead of <constructor>. Please fix it in C library by adding (constructor) annotation after constructor_name (here: "' . $c_function->get_name () . ': (constructor)"). For now working it around by prepending "' $guessed_c_type . '" parameter type.';
 
+    $self->fixed_warning ($message);
     unshift (@{$c_param_types}, $guessed_c_type);
     unshift (@{$c_param_transfers}, Common::TypeInfo::Common::TRANSFER_NONE);
   }



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