From 48d06c158b02ceded6ca0a4c7c88d4e8e4976599 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Fri, 26 Nov 2021 17:06:10 +0100 Subject: 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(-) (limited to 'tools') diff --git a/tools/m4/method.m4 b/tools/m4/method.m4 index 279f0ee2..d95e9607 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 83da2326..e5c7af9f 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 9063bce6..7faae231 100644 --- a/tools/pm/WrapParser.pm +++ b/tools/pm/WrapParser.pm @@ -940,6 +940,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 = ""; @@ -962,6 +963,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"; -- cgit v1.2.1