aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
diff options
context:
space:
mode:
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Bitfields.ml2
-rw-r--r--cparser/Cutil.ml16
-rw-r--r--cparser/Cutil.mli2
-rw-r--r--cparser/PackedStructs.ml2
-rw-r--r--cparser/Rename.ml2
-rw-r--r--cparser/StructReturn.ml2
-rw-r--r--cparser/Unblock.ml2
7 files changed, 19 insertions, 9 deletions
diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml
index 223ee3ca..bbc39456 100644
--- a/cparser/Bitfields.ml
+++ b/cparser/Bitfields.ml
@@ -502,7 +502,7 @@ and transf_post env ctx op e1 bf tyfield =
and transf_init env i =
match i with
| Init_single e -> Init_single (transf_exp env Val e)
- | Init_array il -> Init_array (List.map (transf_init env) il)
+ | Init_array il -> Init_array (List.rev (List.rev_map (transf_init env) il))
| Init_struct(id, fld_init_list) ->
let fld_init_list' =
List.map (fun (f, i) -> (f, transf_init env i)) fld_init_list in
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index a86c779f..1b0bf65d 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -880,6 +880,18 @@ let is_literal_0 e =
| EConst(CInt(0L, _, _)) -> true
| _ -> false
+(* Check that a C statement is a debug annotation *)
+
+let is_debug_stmt s =
+ let is_debug_call = function
+ | (ECall ({edesc = EVar id; _},_)) -> id.name = "__builtin_debug"
+ | _ -> false in
+ match s.sdesc with
+ | Sdo {edesc = e;_} ->
+ is_debug_call e
+ | _ -> false
+
+
(* Assignment compatibility check over attributes.
Standard attributes ("const", "volatile", "restrict") can safely
be added (to the rhs type to get the lhs type) but must not be dropped.
@@ -1099,7 +1111,3 @@ let rec subst_stmt phi s =
List.map subst_asm_operand inputs,
clob)
}
-
-
-
-
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli
index 8b6c609b..b353cba3 100644
--- a/cparser/Cutil.mli
+++ b/cparser/Cutil.mli
@@ -187,6 +187,8 @@ val type_of_member : Env.t -> field -> typ
(* Return the type of accessing the given field [fld].
Normally it's [fld.fld_type] but there is a special case for
small unsigned bitfields. *)
+val is_debug_stmt : stmt -> bool
+ (* Is the given statement a call to debug builtin? *)
val is_literal_0 : exp -> bool
(* Is the given expression the integer literal "0"? *)
val is_lvalue : exp -> bool
diff --git a/cparser/PackedStructs.ml b/cparser/PackedStructs.ml
index c163989e..6ea5d121 100644
--- a/cparser/PackedStructs.ml
+++ b/cparser/PackedStructs.ml
@@ -360,7 +360,7 @@ let transf_init loc env i =
match unroll env ty with
| TArray(ty_elt, _, _) -> Some ty_elt
| _ -> assert false in
- Init_array (List.map (trinit swap_elt) il)
+ Init_array (List.rev (List.rev_map (trinit swap_elt) il))
| Init_struct(id, fld_init_list) ->
let trinit_field (f, i) =
let swap_f =
diff --git a/cparser/Rename.ml b/cparser/Rename.ml
index 4b387b0d..664f6a28 100644
--- a/cparser/Rename.ml
+++ b/cparser/Rename.ml
@@ -142,7 +142,7 @@ and exp_desc env = function
and init env = function
| Init_single e -> Init_single(exp env e)
- | Init_array il -> Init_array (List.map (init env) il)
+ | Init_array il -> Init_array (List.rev (List.rev_map (init env) il))
| Init_struct(id, il) ->
Init_struct(ident env id,
List.map (fun (f, i) -> (field env f, init env i)) il)
diff --git a/cparser/StructReturn.ml b/cparser/StructReturn.ml
index 2c6fd1d2..82c0a04c 100644
--- a/cparser/StructReturn.ml
+++ b/cparser/StructReturn.ml
@@ -412,7 +412,7 @@ and transf_init env = function
| Init_single e ->
Init_single (transf_expr env Val e)
| Init_array il ->
- Init_array (List.map (transf_init env) il)
+ Init_array (List.rev (List.rev_map (transf_init env) il))
| Init_struct(id, fil) ->
Init_struct (id, List.map (fun (fld, i) -> (fld, transf_init env i)) fil)
| Init_union(id, fld, i) ->
diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml
index 405cf755..ef8bc91c 100644
--- a/cparser/Unblock.ml
+++ b/cparser/Unblock.ml
@@ -169,7 +169,7 @@ and expand_init islocal env i =
| Init_single e ->
Init_single (expand_expr islocal env e)
| Init_array il ->
- Init_array (List.map expand il)
+ Init_array (List.rev (List.rev_map expand il))
| Init_struct(id, flds) ->
Init_struct(id, List.map (fun (f, i) -> (f, expand i)) flds)
| Init_union(id, fld, i) ->