workaround for clang bug on el7

epel8
Than Ngo 2 years ago
parent 790a7e70ce
commit d25279ef18

@ -1,66 +1,277 @@
diff -up chromium-113.0.5672.63/components/version_info/version_info.h.me chromium-113.0.5672.63/components/version_info/version_info.h diff --git a/components/version_info/version_info.cc b/components/version_info/version_info.cc
--- chromium-113.0.5672.63/components/version_info/version_info.h.me 2023-05-04 09:11:37.195903527 +0200 index c5b6a9ea17be1..9b1f5e4478f53 100644
+++ chromium-113.0.5672.63/components/version_info/version_info.h 2023-05-04 10:34:52.213681698 +0200 --- a/components/version_info/version_info.cc
@@ -27,18 +27,18 @@ const std::string GetProductNameAndVersi +++ b/components/version_info/version_info.cc
const std::string& build_version); @@ -4,26 +4,15 @@
// Returns the product name, e.g. "Chromium" or "Google Chrome". #include "components/version_info/version_info.h"
-constexpr std::string GetProductName() {
+std::string GetProductName() {
return PRODUCT_NAME;
}
// Returns the version number, e.g. "6.0.490.1". -#include "base/check.h"
-constexpr std::string GetVersionNumber() { +#include <string>
+std::string GetVersionNumber() { +
return PRODUCT_VERSION; #include "base/no_destructor.h"
-#include "base/notreached.h"
-#include "base/sanitizer_buildflags.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/version.h"
-#include "build/branding_buildflags.h"
-#include "build/build_config.h"
-#include "build/chromeos_buildflags.h"
-#include "components/version_info/version_info_values.h"
namespace version_info {
-const std::string& GetProductNameAndVersionForUserAgent() {
- static const base::NoDestructor<std::string> product_and_version(
- "Chrome/" + GetVersionNumber());
- return *product_and_version;
-}
-
const std::string GetProductNameAndVersionForReducedUserAgent(
const std::string& build_version) {
std::string product_and_version;
@@ -32,14 +21,6 @@ const std::string GetProductNameAndVersionForReducedUserAgent(
return product_and_version;
} }
// Returns the product name and version information for the User-Agent header, -std::string GetProductName() {
// in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>. - return PRODUCT_NAME;
-constexpr std::string GetProductNameAndVersionForUserAgent() { -}
+std::string GetProductNameAndVersionForUserAgent() { -
return "Chrome/" + GetVersionNumber(); -std::string GetVersionNumber() {
- return PRODUCT_VERSION;
-}
-
int GetMajorVersionNumberAsInt() {
DCHECK(GetVersion().IsValid());
return GetVersion().components()[0];
@@ -54,82 +35,4 @@ const base::Version& GetVersion() {
return *version;
} }
@@ -53,19 +53,19 @@ std::string GetMajorVersionNumber(); -std::string GetLastChange() {
- return LAST_CHANGE;
-}
-
-bool IsOfficialBuild() {
- return IS_OFFICIAL_BUILD;
-}
-
-std::string GetOSType() {
-#if BUILDFLAG(IS_WIN)
- return "Windows";
-#elif BUILDFLAG(IS_IOS)
- return "iOS";
-#elif BUILDFLAG(IS_MAC)
- return "Mac OS X";
-#elif BUILDFLAG(IS_CHROMEOS)
-# if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- return "ChromeOS";
-# else
- return "ChromiumOS";
-# endif
-#elif BUILDFLAG(IS_ANDROID)
- return "Android";
-#elif BUILDFLAG(IS_LINUX)
- return "Linux";
-#elif BUILDFLAG(IS_FREEBSD)
- return "FreeBSD";
-#elif BUILDFLAG(IS_OPENBSD)
- return "OpenBSD";
-#elif BUILDFLAG(IS_SOLARIS)
- return "Solaris";
-#elif BUILDFLAG(IS_FUCHSIA)
- return "Fuchsia";
-#else
- return "Unknown";
-#endif
-}
-
-std::string GetChannelString(Channel channel) {
- switch (channel) {
- case Channel::STABLE:
- return "stable";
- case Channel::BETA:
- return "beta";
- case Channel::DEV:
- return "dev";
- case Channel::CANARY:
- return "canary";
- case Channel::UNKNOWN:
- return "unknown";
- }
- NOTREACHED();
- return std::string();
-}
-
-std::string GetSanitizerList() {
- std::string sanitizers;
-#if defined(ADDRESS_SANITIZER)
- sanitizers += "address ";
-#endif
-#if BUILDFLAG(IS_HWASAN)
- sanitizers += "hwaddress ";
-#endif
-#if defined(LEAK_SANITIZER)
- sanitizers += "leak ";
-#endif
-#if defined(MEMORY_SANITIZER)
- sanitizers += "memory ";
-#endif
-#if defined(THREAD_SANITIZER)
- sanitizers += "thread ";
-#endif
-#if defined(UNDEFINED_SANITIZER)
- sanitizers += "undefined ";
-#endif
- return sanitizers;
-}
-
} // namespace version_info
diff --git a/components/version_info/version_info.h b/components/version_info/version_info.h
index cab516659a9e4..ffa554eed7598 100644
--- a/components/version_info/version_info.h
+++ b/components/version_info/version_info.h
@@ -7,7 +7,12 @@
#include <string>
+#include "base/notreached.h"
+#include "base/sanitizer_buildflags.h"
+#include "build/branding_buildflags.h"
+#include "build/build_config.h"
#include "components/version_info/channel.h"
+#include "components/version_info/version_info_values.h"
namespace base {
class Version;
@@ -15,10 +20,6 @@ class Version;
namespace version_info {
-// Returns the product name and version information for the User-Agent header,
-// in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>.
-const std::string& GetProductNameAndVersionForUserAgent();
-
// Returns the product name and reduced version information for the User-Agent
// header, in the format: Chrome/<major_version>.0.build_version.0, where
// `build_version` is a frozen BUILD number.
@@ -26,10 +27,20 @@ const std::string GetProductNameAndVersionForReducedUserAgent(
const std::string& build_version);
// Returns the product name, e.g. "Chromium" or "Google Chrome".
-std::string GetProductName();
+constexpr std::string GetProductName() {
+ return PRODUCT_NAME;
+}
// Returns the version number, e.g. "6.0.490.1".
-std::string GetVersionNumber();
+constexpr std::string GetVersionNumber() {
+ return PRODUCT_VERSION;
+}
+
+// Returns the product name and version information for the User-Agent header,
+// in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>.
+constexpr std::string GetProductNameAndVersionForUserAgent() {
+ return "Chrome/" + GetVersionNumber();
+}
// Returns the major component (aka the milestone) of the version as an int,
// e.g. 6 when the version is "6.0.490.1".
@@ -42,22 +53,89 @@ std::string GetMajorVersionNumber();
const base::Version& GetVersion(); const base::Version& GetVersion();
// Returns a version control specific identifier of this release. // Returns a version control specific identifier of this release.
-constexpr std::string GetLastChange() { -std::string GetLastChange();
+std::string GetLastChange() { +constexpr std::string GetLastChange() {
return LAST_CHANGE; + return LAST_CHANGE;
} +}
// Returns whether this is an "official" release of the current version, i.e. // Returns whether this is an "official" release of the current version, i.e.
// whether knowing GetVersionNumber() is enough to completely determine what // whether knowing GetVersionNumber() is enough to completely determine what
// GetLastChange() is. // GetLastChange() is.
-constexpr bool IsOfficialBuild() { -bool IsOfficialBuild();
+bool IsOfficialBuild() { +constexpr bool IsOfficialBuild() {
return IS_OFFICIAL_BUILD; + return IS_OFFICIAL_BUILD;
} +}
// Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ... // Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ...
-constexpr std::string GetOSType() { -std::string GetOSType();
+std::string GetOSType() { +constexpr std::string GetOSType() {
#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN)
return "Windows"; + return "Windows";
#elif BUILDFLAG(IS_IOS) +#elif BUILDFLAG(IS_IOS)
@@ -97,7 +97,7 @@ constexpr std::string GetOSType() { + return "iOS";
+#elif BUILDFLAG(IS_MAC)
+ return "Mac OS X";
+#elif BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ return "ChromeOS";
+#else
+ return "ChromiumOS";
+#endif
+#elif BUILDFLAG(IS_ANDROID)
+ return "Android";
+#elif BUILDFLAG(IS_LINUX)
+ return "Linux";
+#elif BUILDFLAG(IS_FREEBSD)
+ return "FreeBSD";
+#elif BUILDFLAG(IS_OPENBSD)
+ return "OpenBSD";
+#elif BUILDFLAG(IS_SOLARIS)
+ return "Solaris";
+#elif BUILDFLAG(IS_FUCHSIA)
+ return "Fuchsia";
+#else
+ return "Unknown";
+#endif
+}
// Returns a string equivalent of |channel|, independent of whether the build // Returns a string equivalent of |channel|, independent of whether the build
// is branded or not and without any additional modifiers. // is branded or not and without any additional modifiers.
-constexpr std::string GetChannelString(Channel channel) { -std::string GetChannelString(Channel channel);
+std::string GetChannelString(Channel channel) { +constexpr std::string GetChannelString(Channel channel) {
switch (channel) { + switch (channel) {
case Channel::STABLE: + case Channel::STABLE:
return "stable"; + return "stable";
@@ -114,7 +114,7 @@ constexpr std::string GetChannelString(C + case Channel::BETA:
} + return "beta";
+ case Channel::DEV:
+ return "dev";
+ case Channel::CANARY:
+ return "canary";
+ case Channel::UNKNOWN:
+ return "unknown";
+ }
+ NOTREACHED_NORETURN();
+}
// Returns a list of sanitizers enabled in this build. // Returns a list of sanitizers enabled in this build.
-constexpr std::string GetSanitizerList() { -std::string GetSanitizerList();
+std::string GetSanitizerList() { +constexpr std::string GetSanitizerList() {
return "" + return ""
#if defined(ADDRESS_SANITIZER) +#if defined(ADDRESS_SANITIZER)
"address " + "address "
+#endif
+#if BUILDFLAG(IS_HWASAN)
+ "hwaddress "
+#endif
+#if defined(LEAK_SANITIZER)
+ "leak "
+#endif
+#if defined(MEMORY_SANITIZER)
+ "memory "
+#endif
+#if defined(THREAD_SANITIZER)
+ "thread "
+#endif
+#if defined(UNDEFINED_SANITIZER)
+ "undefined "
+#endif
+ ;
+}
} // namespace version_info

@ -339,7 +339,7 @@ Patch106: chromium-98.0.4758.80-epel7-erase-fix.patch
# Add additional operator== to make el7 happy. # Add additional operator== to make el7 happy.
Patch107: chromium-99.0.4844.51-el7-extra-operator==.patch Patch107: chromium-99.0.4844.51-el7-extra-operator==.patch
# workaround for clang bug # workaround for clang bug on el7
Patch108: chromium-113-constexpr-el7.patch Patch108: chromium-113-constexpr-el7.patch
# fix FTBFS on el7, old kernel # fix FTBFS on el7, old kernel
Patch109: chromium-113-v4l2-revert-el7.patch Patch109: chromium-113-v4l2-revert-el7.patch
@ -945,7 +945,7 @@ udev.
%patch -P105 -p1 -b .el7-old-libdrm %patch -P105 -p1 -b .el7-old-libdrm
%patch -P106 -p1 -b .el7-erase-fix %patch -P106 -p1 -b .el7-erase-fix
%patch -P107 -p1 -b .el7-extra-operator-equalequal %patch -P107 -p1 -b .el7-extra-operator-equalequal
%patch -P108 -p1 -b .constexpr-el7 %patch -P108 -p1 -R -b .constexpr-el7
%patch -P109 -p1 -b .v4l2-revert-el7 %patch -P109 -p1 -b .v4l2-revert-el7
%endif %endif

Loading…
Cancel
Save