diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-22 13:15:07 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-27 10:31:03 +0100 |
commit | 47293d0f8cf03293822209d9aafee202612ae9fe (patch) | |
tree | b128f6a537b47d8593c38d88ce21388f6b8ac55b | |
parent | 563ed58251011ce1af0fa1e3742fc8f476755f25 (diff) | |
download | qtwebengine-chromium-47293d0f8cf03293822209d9aafee202612ae9fe.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.h | 15 | ||||
-rw-r--r-- | chromium/base/trace_event/trace_log.h | 6 | ||||
-rw-r--r-- | chromium/build/config/compiler/BUILD.gn | 8 |
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 e0c850ca41e..4814893c84c 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 ae972412e91..ab47e2b98f8 100644 --- a/chromium/build/config/compiler/BUILD.gn +++ b/chromium/build/config/compiler/BUILD.gn @@ -1475,6 +1475,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 |