ruby: show warnings for deprecated functions

Emit a warning when a deprecated function is used, so users have a way
to know that they are using one.
This commit is contained in:
Pino Toscano
2019-04-23 17:41:43 +02:00
parent cf865444a8
commit a7666c1f1c

View File

@@ -253,6 +253,16 @@ and generate_ruby_c actions () =
pr "\n"
);
(match f.deprecated_by with
| Not_deprecated -> ()
| Replaced_by alt ->
pr " rb_warn (\"Guestfs#%s is deprecated; use #%s instead\");\n" f.name alt;
pr "\n"
| Deprecated_no_replacement ->
pr " rb_warn (\"Guestfs#%s is deprecated\");\n" f.name;
pr "\n"
);
List.iter (
function
| String (_, n) ->