Author: mgorny Date: Tue Oct 25 10:33:32 2016 New Revision: 285076 URL: http://llvm.org/viewvc/llvm-project?rev=285076&view=rev Log: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
Disable the OpenSUSE rules for OpenSUSE versions older than 11 as they are incompatible with the old binutils on that distribution. Differential Revision: https://reviews.llvm.org/D24954 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=285076&r1=285075&r2=285076&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 25 10:33:32 2016 @@ -3968,8 +3968,25 @@ static Distro DetectDistro(vfs::FileSyst .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 cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits