[v3] C2x strtol binary constant handling

Joseph Myers joseph@codesourcery.com
Mon Jan 16 19:23:43 GMT 2023


On Mon, 16 Jan 2023, Adhemerval Zanella Netto via Libc-alpha wrote:

> I wonder if could reduce the required new symbols for architecture where
> 'long' and 'long long' have the same size, so the REDIRECT macro would
> redirect both strtol and strtoll to __isoc23_strtol.  I am not if the
> complexty really pays off.

In <https://sourceware.org/pipermail/libc-alpha/2020-December/120445.html> 
Carlos argued against redirecting strtoimax strtoumax wcstoimax wcstoumax 
to functions such as __isoc23_strtoll rather than adding functions such as 
__isoc23_strtoimax.  I think the same argument would apply to having a 
single underlying function for both strtol and strtoll (with the 
additional point that redirecting to a function with a different type is 
awkward, in the case where __REDIRECT isn't defined and in the case of 
internal uses in libc where #define is used because __REDIRECT and 
libc_hidden_proto don't interact well).

> > +# Some versions of GCC supported for building glibc do not support -std=c2x
> > +# or -std=gnu2x, so the tests for those versions use -std=c11 and -std=gnu11
> > +# and then _ISOC2X_SOURCE is defined in the test as needed.
> > +CFLAGS-tst-strtol-binary-c11.c += -std=c11
> > +CFLAGS-tst-strtol-binary-c2x.c += -std=c11
> > +CFLAGS-tst-strtol-binary-gnu11.c += -std=gnu11
> > +CFLAGS-tst-strtol-binary-gnu2x.c += -std=gnu11
> > +
> >  
> >  # Run a test on the header files we use.
> >  tests-special += $(objpfx)isomac.out
> 
> Ok, I think it should cover all possible scenarios. Should we also add tests to
> use the expected -std= (it would most likely require a new configure switch to
> check for compile support)?

I'm dubious of the value of adding such a new configure test at this 
point.

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list