Emit a deprecation warning when a deprecated function is used, so users
have a way to know that they are using one.
---
generator/perl.ml | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/generator/perl.ml b/generator/perl.ml
index efb31077c..af19650a8 100644
--- a/generator/perl.ml
+++ b/generator/perl.ml
@@ -335,7 +335,7 @@ PREINIT:
List.iter (
fun { name; style = (ret, args, optargs as style);
- c_function; c_optarg_prefix } ->
+ c_function; c_optarg_prefix; deprecated_by } ->
(match ret with
| RErr -> pr "void\n"
| RInt _ -> pr "SV *\n"
@@ -444,6 +444,16 @@ PREINIT:
pr " PPCODE:\n";
);
+ (match deprecated_by with
+ | Not_deprecated -> ()
+ | Replaced_by alt ->
+ pr " Perl_ck_warner (aTHX_ packWARN(WARN_DEPRECATED),\n";
+ pr " \"Sys::Guestfs::%s is deprecated; use Sys::Guestfs::%s
instead\");\n" name alt;
+ | Deprecated_no_replacement ->
+ pr " Perl_ck_warner (aTHX_ packWARN(WARN_DEPRECATED),\n";
+ pr " \"Sys::Guestfs::%s is deprecated\");\n" name;
+ );
+
(* For optional arguments, convert these from the XSUB "items"
* variable by hand.
*)
--
2.20.1