[sheepdog] [PATCH devel] journal: suppress compile errors

Liu Yuan namei.unix at gmail.com
Wed Apr 3 07:49:49 CEST 2013


On 04/03/2013 01:38 PM, Liu Yuan wrote:
> On 04/03/2013 01:23 PM, Hitoshi Mitake wrote:
>> At Wed, 03 Apr 2013 13:18:40 +0800,
>> Liu Yuan wrote:
>>>
>>> On 04/03/2013 01:15 PM, Hitoshi Mitake wrote:
>>>> Let's keep the devel branch build ready.
>>>>
>>>> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
>>>> ---
>>>>  sheep/journal.c |    6 ++++--
>>>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/sheep/journal.c b/sheep/journal.c
>>>> index eccd6b6..47a0814 100644
>>>> --- a/sheep/journal.c
>>>> +++ b/sheep/journal.c
>>>> @@ -395,9 +395,10 @@ int journal_write_store(uint64_t oid, const char *buf, size_t size,
>>>>  		.flag = JF_STORE,
>>>>  		.offset = offset,
>>>>  		.size = size,
>>>> -		.oid = oid,
>>>>  		.create = create,
>>>>  	};
>>>> +
>>>> +	jd.oid = oid;
>>>>  	return journal_file_write(&jd, buf);
>>>>  }
>>>>  
>>>> @@ -408,9 +409,10 @@ int journal_write_epoch(const char *buf, size_t size, uint32_t epoch)
>>>>  		.flag = JF_EPOCH,
>>>>  		.offset = 0,
>>>>  		.size = size,
>>>> -		.epoch = epoch,
>>>>  		.create = true,
>>>>  	};
>>>> +
>>>> +	jd.epoch = epoch;
>>>>  	return journal_file_write(&jd, buf);
>>>>  }
>>>>  
>>>>
>>>
>>> What is your GCC version? I don't have this build error.
>>>
>>
>> My gcc is 4.4.5 (Debian 4.4.5-8). What's yours?
>>
> 
> Mine is 4.6.3, but yours is pretty new to support unnamed filed within
> union (http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html)
> 
> I guess add '-std=c99' to gcc would solve the problem. Or simply we
> should call c99(a wrapper script) instead of gcc.
> 

I googled it and seems that gcc < 4.6 will not handle unnamed fields
initialization correctly.

Maybe your approach is the only way to be all gcc compatible.

Thanks,
Yuan




More information about the sheepdog mailing list