Thank you, this is indeed what I needed.

However, I still believe the isCompleteType method needs to be
modifed. Using the 'cdefined' field, bellow is what I use now. I think
it's correct.

--- src/cil.ml.orig   2009-04-06 15:16:20.000000000 +0200
+++ src/cil.ml  2009-04-07 13:00:14.000000000 +0200
@@ -6074,7 +6074,7 @@
   | TArray(t, None, _) -> false
   | TArray(t, Some z, _) when isZero z -> false
   | TComp (comp, _) -> (* Struct or union *)
-      List.for_all (fun fi -> isCompleteType fi.ftype) comp.cfields
+     comp.cdefined && List.for_all (fun fi -> isCompleteType
fi.ftype) comp.cfields
   | _ -> true

Regards,
Olivier

On Mon, Apr 6, 2009 at 10:19 PM, Elnatan Reisner <elna...@cs.umd.edu> wrote:
> I think you are looking for the 'cdefined' field of Cil.compinfo.
>
> On Mon, 2009-04-06 at 15:44 +0200, Olivier Crameri wrote:
>> Hi all,
>>
>> I've been having a few problems with incomplete types in CIL.
>>
>> Apparently, Cil.isCompleteType considers a structure with no fields as
>> being a complete type. I don't know if this is on purpose, or if this
>> is a bug. It seems to be valid C, but I can't see any use of having a
>> structure defined with no fields. The problem is that incomplete
>> structures also appear in CIL as structures with no fields, so in my
>> code I cannot make the difference and I end up generating code that
>> doesn't compile (such as calling sizeof on an incomplete structure).
>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to