[PATCH] D109693: Driver: Remove major release version detection for RHEL
Tom Stellard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 13 08:13:06 PDT 2021
tstellar created this revision.
tstellar added a reviewer: serge-sans-paille.
tstellar requested review of this revision.
Herald added a project: clang.
We treat all release of RHEL the same in the driver, so we don't need to
detect the RHEL major release version.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109693
Files:
clang/include/clang/Driver/Distro.h
clang/lib/Driver/Distro.cpp
clang/unittests/Driver/DistroTest.cpp
Index: clang/unittests/Driver/DistroTest.cpp
===================================================================
--- clang/unittests/Driver/DistroTest.cpp
+++ clang/unittests/Driver/DistroTest.cpp
@@ -152,7 +152,7 @@
"REDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n"));
Distro CentOS7{CentOS7FileSystem, llvm::Triple("unknown-pc-linux")};
- ASSERT_EQ(Distro(Distro::RHEL7), CentOS7);
+ ASSERT_EQ(Distro(Distro::RHEL), CentOS7);
ASSERT_FALSE(CentOS7.IsUbuntu());
ASSERT_TRUE(CentOS7.IsRedhat());
ASSERT_FALSE(CentOS7.IsOpenSUSE());
Index: clang/lib/Driver/Distro.cpp
===================================================================
--- clang/lib/Driver/Distro.cpp
+++ clang/lib/Driver/Distro.cpp
@@ -118,12 +118,7 @@
return Distro::Fedora;
if (Data.startswith("Red Hat Enterprise Linux") ||
Data.startswith("CentOS") || Data.startswith("Scientific Linux")) {
- if (Data.find("release 7") != StringRef::npos)
- return Distro::RHEL7;
- else if (Data.find("release 6") != StringRef::npos)
- return Distro::RHEL6;
- else if (Data.find("release 5") != StringRef::npos)
- return Distro::RHEL5;
+ return Distro::RHEL;
}
return Distro::UnknownDistro;
}
Index: clang/include/clang/Driver/Distro.h
===================================================================
--- clang/include/clang/Driver/Distro.h
+++ clang/include/clang/Driver/Distro.h
@@ -39,9 +39,7 @@
DebianBullseye,
DebianBookworm,
Exherbo,
- RHEL5,
- RHEL6,
- RHEL7,
+ RHEL,
Fedora,
Gentoo,
OpenSUSE,
@@ -114,7 +112,7 @@
/// @{
bool IsRedhat() const {
- return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
+ return DistroVal == Fedora || DistroVal == RHEL;
}
bool IsOpenSUSE() const { return DistroVal == OpenSUSE; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109693.372257.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210913/65ac33b4/attachment.bin>
More information about the cfe-commits
mailing list