[PATCH 1/2] Don't differentiate between openSUSE versions.

Johannes Obermayr johannesobermayr at gmx.de
Tue Jun 25 09:05:18 PDT 2013


---
See: https://build.opensuse.org/package/view_file?expand=1&file=assume-opensuse.patch&package=llvm&project=devel:tools:compiler
---
 lib/Driver/ToolChains.cpp | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index a78370f..1bbdf2b 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1958,10 +1958,7 @@ enum Distro {
   Fedora15,
   Fedora16,
   FedoraRawhide,
-  OpenSuse11_3,
-  OpenSuse11_4,
-  OpenSuse12_1,
-  OpenSuse12_2,
+  OpenSUSE,
   UbuntuHardy,
   UbuntuIntrepid,
   UbuntuJaunty,
@@ -1982,8 +1979,8 @@ static bool IsRedhat(enum Distro Distro) {
          (Distro >= RHEL4    && Distro <= RHEL6);
 }
 
-static bool IsOpenSuse(enum Distro Distro) {
-  return Distro >= OpenSuse11_3 && Distro <= OpenSuse12_2;
+static bool IsOpenSUSE(enum Distro Distro) {
+  return Distro == OpenSUSE;
 }
 
 static bool IsDebian(enum Distro Distro) {
@@ -2060,13 +2057,8 @@ static Distro DetectDistro(llvm::Triple::ArchType Arch) {
     return UnknownDistro;
   }
 
-  if (!llvm::MemoryBuffer::getFile("/etc/SuSE-release", File))
-    return llvm::StringSwitch<Distro>(File.get()->getBuffer())
-      .StartsWith("openSUSE 11.3", OpenSuse11_3)
-      .StartsWith("openSUSE 11.4", OpenSuse11_4)
-      .StartsWith("openSUSE 12.1", OpenSuse12_1)
-      .StartsWith("openSUSE 12.2", OpenSuse12_2)
-      .Default(UnknownDistro);
+  if (llvm::sys::fs::exists("/etc/SuSE-release"))
+    return OpenSUSE;
 
   if (llvm::sys::fs::exists("/etc/exherbo-release"))
     return Exherbo;
@@ -2180,7 +2172,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   llvm::Triple::ArchType Arch = Triple.getArch();
   std::string SysRoot = computeSysRoot(Args);
 
-  // Cross-compiling binutils and GCC installations (vanilla and OpenSuse at
+  // Cross-compiling binutils and GCC installations (vanilla and openSUSE at
   // least) put various tools in a triple-prefixed directory off of the parent
   // of the GCC installation. We use the GCC triple here to ensure that we end
   // up with tools that support the same amount of cross compiling as the
@@ -2196,7 +2188,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
 
   Distro Distro = DetectDistro(Arch);
 
-  if (IsOpenSuse(Distro) || IsUbuntu(Distro)) {
+  if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
     ExtraOpts.push_back("-z");
     ExtraOpts.push_back("relro");
   }
@@ -2216,11 +2208,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   // ABI requires a mapping between the GOT and the symbol table.
   // Android loader does not support .gnu.hash.
   if (!IsMips && !IsAndroid) {
-    if (IsRedhat(Distro) || IsOpenSuse(Distro) ||
+    if (IsRedhat(Distro) || IsOpenSUSE(Distro) ||
         (IsUbuntu(Distro) && Distro >= UbuntuMaverick))
       ExtraOpts.push_back("--hash-style=gnu");
 
-    if (IsDebian(Distro) || IsOpenSuse(Distro) || Distro == UbuntuLucid ||
+    if (IsDebian(Distro) || IsOpenSUSE(Distro) || Distro == UbuntuLucid ||
         Distro == UbuntuJaunty || Distro == UbuntuKarmic)
       ExtraOpts.push_back("--hash-style=both");
   }
@@ -2229,12 +2221,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     ExtraOpts.push_back("--no-add-needed");
 
   if (Distro == DebianSqueeze || Distro == DebianWheezy ||
-      Distro == DebianJessie || IsOpenSuse(Distro) ||
+      Distro == DebianJessie || IsOpenSUSE(Distro) ||
       (IsRedhat(Distro) && Distro != RHEL4 && Distro != RHEL5) ||
       (IsUbuntu(Distro) && Distro >= UbuntuKarmic))
     ExtraOpts.push_back("--build-id");
 
-  if (IsOpenSuse(Distro))
+  if (IsOpenSUSE(Distro))
     ExtraOpts.push_back("--enable-new-dtags");
 
   // The selection of paths to try here is designed to match the patterns which
-- 
1.8.1.4




More information about the cfe-commits mailing list