Invalid C99 in source3/locking/brlock.c

Albert Chin samba-technical at mlists.thewrittenword.com
Wed Feb 18 22:50:48 MST 2015


On Wed, Feb 18, 2015 at 11:48:26PM +0100, Michael Adam wrote:
> On 2015-02-18 at 16:30 -0600, Albert Chin wrote:
> > source3/locking/brlock.c has the following code:
> >         *br_lck = (struct byte_range_lock) {};
> > 
> > According to GCC -pedantic, this isn't standard-conforming (and the
> > Sun C compiler doesn't like it either). GCC warns with "warning: ISO C
> > forbids empty initializer braces". The fix is trivial. Just change to:
> >         *br_lck = (struct byte_range_lock) {{0}};
> > 
> > This occurs in master and v4-2-test.
> 
> Thanks for your hint!
> 
> Wouldn't it rather be
> 
> 	*br_lck = (struct byte_range_lock) { 0 };
> 
> instead of
> 
> 	*br_lck = (struct byte_range_lock) {{0}};
> 
> i.e. one set of braces less?

Yes, you're correct. Thanks.

-- 
albert chin (china at thewrittenword.com)


More information about the samba-technical mailing list