Apply upstream patch to improve crashpad goma cachehits.
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3394052
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
diff --git a/third_party/crashpad/crashpad/util/mach/mig_fix.py b/third_party/crashpad/crashpad/util/mach/mig_fix.py
|
||||
index 037746fac3bb8eda68a04ba0af5707e7025e547f..6e2877136a9e9312e28341a603e3e66d78a1ac31 100755
|
||||
--- a/third_party/crashpad/crashpad/util/mach/mig_fix.py
|
||||
+++ b/third_party/crashpad/crashpad/util/mach/mig_fix.py
|
||||
@@ -23,6 +23,33 @@ import sys
|
||||
from mig_gen import MigInterface
|
||||
|
||||
|
||||
+def _make_generated_comments_deterministic(contents):
|
||||
+ """Replaces generated code comments with determenistic ones.
|
||||
+
|
||||
+ This is what is generated by mig (only in .c files):
|
||||
+ /*
|
||||
+ * IDENTIFICATION:
|
||||
+ * stub generated Mon Jan 17 15:28:03 2022
|
||||
+ * with a MiG generated by bootstrap_cmds-122
|
||||
+ * OPTIONS:
|
||||
+ */
|
||||
+
|
||||
+ We look for two specific lines and replace them like so:
|
||||
+ /*
|
||||
+ * IDENTIFICATION:
|
||||
+ * stub generated <suppressed by mig_fix.py>
|
||||
+ * with a MiG generated by <suppressed by mig_fix.py>
|
||||
+ * OPTIONS:
|
||||
+ */
|
||||
+ """
|
||||
+
|
||||
+ return re.sub(r'^( \* (?:stub generated|with a MiG generated by) ).+$',
|
||||
+ r'\1<suppressed by mig_fix.py>',
|
||||
+ contents,
|
||||
+ count=2,
|
||||
+ flags=re.MULTILINE)
|
||||
+
|
||||
+
|
||||
def _fix_user_implementation(implementation, fixed_implementation, header,
|
||||
fixed_header):
|
||||
"""Rewrites a MIG-generated user implementation (.c) file.
|
||||
@@ -33,7 +60,8 @@ def _fix_user_implementation(implementation, fixed_implementation, header,
|
||||
unused in the user implementation file, and this will trigger a
|
||||
-Wunused-local-typedefs warning in gcc unless removed or marked with the
|
||||
“unused” attribute. Also changes header references to point to the new
|
||||
- header filename, if changed.
|
||||
+ header filename, if changed. Replaces generated code comments with
|
||||
+ deterministic ones.
|
||||
|
||||
If |fixed_implementation| is None, overwrites the original; otherwise, puts
|
||||
the result in the file at |fixed_implementation|.
|
||||
@@ -50,6 +78,9 @@ def _fix_user_implementation(implementation, fixed_implementation, header,
|
||||
'#include "%s"' % os.path.basename(header),
|
||||
'#include "%s"' % os.path.basename(fixed_header))
|
||||
|
||||
+ # Replace generated code comments with determenistic ones.
|
||||
+ contents = _make_generated_comments_deterministic(contents)
|
||||
+
|
||||
if fixed_implementation is None:
|
||||
file.seek(0)
|
||||
file.truncate()
|
||||
@@ -71,6 +102,7 @@ def _fix_server_implementation(implementation, fixed_implementation, header,
|
||||
added to a header file, so that other files that include that header file
|
||||
will have access to these declarations from a compilation perspective. Also
|
||||
changes header references to point to the new header filename, if changed.
|
||||
+ Replaces generated code comments with deterministic ones.
|
||||
|
||||
If |fixed_implementation| is None or not provided, overwrites the original;
|
||||
otherwise, puts the result in the file at |fixed_implementation|.
|
||||
@@ -117,6 +149,9 @@ extern
|
||||
'#include "%s"' % os.path.basename(header),
|
||||
'#include "%s"' % os.path.basename(fixed_header))
|
||||
|
||||
+ # Replace generated code comments with determenistic ones.
|
||||
+ contents = _make_generated_comments_deterministic(contents)
|
||||
+
|
||||
if fixed_implementation is None:
|
||||
file.seek(0)
|
||||
file.truncate()
|
||||
Reference in New Issue
Block a user