X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=generator%2Fgenerator_checks.ml;h=f828c816b24ed867a464e6d95c36a74ec279f02b;hb=HEAD;hp=98649e26712a497e91c8a5534bc4be4e0cb8bd1f;hpb=0003ea2c3dbaa7e22f4f616539136821d80694b8;p=libguestfs.git diff --git a/generator/generator_checks.ml b/generator/generator_checks.ml index 98649e2..f828c81 100644 --- a/generator/generator_checks.ml +++ b/generator/generator_checks.ml @@ -101,7 +101,9 @@ let () = failwithf "%s has param/ret using reserved word %s" name n; in - (match fst style with + let ret, args, optargs = style in + + (match ret with | RErr -> () | RInt n | RInt64 n | RBool n | RConstString n | RConstOptString n | RString n @@ -109,9 +111,29 @@ let () = | RHashtable n | RBufferOut n -> check_arg_ret_name n ); - List.iter (fun arg -> check_arg_ret_name (name_of_argt arg)) (snd style) + List.iter (fun arg -> check_arg_ret_name (name_of_argt arg)) args; + List.iter (fun arg -> check_arg_ret_name (name_of_optargt arg)) optargs; + ) all_functions; + + (* Maximum of 63 optargs permitted. *) + List.iter ( + fun (name, (_, _, optargs), _, _, _, _, _) -> + if List.length optargs > 63 then + failwithf "maximum of 63 optional args allowed for %s" name; ) all_functions; + (* Some parameter types not supported for daemon functions. *) + List.iter ( + fun (name, (_, args, _), _, _, _, _, _) -> + let check_arg_type = function + | Pointer _ -> + failwithf "Pointer is not supported for daemon function %s." + name + | _ -> () + in + List.iter check_arg_type args; + ) daemon_functions; + (* Check short descriptions. *) List.iter ( fun (name, _, _, _, _, shortdesc, _) -> @@ -158,6 +180,37 @@ let () = in loop proc_nrs; + (* Check flags. *) + List.iter ( + fun (name, _, _, flags, _, _, _) -> + List.iter ( + function + | ProtocolLimitWarning + | FishOutput _ + | NotInFish + | NotInDocs + | Progress -> () + | FishAlias n -> + if contains_uppercase n then + failwithf "%s: guestfish alias %s should not contain uppercase chars" name n; + if String.contains n '_' then + failwithf "%s: guestfish alias %s should not contain '_'" name n + | DeprecatedBy n -> + (* 'n' must be a cross-ref to the name of another action. *) + if not (List.exists ( + function + | (n', _, _, _, _, _, _) when n = n' -> true + | _ -> false + ) all_functions) then + failwithf "%s: DeprecatedBy flag must be cross-reference to another action" name + | Optional n -> + if contains_uppercase n then + failwithf "%s: Optional group name %s should not contain uppercase chars" name n; + if String.contains n '-' || String.contains n '_' then + failwithf "%s: Optional group name %s should not contain '-' or '_'" name n + ) flags + ) (all_functions @ fish_commands); + (* Check tests. *) List.iter ( function