[PATCH] D26850: [Driver] Fix recognizing newer OpenSUSE versions

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 13:21:31 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL288061: [Driver] Fix recognizing newer OpenSUSE versions (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D26850?vs=78505&id=79443#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26850

Files:
  cfe/trunk/lib/Driver/Distro.cpp


Index: cfe/trunk/lib/Driver/Distro.cpp
===================================================================
--- cfe/trunk/lib/Driver/Distro.cpp
+++ cfe/trunk/lib/Driver/Distro.cpp
@@ -108,11 +108,14 @@
       if (!Line.trim().startswith("VERSION"))
         continue;
       std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+      // Old versions have split VERSION and PATCHLEVEL
+      // Newer versions use VERSION = x.y
+      std::pair<StringRef, StringRef> SplitVer = SplitLine.second.trim().split('.');
       int Version;
+
       // OpenSUSE/SLES 10 and older are not supported and not compatible
       // with our rules, so just treat them as Distro::UnknownDistro.
-      if (!SplitLine.second.trim().getAsInteger(10, Version) &&
-          Version > 10)
+      if (!SplitVer.first.getAsInteger(10, Version) && Version > 10)
         return Distro::OpenSUSE;
       return Distro::UnknownDistro;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26850.79443.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161128/78e2ba10/attachment-0001.bin>


More information about the llvm-commits mailing list