bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warnings from MacOS clang


From: Bruno Haible
Subject: Re: warnings from MacOS clang
Date: Wed, 12 May 2021 12:16:54 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; )

Hi Arnold,

> > OSX 10.11.6
> > Building after using 'touch .developing' for the first time, I get
> >
> > depbase=`echo dfa.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> > gcc -DGAWK -DHAVE_CONFIG_H -I"./.." -I. -I..   -I/opt/local/include
> > -I/opt/local/include -g -O2 -DARRAYDEBUG -DYYDEBUG -DLOCALEDEBUG
> > -DMEMDEBUG -Wall -fno-builtin -g3 -ggdb3 -g -O2 -DARRAYDEBUG -DYYDEBUG
> > -DLOCALEDEBUG -DMEMDEBUG -Wall -fno-builtin -g3 -ggdb3 -MT dfa.o -MD
> > -MP -MF $depbase.Tpo -c -o dfa.o dfa.c &&\
> > mv -f $depbase.Tpo $depbase.Po
> >
> > dfa.c:1627:19: warning: suggest braces around initialization of subobject
> >       [-Wmissing-braces]
> >   mbstate_t s = { 0 };
> >                   ^
> >                   {}
> > 1 warning generated.

{ 0 } is the only portable initializer for an mbstate_t. If we were to use
another initializer, it would make assumptions about the structure of an
mbstate_t. That is, #ifdefs.

Another option was to use to portable initializer, but use
memset (&s, '\0', sizeof (s)) to initialize the variable.
This is ugly BSD style of the 1980ies, which we have abandoned
more than 10 years ago.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]