From 27dc2a0f7c04a4d3229c618b1d730f3d95710c6f Mon Sep 17 00:00:00 2001 From: Valentin Perrelle <valentin.perrelle@cea.fr> Date: Wed, 4 Nov 2020 16:17:19 +0100 Subject: [PATCH] [Cil] Update comments --- src/kernel_services/ast_data/cil_types.mli | 11 ++++++----- src/kernel_services/ast_queries/cil.ml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kernel_services/ast_data/cil_types.mli b/src/kernel_services/ast_data/cil_types.mli index 50828024e84..bafc8caef9e 100644 --- a/src/kernel_services/ast_data/cil_types.mli +++ b/src/kernel_services/ast_data/cil_types.mli @@ -433,13 +433,14 @@ and fieldinfo = { expression. *) mutable fsize_in_bits: int option; - (** (Deprecated. Use {!Cil.fieldBitsOffset} or {!Cil.bitsOffset} instead.) - Similar to [fbitfield] for all types of fields. - @deprecated only Jessie uses this *) + (** Similar to [fbitfield] for all types of fields. + Do not read this field directly. Use {!Cil.fieldBitsOffset} or + {!Cil.bitsOffset} instead. *) mutable foffset_in_bits: int option; - (** Offset at which the field starts in the structure. Do not read directly, - but use {!Cil.fieldBitsOffset} or {!Cil.bitsOffset} instead. *) + (** Offset at which the field starts in the structure. + Do not read this field directly. Use {!Cil.fieldBitsOffset} or + {!Cil.bitsOffset} instead. *) mutable fpadding_in_bits: int option; (** (Deprecated.) Store the size of the padding that follows the field, if any. diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml index f7bdda90aba..f3f919e645d 100644 --- a/src/kernel_services/ast_queries/cil.ml +++ b/src/kernel_services/ast_queries/cil.ml @@ -4421,6 +4421,7 @@ and sizeOf ~loc t = and fieldBitsOffset (f : fieldinfo) : int * int = if not f.fcomp.cstruct (* union *) then + (* All union fields start at offset 0 *) 0, bitsSizeOf f.ftype else begin if f.foffset_in_bits = None then begin @@ -4461,7 +4462,6 @@ and bitsOffset (baset: typ) (off: offset) : int * int = | TComp (ci, _, _) -> assert (ci == f.fcomp) | _ -> assert false); let offsbits, size = fieldBitsOffset f in - (* All union fields start at offset 0 *) loopOff f.ftype size (start + offsbits) off in loopOff baset (bitsSizeOf baset) 0 off -- GitLab