mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
perl: show warnings for deprecated functions
Emit a deprecation warning when a deprecated function is used, so users have a way to know that they are using one.
This commit is contained in:
@@ -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.
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user