Re: [PATCH v2] count: Switch from GCC to C11 thread-local storage

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

 



Incrementalist that I am, my thought is to take this one thing at a
time, if and when.  ;-0

							Thanx, Paul

On Wed, Aug 17, 2022 at 01:36:43PM -0400, Elad Lahav wrote:
> Hi Akira,
> 
> The reason for the change is that using C11 is more portable. I have no
> problem dropping it if it causes any problems.
> 
> That said, there is a simple solution to the issue you are facing. The
> -std=c11 option specifies strict adherence to ISO C, without extensions.
> You rarely want that. Instead, specify -std=gnu11, which will give you C11
> plus POSIX plus GNU extensions.
> 
> --Elad
> 
> On Wed., Aug. 17, 2022, 11:18 a.m. Akira Yokosawa, <akiyks@xxxxxxxxx> wrote:
> 
> > Hi Elad,
> >
> > On Wed, 17 Aug 2022 07:00:50 -0400, Elad Lahav wrote:
> > > Signed-off-by: Elad Lahav <e2lahav@xxxxxxxxx>
> > > ---
> >
> > As there is no changelog here, let me ask a (maybe stupid) question.
> >
> > What is your goal of diverting from GCC extensions and switching
> > to the C11 standard?
> >
> > Do you want the codebase under CodeSamples/ to be strictly
> > conformant to C11 or later?
> >
> > Runnig "make" under CodeSamples/count, with "-std=c11" appended
> > to GCC_ARGS, I get a lot of compile errors/warnings (with GCC 9.4.0
> > under Ubuntu 20.04), beginning with:
> >
> >     cc -g -O2 -Wall -std=c11  -o count_atomic count_atomic.c -lpthread
> >
> >     In file included from /usr/include/sched.h:34,
> >
> >                      from /usr/include/pthread.h:22,
> >
> >                      from ../api.h:159,
> >
> >                      from count_atomic.c:22:
> >
> >     /usr/include/time.h:113:5: error: unknown type name 'locale_t'
> >
> >       113 |     locale_t __loc) __THROW;
> >
> >           |     ^~~~~~~~
> >
> >
> > A workaround is to append "-D_GNU_SOURCE" to GCC_ARGS.  With that,
> > I get the next warning of:
> >
> >     ../api.h:766:2: warning: implicit declaration of function 'typeof'
> > [-Wimplicit-function-declaration]
> >
> >   766 |  typeof(*ptr) _____actual = (o); \
> >
> >
> > Apparently, typeof() is another GCC extension.  __typeof__() might
> > be used instead, but it is not ISO C.
> >
> > So what is you goal of these switches?
> >
> >         Thanks, Akira
> >
> > >  CodeSamples/count/count_end.c | 12 ++++++------
> > >  count/count.tex               | 20 ++++++++++++--------
> > >  2 files changed, 18 insertions(+), 14 deletions(-)
> > >
> > [...]
> >



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux