[cfe-dev] handling of volatile qualifier

Eli Friedman eli.friedman at gmail.com
Tue Jun 10 16:52:55 PDT 2008


2008/6/10 Cédric Venet <cedric.venet at laposte.net>:
>> What about something like "int a() {return (volatile int){10};}"?
>> (Not that this is a useful case, but might as well be consistent.)
>
> The idea was that a literal (compound or not) is a constant expression, and
> so don't need to be marked volatile?

A "compound literal" is actually an unnamed variable.

>>
>> @@ -418,7 +426,8 @@
>>        // Initializers can't initialize unnamed fields, e.g. "int :
>> 20;"
>>        continue;
>>      }
>> -    LValue FieldLoc = CGF.EmitLValueForField(DestPtr, CurField,
>> isUnion);
>> +    // FIXME: Volatile?
>> +    LValue FieldLoc = CGF.EmitLValueForField(DestPtr, CurField,
>> isUnion,0);
>>      if (CurInitVal < NumInitElements) {
>>        // Store the initializer into the field
>>        // This will probably have to get a bit smarter when we support
>>
>> I don't see anything to fix here.  (Although volatile aggregates are
>> going to need a thorough audit once we can reasonably support a
>> volatile aggregate copy.)
>>
>
> Since you told me not to bother to much with aggregate, I just put 0 and a
> fixme.
> Now I removed the fixme.

Oh! I see the issue.  FIXME probably needed.  Sorry about that.

>> Otherwise, this is looking good!  Thanks for putting the time into
>> this.
>
> It is not much, I hope to do more (when I find the time and the motivation
> simultaneously :)).

Okay, cool.

I'll fix the last couple issues I just mentioned, fix up the testcase,
and apply the patch soon. Thanks again for doing this.

-Eli




More information about the cfe-dev mailing list