diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-07 17:33:53 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-03-16 15:20:34 +0100 |
commit | 781da29a4693525fbe1bf9b89539da8c194dfebe (patch) | |
tree | 32995fb764087479f5550068df3b22749475c49e | |
parent | 8ce41bd7441697dd132ce4d17f8826f2e755ec23 (diff) | |
download | qtwebengine-chromium-781da29a4693525fbe1bf9b89539da8c194dfebe.tar.gz |
[Revert] Remove an MSVC-required macro.
We are still building on MSVC
Reverts upstream commit b00a9e7e3d434f208e89fb2734a9c78634c2faef
Change-Id: If76233faa3ec3ec57f4aaac200a21faef1014cc2
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r-- | chromium/base/component_export.h | 11 | ||||
-rw-r--r-- | chromium/base/macros.h | 4 | ||||
-rw-r--r-- | chromium/base/metrics/histogram_macros.h | 6 | ||||
-rw-r--r-- | chromium/base/metrics/histogram_macros_local.h | 6 |
4 files changed, 20 insertions, 7 deletions
diff --git a/chromium/base/component_export.h b/chromium/base/component_export.h index 3785dd033a9..79f230bcc55 100644 --- a/chromium/base/component_export.h +++ b/chromium/base/component_export.h @@ -70,7 +70,16 @@ // |COMPONENT_MACRO_CONDITIONAL_COMMA_()| above to implement conditional macro // expansion. #define COMPONENT_MACRO_SELECT_THIRD_ARGUMENT_(...) \ - COMPONENT_MACRO_SELECT_THIRD_ARGUMENT_IMPL_(__VA_ARGS__) + COMPONENT_MACRO_EXPAND_( \ + COMPONENT_MACRO_SELECT_THIRD_ARGUMENT_IMPL_(__VA_ARGS__)) #define COMPONENT_MACRO_SELECT_THIRD_ARGUMENT_IMPL_(a, b, c, ...) c +// Helper to work around MSVC quirkiness wherein a macro expansion like |,| +// within a parameter list will be treated as a single macro argument. This is +// needed to ensure that |COMPONENT_MACRO_CONDITIONAL_COMMA_()| above can expand +// to multiple separate positional arguments in the affirmative case, thus +// elliciting the desired conditional behavior with +// |COMPONENT_MACRO_SELECT_THIRD_ARGUMENT_()|. +#define COMPONENT_MACRO_EXPAND_(x) x + #endif // BASE_COMPONENT_EXPORT_H_ diff --git a/chromium/base/macros.h b/chromium/base/macros.h index c67bdbd9870..0962f39129a 100644 --- a/chromium/base/macros.h +++ b/chromium/base/macros.h @@ -33,6 +33,10 @@ TypeName() = delete; \ DISALLOW_COPY_AND_ASSIGN(TypeName) +// Workaround for MSVC, which expands __VA_ARGS__ as one macro argument. To +// work around this bug, wrap the entire expression in this macro... +#define CR_EXPAND_ARG(arg) arg + // Used to explicitly mark the return value of a function as unused. If you are // really sure you don't want to do anything with the return value of a function // that has been marked WARN_UNUSED_RESULT, wrap it with this. Example: diff --git a/chromium/base/metrics/histogram_macros.h b/chromium/base/metrics/histogram_macros.h index aacbacc135d..5bb630a04f0 100644 --- a/chromium/base/metrics/histogram_macros.h +++ b/chromium/base/metrics/histogram_macros.h @@ -76,10 +76,10 @@ // enum to an arithmetic type and adding one. Instead, prefer the two argument // version of the macro which automatically deduces the boundary from kMaxValue. #define UMA_HISTOGRAM_ENUMERATION(name, ...) \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ + CR_EXPAND_ARG(INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \ - (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag) + INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY)( \ + name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag)) // As above but "scaled" count to avoid overflows caused by increments of // large amounts. See UMA_HISTOGRAM_SCALED_EXACT_LINEAR for more information. diff --git a/chromium/base/metrics/histogram_macros_local.h b/chromium/base/metrics/histogram_macros_local.h index 47e5ba42f49..0971409a877 100644 --- a/chromium/base/metrics/histogram_macros_local.h +++ b/chromium/base/metrics/histogram_macros_local.h @@ -18,10 +18,10 @@ // For usage details, see the equivalents in histogram_macros.h. #define LOCAL_HISTOGRAM_ENUMERATION(name, ...) \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ + CR_EXPAND_ARG(INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \ - (name, __VA_ARGS__, base::HistogramBase::kNoFlags) + INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY)( \ + name, __VA_ARGS__, base::HistogramBase::kNoFlags)) #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ |