[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [4191] add alignment check for arrays
From: |
Pascal Brisset |
Subject: |
[paparazzi-commits] [4191] add alignment check for arrays |
Date: |
Sat, 19 Sep 2009 18:24:17 +0000 |
Revision: 4191
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4191
Author: hecto
Date: 2009-09-19 18:24:17 +0000 (Sat, 19 Sep 2009)
Log Message:
-----------
add alignment check for arrays
Modified Paths:
--------------
paparazzi3/trunk/sw/tools/gen_messages.ml
Modified: paparazzi3/trunk/sw/tools/gen_messages.ml
===================================================================
--- paparazzi3/trunk/sw/tools/gen_messages.ml 2009-09-18 16:50:21 UTC (rev
4190)
+++ paparazzi3/trunk/sw/tools/gen_messages.ml 2009-09-19 18:24:17 UTC (rev
4191)
@@ -238,7 +238,11 @@
incr offset;
(** The macro to access to the array itself *)
- fprintf h "#define DL_%s_%s(_payload) ((%s*)(_payload+%d))\n"
msg_name field_name (Syntax.assoc_types t).Pprz.inttype !offset;
+ let pprz_type = Syntax.assoc_types t in
+ if check_alignment && !offset mod pprz_type.Pprz.size <> 0 then
+ failwith (sprintf "Wrong alignment of field '%s' in message '%s"
field_name msg_name);
+
+ fprintf h "#define DL_%s_%s(_payload) ((%s*)(_payload+%d))\n"
msg_name field_name pprz_type.Pprz.inttype !offset;
offset := -1 (** Mark for no more fields *)
in
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [4191] add alignment check for arrays,
Pascal Brisset <=