[glibmm/glibmm-2-66] gmmproc: Add "ignore_deprecations" argument in _WRAP_METHOD()



commit d6405e6a9b34b92be1d5cf77e6a21c9bfcbd3a30
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Feb 25 15:57:08 2022 +0100

    gmmproc: Add "ignore_deprecations" argument in _WRAP_METHOD()
    
    Makes it easier to suppress deprecation warnings when a C method has been
    deprecated, but the corresponding C++ method shall not (yet) be deprecated.

 tools/m4/method.m4     | 18 ++++++++++--------
 tools/pm/Output.pm     |  5 +++++
 tools/pm/WrapParser.pm |  5 +++++
 3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/tools/m4/method.m4 b/tools/m4/method.m4
index 3ca4de6e..13fc81d2 100644
--- a/tools/m4/method.m4
+++ b/tools/m4/method.m4
@@ -1,8 +1,6 @@
 dnl
-dnl
 dnl  Code generation sections for making a method.
 dnl
-dnl
 
 dnl
 dnl method
@@ -12,12 +10,13 @@ dnl           $9     $10       $11       $12         $13             $14
 dnl          const,refreturn,errthrow,deprecated,constversion,arglist_without_types,ifdef,
 dnl             $16        $17              $18        $19        $20         $21
 dnl          out_param,out_param_cpptype,slot_type,slot_name,no_slot_copy,wrap_line)
+dnl $12 is either "", "deprecated" or "ignore_deprecations"
 define(`_METHOD',`dnl
 _PUSH(SECTION_CC)
 ifelse(`$15',,,`#ifdef $15'
 )dnl
-ifelse(`$12',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ifelse(`$12',`deprecated',`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a 
newline
+ifelse(`$12',,,`G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 ')dnl
 $3 __CPPNAME__::$1`'($5)ifelse(`$9',1,` const')
 {
@@ -102,7 +101,8 @@ ifelse(`$3',void,,`  return retvalue;
 ')dnl
 }
 ifelse(`$12',,,`G_GNUC_END_IGNORE_DEPRECATIONS
-_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
+')dnl
+ifelse(`$12',`deprecated',`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a 
newline
 ifelse(`$15',,,`#endif // $15
 ')
 _POP()')
@@ -115,12 +115,13 @@ dnl                        $8            $9      $10         $11    $12     $13
 dnl                 cinitializations,refreturn,errthrow,deprecated,ifdef,out_param,
 dnl                       $14          $15      $16          $17       $18
 dnl                 out_param_type,slot_type,slot_name,no_slot_copy,wrap_line)
+dnl $11 is either "", "deprecated" or "ignore_deprecations"
 define(`_STATIC_METHOD',`dnl
 _PUSH(SECTION_CC)
 ifelse(`$12',,,`#ifdef $12'
 )dnl
-ifelse(`$11',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ifelse(`$11',`deprecated',`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a 
newline
+ifelse(`$11',,,`G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 ')dnl
 $3 __CPPNAME__::$1($5)
 {
@@ -191,7 +192,8 @@ ifelse(`$3',void,,`  return retvalue;
 ')dnl
 }
 ifelse(`$11',,,`G_GNUC_END_IGNORE_DEPRECATIONS
-_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
+')dnl
+ifelse(`$11',`deprecated',`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a 
newline
 ifelse(`$12',,,`#endif // $12
 ')
 _POP()')
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 940a177c..d3c8c636 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -441,6 +441,11 @@ sub output_wrap_meth($$$$$$$)
       $constversion = "constversion"
     }
 
+    if($$objCDefsFunc{ignore_deprecations})
+    {
+      $deprecated = "ignore_deprecations"
+    }
+
     #Implementation:
     my $str;
     if ($$objCppfunc{static}) {
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index 8ed038ab..25e73de7 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -945,6 +945,7 @@ sub on_wrap_method($)
   $$objCfunc{rettype_needs_ref} = 0;
   $$objCfunc{throw_any_errors} = 0;
   $$objCfunc{constversion} = 0;
+  $$objCfunc{ignore_deprecations} = 0;
   $$objCfunc{deprecated} = "";
   my $errthrow_docs = "";
   my $deprecation_docs = "";
@@ -967,6 +968,10 @@ sub on_wrap_method($)
     {
       $$objCfunc{constversion} = 1;
     }
+    elsif($argRef eq "ignore_deprecations")
+    {
+      $$objCfunc{ignore_deprecations} = 1;
+    }
     elsif($argRef =~ /^deprecated(.*)/) #If deprecated is at the start.
     {
       $$objCfunc{deprecated} = "deprecated";


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