generator: Don't permit certain String/stringt combinations.

After the previous commit it become possible to construct various
"impossible" argument types, such as lists of FileIn strings.  This
commit prevents these from happening.
This commit is contained in:
Richard W.M. Jones
2017-04-21 13:19:49 +01:00
parent 30411ef623
commit b168147834

View File

@@ -154,6 +154,29 @@ let () =
List.iter check_arg_type args;
) (actions |> daemon_functions);
(* Some String/stringt and StringList/stringt combinations are
* not permitted.
*)
List.iter (
fun { name = name; style = _, args, _ } ->
let check_arg_type = function
(* Previously only DeviceList and FilenameList were special list
* types. We could permit more here in future.
*)
| StringList (FileIn, _)
| StringList (FileOut, _)
| StringList (Mountable, _)
| StringList (Pathname, _)
| StringList (Dev_or_Path, _)
| StringList (Mountable_or_Path, _)
| StringList (Key, _)
| StringList (GUID, _) ->
failwithf "StringList (t, _) is not permitted for %s." name
| _ -> ()
in
List.iter check_arg_type args
) actions;
(* Check short descriptions. *)
List.iter (
fun { name = name; shortdesc = shortdesc } ->