From ce4951549999f403446415c135ad1403a16a15c3 Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 12 Nov 2012 13:42:22 +0000 Subject: Globalenvs: allocate one-byte block with permissions Nonempty for each function definition, so that comparisons between function pointers are correctly defined. AST, Globalenvs, and many other files: represent programs as a list of (function or variable) definitions instead of two lists, one for functions and the other for variables. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2067 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/Cshmgen.v | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cfrontend/Cshmgen.v') diff --git a/cfrontend/Cshmgen.v b/cfrontend/Cshmgen.v index c5e9b8d..a459297 100644 --- a/cfrontend/Cshmgen.v +++ b/cfrontend/Cshmgen.v @@ -546,8 +546,16 @@ with transl_lbl_stmt (tyret: type) (nbrk ncnt: nat) Definition prefix_var_name (id: ident) : errmsg := MSG "In local variable " :: CTX id :: MSG ": " :: nil. -Definition transl_vars (l: list (ident * type)) := - AST.map_partial prefix_var_name var_kind_of_type l. +Fixpoint transl_vars (l: list (ident * type)) : res (list (ident * var_kind)) := + match l with + | nil => OK nil + | (id, ty) :: l' => + match var_kind_of_type ty with + | Error msg => Error (MSG "In local variable " :: CTX id :: MSG ": " :: msg) + | OK vk => + do tl' <- transl_vars l'; OK ((id, vk) :: tl') + end + end. Definition transl_function (f: Clight.function) : res function := do tparams <- transl_vars (Clight.fn_params f); -- cgit v1.2.3