summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-22 13:15:07 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2020-02-26 13:08:30 +0000
commitac97c98fc698838b9d38e454b56be8aeb9e3eb4f (patch)
treeec3ba360ac4dea1109e9c71de0b1b028659987d0
parent12a57d9c943eaa80d87481712fe58f7bf6678ba2 (diff)
downloadqtwebengine-chromium-ac97c98fc698838b9d38e454b56be8aeb9e3eb4f.tar.gz
Restore -fno-delete-null-pointer-checks
The commit https://chromium-review.googlesource.com/c/chromium/src/+/1294449 removed this in an apparent brainfart when it was first moved from gcc to clang, then removed from the patch alltogether. This exposed an issue with a nullptr check in logging that has been fixed. Task-number: QTBUG-77671 Change-Id: I59677ed997da4278c01676b01950c0ea03c67126 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> (cherry picked from commit 32e459f495dc0475cdc1703514a257b45ccd3d84) Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/base/trace_event/category_registry.h15
-rw-r--r--chromium/base/trace_event/trace_log.h6
-rw-r--r--chromium/build/config/compiler/BUILD.gn8
3 files changed, 24 insertions, 5 deletions
diff --git a/chromium/base/trace_event/category_registry.h b/chromium/base/trace_event/category_registry.h
index a6439d94595..a2bdb2c8b29 100644
--- a/chromium/base/trace_event/category_registry.h
+++ b/chromium/base/trace_event/category_registry.h
@@ -83,6 +83,21 @@ class BASE_EXPORT CategoryRegistry {
#endif
}
+ static constexpr const unsigned char* GetBuiltinCategoryEnabled(
+ const char* category_group) {
+#if defined(OS_WIN) && defined(COMPONENT_BUILD)
+ // The address cannot be evaluated at compile-time in Windows compoment
+ // builds.
+ return nullptr;
+#else
+ for (size_t i = 0; i < BuiltinCategories::Size(); ++i) {
+ if (StrEqConstexpr(category_group, BuiltinCategories::At(i)))
+ return categories_[i].state_ptr();
+ }
+ return nullptr;
+#endif
+ }
+
// Returns whether |category| points at one of the meta categories that
// shouldn't be displayed in the tracing UI.
static bool IsMetaCategory(const TraceCategory* category);
diff --git a/chromium/base/trace_event/trace_log.h b/chromium/base/trace_event/trace_log.h
index 55f6825e5c2..fbc251ec118 100644
--- a/chromium/base/trace_event/trace_log.h
+++ b/chromium/base/trace_event/trace_log.h
@@ -221,11 +221,7 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
const unsigned char* category_group_enabled);
static constexpr const unsigned char* GetBuiltinCategoryEnabled(
const char* name) {
- TraceCategory* builtin_category =
- CategoryRegistry::GetBuiltinCategoryByName(name);
- if (builtin_category)
- return builtin_category->state_ptr();
- return nullptr;
+ return CategoryRegistry::GetBuiltinCategoryEnabled(name);
}
// Called by TRACE_EVENT* macros, don't call this directly.
diff --git a/chromium/build/config/compiler/BUILD.gn b/chromium/build/config/compiler/BUILD.gn
index be485fd89b9..d1a60792d22 100644
--- a/chromium/build/config/compiler/BUILD.gn
+++ b/chromium/build/config/compiler/BUILD.gn
@@ -1491,6 +1491,14 @@ config("default_warnings") {
cflags += [ "-Wno-maybe-uninitialized" ]
cflags += [ "-Wno-deprecated-declarations" ]
+ # GCC assumes 'this' is never nullptr and optimizes away code
+ # like "if (this == nullptr) ...": [1]. However, some Chromium
+ # code relies on these types of null pointer checks [2], so
+ # disable this optimization.
+ # [1] https://gcc.gnu.org/gcc-6/porting_to.html#this-cannot-be-null
+ # [2] https://crbug.com/784492#c13
+ cflags += [ "-fno-delete-null-pointer-checks" ]
+
# -Wcomment gives too many false positives in the case a
# backslash ended comment line is followed by a new line of
# comments