This revision was automatically updated to reflect the committed changes.
Closed by commit rL285076: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10
and older (authored by mgorny).
Changed prior to commit:
https://reviews.llvm.org/D24954?vs=75704&id=75713#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24954
Files:
cfe/trunk/lib/Driver/ToolChains.cpp
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -3968,8 +3968,25 @@
.Default(UnknownDistro);
}
- if (VFS.exists("/etc/SuSE-release"))
- return OpenSUSE;
+ File = VFS.getBufferForFile("/etc/SuSE-release");
+ if (File) {
+ StringRef Data = File.get()->getBuffer();
+ SmallVector<StringRef, 8> Lines;
+ Data.split(Lines, "\n");
+ for (const StringRef& Line : Lines) {
+ if (!Line.trim().startswith("VERSION"))
+ continue;
+ std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+ int Version;
+ // OpenSUSE/SLES 10 and older are not supported and not compatible
+ // with our rules, so just treat them as UnknownDistro.
+ if (!SplitLine.second.trim().getAsInteger(10, Version) &&
+ Version > 10)
+ return OpenSUSE;
+ return UnknownDistro;
+ }
+ return UnknownDistro;
+ }
if (VFS.exists("/etc/exherbo-release"))
return Exherbo;
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -3968,8 +3968,25 @@
.Default(UnknownDistro);
}
- if (VFS.exists("/etc/SuSE-release"))
- return OpenSUSE;
+ File = VFS.getBufferForFile("/etc/SuSE-release");
+ if (File) {
+ StringRef Data = File.get()->getBuffer();
+ SmallVector<StringRef, 8> Lines;
+ Data.split(Lines, "\n");
+ for (const StringRef& Line : Lines) {
+ if (!Line.trim().startswith("VERSION"))
+ continue;
+ std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+ int Version;
+ // OpenSUSE/SLES 10 and older are not supported and not compatible
+ // with our rules, so just treat them as UnknownDistro.
+ if (!SplitLine.second.trim().getAsInteger(10, Version) &&
+ Version > 10)
+ return OpenSUSE;
+ return UnknownDistro;
+ }
+ return UnknownDistro;
+ }
if (VFS.exists("/etc/exherbo-release"))
return Exherbo;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits