[Libguestfs] [PATCH 3/4] ocaml: doc: add the version (if available) of APIs

Pino Toscano ptoscano at redhat.com
Thu May 28 14:47:54 UTC 2015


Make sure to not add more newline's than needed.
---
 generator/ocaml.ml | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index e7c6a1a..d2a4690 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -153,12 +153,23 @@ end
       generate_ocaml_prototype name style;
 
       if need_doc then (
+        let has_tags = ref false in
+
         pr "(** %s" shortdesc;
         (match deprecated_by with
          | None -> ()
          | Some replacement ->
-             pr "\n\n    @deprecated Use {!%s} instead\n" replacement
+             has_tags := true;
+             pr "\n\n    @deprecated Use {!%s} instead" replacement
+        );
+        (match version_added f with
+        | None -> ()
+        | Some version ->
+             has_tags := true;
+             pr "\n\n    @since %s" version
         );
+        if !has_tags then
+          pr "\n";
         pr " *)\n";
       );
 
-- 
2.1.0




More information about the Libguestfs mailing list