aboutsummaryrefslogtreecommitdiffstats
path: root/chromium/chromium/chromium-gcc-12-r1197890.patch
blob: 59152eac3c06b0505377ae7453cfab1f6f8461a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
From 3a05767c2bbba5ee75c9adf0a5971258405520a8 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Mon, 18 Sep 2023 17:18:31 +0000
Subject: [PATCH] GCC: workaround constexpr and raw_ptr issues in autofill
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

First, we workaround the problem with some constexpr destructors
declared to use default implementation, that are not properly
resolved when used.

Then, apparently GCC cannot resolve raw_ptr to a constexpr.

Bug: 819294
Change-Id: I7746e059a288a3250e8126b87bde5f96c3832199
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4866025
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Reviewed-by: Dominic Battre <battre@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1197890}
---
 ...tofill_i18n_parsing_expression_components.h | 18 +++++++++++++-----
 .../autofill_i18n_parsing_expressions.h        |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/components/autofill/core/browser/data_model/autofill_i18n_parsing_expression_components.h b/components/autofill/core/browser/data_model/autofill_i18n_parsing_expression_components.h
index fcc3f168bf231..2609de2f4284f 100644
--- a/components/autofill/core/browser/data_model/autofill_i18n_parsing_expression_components.h
+++ b/components/autofill/core/browser/data_model/autofill_i18n_parsing_expression_components.h
@@ -39,7 +39,7 @@ class AutofillParsingProcess {
   AutofillParsingProcess(const AutofillParsingProcess& other) = delete;
   AutofillParsingProcess& operator=(const AutofillParsingProcess& right) =
       delete;
-  virtual ~AutofillParsingProcess() = default;
+  virtual constexpr ~AutofillParsingProcess() = default;
 
   // Parses `value` and returns the extracted field type matches.
   virtual ValueParsingResults Parse(std::string_view value) const = 0;
@@ -60,7 +60,7 @@ class Decomposition : public AutofillParsingProcess {
         anchor_end_(anchor_end) {}
   Decomposition(const Decomposition&) = delete;
   Decomposition& operator=(const Decomposition&) = delete;
-  ~Decomposition() override = default;
+  constexpr ~Decomposition() override;
 
   ValueParsingResults Parse(std::string_view value) const override;
 
@@ -70,6 +70,8 @@ class Decomposition : public AutofillParsingProcess {
   const bool anchor_end_ = true;
 };
 
+constexpr Decomposition::~Decomposition() = default;
+
 // A DecompositionCascade enables us to try one Decomposition after the next
 // until we have found a match. It can be fitted with a condition to only use it
 // in case the condition is fulfilled. The lack of a condition is expressed by
@@ -84,7 +86,7 @@ class DecompositionCascade : public AutofillParsingProcess {
       : condition_regex_(condition_regex), alternatives_(alternatives) {}
   DecompositionCascade(const DecompositionCascade&) = delete;
   DecompositionCascade& operator=(const DecompositionCascade&) = delete;
-  ~DecompositionCascade() override = default;
+  constexpr ~DecompositionCascade() override;
 
   ValueParsingResults Parse(std::string_view value) const override;
 
@@ -93,6 +95,8 @@ class DecompositionCascade : public AutofillParsingProcess {
   const base::span<const AutofillParsingProcess* const> alternatives_;
 };
 
+constexpr DecompositionCascade::~DecompositionCascade() = default;
+
 // An ExtractPart parsing process attempts to match a string to a
 // parsing expression, and then extracts the captured field type values. It can
 // be fitted with a condition to only use it in case the condition is fulfilled.
@@ -110,7 +114,7 @@ class ExtractPart : public AutofillParsingProcess {
 
   ExtractPart(const ExtractPart&) = delete;
   ExtractPart& operator=(const ExtractPart&) = delete;
-  ~ExtractPart() override = default;
+  constexpr ~ExtractPart() override;
 
   ValueParsingResults Parse(std::string_view value) const override;
 
@@ -119,6 +123,8 @@ class ExtractPart : public AutofillParsingProcess {
   const std::string_view parsing_regex_;
 };
 
+constexpr ExtractPart::~ExtractPart() = default;
+
 // Unlike for a DecompositionCascade, ExtractParts does not follow the "the
 // first match wins" principle but applies all matching attempts in sequence so
 // the last match wins. This also enables extracting different data (e.g. an
@@ -134,7 +140,7 @@ class ExtractParts : public AutofillParsingProcess {
       : condition_regex_(condition_regex), pieces_(pieces) {}
   ExtractParts(const ExtractParts&) = delete;
   ExtractParts& operator=(const ExtractParts&) = delete;
-  ~ExtractParts() override = default;
+  constexpr ~ExtractParts() override;
 
   ValueParsingResults Parse(std::string_view value) const override;
 
@@ -143,6 +149,8 @@ class ExtractParts : public AutofillParsingProcess {
   const base::span<const ExtractPart* const> pieces_;
 };
 
+constexpr ExtractParts::~ExtractParts() = default;
+
 }  // namespace autofill::i18n_model_definition
 
 #endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_AUTOFILL_I18N_PARSING_EXPRESSION_COMPONENTS_H_
diff --git a/components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h b/components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h
index af0c4b0e90866..02b1a240ec9d5 100644
--- a/components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h
+++ b/components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h
@@ -174,7 +174,7 @@ constexpr ExtractParts kExtractParts_7 = ExtractParts("", kExtractParts_7_Pieces
 
 // A lookup map for parsing expressions for countries and field types.
 constexpr auto kAutofillParsingRulesMap =
-    base::MakeFixedFlatMap<CountryAndFieldType, raw_ptr<const AutofillParsingProcess>>({
+    base::MakeFixedFlatMap<CountryAndFieldType, const AutofillParsingProcess*>({
       {{"BR", NAME_FULL}, &kDecompositionCascade_3},
       {{"BR", ADDRESS_HOME_STREET_LOCATION}, &kDecompositionList[8]},
       {{"BR", ADDRESS_HOME_SUBPREMISE}, &kExtractParts_0},
-- 
2.41.0