Mesa (staging/19.3): gallium/swr: simplify environmental variabled expansion code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 14 23:06:46 UTC 2020


Module: Mesa
Branch: staging/19.3
Commit: d95d524dba83588b5583daef03ed566db2f6ac6f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d95d524dba83588b5583daef03ed566db2f6ac6f

Author: Krzysztof Raszkowski <krzysztof.raszkowski at intel.com>
Date:   Mon Feb 10 16:24:10 2020 +0100

gallium/swr: simplify environmental variabled expansion code

There were 2 versions of code doing the same thing.
Since std::regexp are locale-sensitive better is to leave old
good way to do this.

Fixes: https://gitlab.freedesktop.org/mesa/mesa/issues/2520
Reviewed-by: Jan Zielinski <jan.zielinski at intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3761>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3761>
(cherry picked from commit 689817c9dfde9a0852f2b2489cb0fa93ffbcb215)

---

 .pick_status.json                                  |  2 +-
 .../swr/rasterizer/codegen/templates/gen_knobs.cpp | 29 ----------------------
 2 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 16dc3e8811d..27b04cc47c1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1156,7 +1156,7 @@
         "description": "gallium/swr: simplify environmental variabled expansion code",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
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 b073f73e3a0..194499aa1e0 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp
@@ -43,9 +43,6 @@
 //========================================================
 void KnobBase::autoExpandEnvironmentVariables(std::string& text)
 {
-#if (__GNUC__) && (GCC_VERSION < 40900)
-    // <regex> isn't implemented prior to gcc-4.9.0
-    // unix style variable replacement
     size_t start;
     while ((start = text.find("${'${'}")) != std::string::npos)
     {
@@ -64,32 +61,6 @@ void KnobBase::autoExpandEnvironmentVariables(std::string& text)
         const std::string var = GetEnv(text.substr(start + 1, end - start - 1));
         text.replace(start, end - start + 1, var);
     }
-#else
-    {
-        // 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());
-            // 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());
-            // 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);
-        }
-    }
-#endif
 }
 
 //========================================================



More information about the mesa-commit mailing list