Title: [280738] trunk/PerformanceTests
Revision
280738
Author
commit-qu...@webkit.org
Date
2021-08-06 15:13:32 -0700 (Fri, 06 Aug 2021)

Log Message

MallocBench: fix ODR violation
https://bugs.webkit.org/show_bug.cgi?id=228874

Patch by Michael Catanzaro <mcatanz...@gnome.org> on 2021-08-06
Reviewed by Geoffrey Garen.

When built with LTO enabled, GCC will warn about violations of C++'s one-definition rule.
MallocBench has two different Objects in two different files, which is illegal. We could
rename one of them, but I decided it's simplest to just put them each in anonymous
namespaces in order to restrict them to file scope.

* MallocBench/MallocBench/big.cpp:
* MallocBench/MallocBench/stress.cpp:

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (280737 => 280738)


--- trunk/PerformanceTests/ChangeLog	2021-08-06 22:09:37 UTC (rev 280737)
+++ trunk/PerformanceTests/ChangeLog	2021-08-06 22:13:32 UTC (rev 280738)
@@ -1,3 +1,18 @@
+2021-08-06  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        MallocBench: fix ODR violation
+        https://bugs.webkit.org/show_bug.cgi?id=228874
+
+        Reviewed by Geoffrey Garen.
+
+        When built with LTO enabled, GCC will warn about violations of C++'s one-definition rule.
+        MallocBench has two different Objects in two different files, which is illegal. We could
+        rename one of them, but I decided it's simplest to just put them each in anonymous
+        namespaces in order to restrict them to file scope.
+
+        * MallocBench/MallocBench/big.cpp:
+        * MallocBench/MallocBench/stress.cpp:
+
 2021-07-25  Cathie Chen  <cathiec...@igalia.com>
 
         [Performance test][css-contain] Add test to contain: size layout

Modified: trunk/PerformanceTests/MallocBench/MallocBench/big.cpp (280737 => 280738)


--- trunk/PerformanceTests/MallocBench/MallocBench/big.cpp	2021-08-06 22:09:37 UTC (rev 280737)
+++ trunk/PerformanceTests/MallocBench/MallocBench/big.cpp	2021-08-06 22:13:32 UTC (rev 280738)
@@ -34,11 +34,15 @@
 
 using namespace std;
 
+namespace {
+
 struct Object {
     double* p;
     size_t size;
 };
 
+}
+
 void benchmark_big(CommandLine& commandLine)
 {
     size_t times = 1;

Modified: trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp (280737 => 280738)


--- trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2021-08-06 22:09:37 UTC (rev 280737)
+++ trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2021-08-06 22:13:32 UTC (rev 280738)
@@ -39,6 +39,8 @@
 static const size_t kB = 1024;
 static const size_t MB = kB * kB;
 
+namespace {
+
 struct Object {
     Object(void* pointer, size_t size, long uuid)
         : pointer(pointer)
@@ -123,6 +125,8 @@
     mbfree(object.pointer, object.size);
 }
 
+} // anonymous namespace
+
 void benchmark_stress(CommandLine&)
 {
     const size_t heapSize = 100 * MB;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to