Hi,
Although that works fine for basic types, there is a problem for arrays as
it adds the word volatile after the type of the variable.
Basically if my input is:
int c[10];
I want my output to be
volatile int c[10];
I added following code where elt.vtype is the type of exisiting variable
let attr_list =ref [] in
   attr_list := Attr("volatile",[]) :: !attr_list;
let temp_type = elt.vtype in
let new_type_var = typeAddAttributes !attr_list temp_type  in
let temp = makeTempVar fd new_type_var

However this gives output as
int   ( volatile  c)[9] ;

Also on examining the  TArray type I notice that the attr field is empty
even for a volatile array. In that case where exactly is the volatile
attribute stored for arrays?

Thanks
-Divya

On Tue, Apr 21, 2009 at 12:44 AM, Divya Krishnan <
divya1...@users.sourceforge.net> wrote:

> Hi Gabriel,
> Thanks. That worked!
>
> -Divya
>
> On Mon, Apr 20, 2009 at 4:33 PM, Gabriel Kerneis 
> <kern...@pps.jussieu.fr>wrote:
>
>> On Mon, Apr 20, 2009 at 04:07:09PM -0400, Divya Krishnan wrote:
>> > Hi,
>> > I would like to add a volatile variable to the input program. However on
>> > going through the Cil documentation, I could not find any way to create
>> a
>> > volatile variable type. Is there any way that we may have to set
>> attributes
>> > when we specify makeTempVar in order to create a volatile variable? The
>> > Cil.typ Sumtype does not have any type for volatile variables.
>>
>> It's stored in attributes (just like const). Look at the definition of
>> Cil.charConstPtrType for example.
>>
>> Regards,
>> --
>> Gabriel Kerneis
>>
>
>
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to