From 16e42ca83c3282ba7de830fb8a40623c6ac04dc7 Mon Sep 17 00:00:00 2001 From: xleroy Date: Wed, 3 Mar 2010 13:15:43 +0000 Subject: Detect struct assignment. Silence some warnings git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1273 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/C2Clight.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cfrontend') diff --git a/cfrontend/C2Clight.ml b/cfrontend/C2Clight.ml index fcb0c7c1..2ad2ac5e 100644 --- a/cfrontend/C2Clight.ml +++ b/cfrontend/C2Clight.ml @@ -161,7 +161,9 @@ let convertTyp env t = | C.TPtr(ty, a) -> Tpointer(convertTyp seen ty) | C.TArray(ty, None, a) -> - warning "array type of unspecified size"; + (* Cparser verified that the type ty[] occurs only in + contexts that are safe for Clight, so just treat as ty[0]. *) + (* warning "array type of unspecified size"; *) Tarray(convertTyp seen ty, coqint_of_camlint 0l) | C.TArray(ty, Some sz, a) -> Tarray(convertTyp seen ty, convertInt sz) @@ -323,11 +325,11 @@ let convertFuncall env lhs fn args = let fun_name = match fn with | {edesc = C.EVar id} when !Clflags.option_fvararg_calls -> - warning "emulating call to variadic function"; + (*warning "emulating call to variadic function"; *) id.name | _ -> unsupported "call to variadic function"; - "" in + "" in let targs = convertTypList env (List.map (fun e -> e.etyp) args) in let tres = convertTyp env res in let (stub_fun_name, stub_fun_typ) = @@ -343,6 +345,8 @@ let convertTopExpr env e = | C.EBinop(C.Oassign, lhs, {edesc = C.ECall(fn, args)}, _) -> convertFuncall env (Some lhs) fn args | C.EBinop(C.Oassign, lhs, rhs, _) -> + if Cutil.is_composite_type env lhs.etyp then + unsupported "assignment between structs or between unions"; Sassign(convertExpr env lhs, convertExpr env rhs) | C.ECall(fn, args) -> convertFuncall env None fn args -- cgit