[Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

Emil Velikov emil.l.velikov at gmail.com
Mon Mar 16 14:13:24 PDT 2015


On 15/03/15 19:05, Erik Faye-Lund wrote:
> _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,
> so the locale doesn't need to be initialized before the first context
> gets initialized. So let's use explicit initialization from the
> one-time init code instead of depending on a C++ compiler to initialize
> at image-load time.
> 
> Signed-off-by: Erik Faye-Lund <kusmabite at gmail.com>
> ---
> 
> Because of the recent discussion on libc++ and Mesa, I thought I'd
> have a look into what parts of mesa depended on libc++, and I spotted
> this file.
> 
> In this case, it was rather trivial to port the code to plain C, making
> it dead obvious that it doesn't depend on libc++. I'm not proposing all
> C++ gets this treatment, but in this case it seems like a pretty
> straight-forward way to make it obvious that this code does not depend
> on libc++.
> 
Fwiw this file/code should not cause any linkage to the C++ runtime,
although it's a nice cleanup imho.

There is a small catch though - _mesa_strtof can be used by the
standalone glsl_compiler and perhaps glcpp. I could not find any
references in the manpages about locale_t's implementation although it
guaranteed to be a struct for every platform we can just add an assert
in _mesa_strtof and fix the fallouts later ?

-Emil



More information about the mesa-dev mailing list