[Mesa-dev] [PATCH] swr/rast: adjust std::string usage to fix build
Cherniak, Bruce
bruce.cherniak at intel.com
Mon Jun 26 15:58:35 UTC 2017
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
> On Jun 26, 2017, at 9:34 AM, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
>
> On Monday, 2017-06-26 09:03:13 -0500, Tim Rowley wrote:
>> Some combinations of c++ compilers and standard libraries had problems
>> with the string::replace code we were using previously.
>>
>> This should fix the travis-ci system.
>
> Yup, confirmed: https://travis-ci.org/1ace/mesa/builds/247116248
>
> Tested-by: Eric Engestrom <eric.engestrom at imgtec.com>
>
> Thanks!
>
>> ---
>> .../drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp
>> index 0527bf3..e109fd2 100644
>> --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp
>> +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp
>> @@ -141,21 +141,27 @@ extern GlobalKnobs g_GlobalKnobs;
>> void KnobBase::autoExpandEnvironmentVariables(std::string &text)
>> {
>> {
>> + // unix style variable replacement
>> static std::regex env("\\$\\{([^}]+)\\}");
>> std::smatch match;
>> while (std::regex_search(text, match, env))
>> {
>> const std::string var = GetEnv(match[1].str());
>> - text.replace(match[0].first, match[0].second, var);
>> + // certain combinations of gcc/libstd++ have problems with this
>> + // text.replace(match[0].first, match[0].second, var);
>> + text.replace(match.prefix().length(), match[0].length(), var);
>> }
>> }
>> {
>> + // win32 style variable replacement
>> static std::regex env("\\%([^}]+)\\%");
>> std::smatch match;
>> while (std::regex_search(text, match, env))
>> {
>> const std::string var = GetEnv(match[1].str());
>> - text.replace(match[0].first, match[0].second, var);
>> + // certain combinations of gcc/libstd++ have problems with this
>> + // text.replace(match[0].first, match[0].second, var);
>> + text.replace(match.prefix().length(), match[0].length(), var);
>> }
>> }
>> }
>> @@ -232,4 +238,4 @@ std::string GlobalKnobs::ToString(const char* optPerLinePrefix)
>> return ' '*(max_len - name_len)
>>
>>
>> -%>
>> \ No newline at end of file
>> +%>
>> --
>> 2.7.4
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list