[05/27] comp-filter: Ignore ptr size when detecting void ptr to ptr change

Message ID 87o75bmif8.fsf@seketeli.org
State New
Headers
Series Implement type hashing & fix self-comparing gcc-gnat in fc37 |

Commit Message

Dodji Seketeli Aug. 29, 2024, 3:56 p.m. UTC
  Hello,

Note that the output of the test runtestdifffilter has been
ameliorated as void pointer to pointer changes are now completely
ignored.

There are still 2 tests that fail after this patch so they are still
XFAILed: runtestdiffpkg and runtestabidiffexit.  They
are going to be addressed by subsequent patches.

	* src/abg-comp-filter.cc (has_void_ptr_to_ptr_change): Ignore
	pointer size when detecting void pointer to pointer change.
	* tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-comp-filter.cc                        |  9 ++++---
 ...test47-filter-void-ptr-change-report-0.txt | 25 +------------------
 2 files changed, 7 insertions(+), 27 deletions(-)
  

Patch

diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc
index 823b5566..98e629de 100644
--- a/src/abg-comp-filter.cc
+++ b/src/abg-comp-filter.cc
@@ -2008,7 +2008,8 @@  has_void_ptr_to_ptr_change(const diff* dif)
       if (is_void_pointer_type_equivalent(f)
 	  && is_pointer_type(s)
 	  && !is_void_pointer_type_equivalent(s)
-	  && f->get_size_in_bits() == s->get_size_in_bits())
+	  && ((f->get_size_in_bits() == 0)
+	      || (f->get_size_in_bits() == s->get_size_in_bits())))
 	return true;
     }
   else if (const pointer_diff *d = is_pointer_diff(dif))
@@ -2022,7 +2023,8 @@  has_void_ptr_to_ptr_change(const diff* dif)
       if (is_void_pointer_type_equivalent(f)
 	  && is_pointer_type(s)
 	  && !is_void_pointer_type_equivalent(s)
-	  && f->get_size_in_bits() == s->get_size_in_bits())
+	  && ((f->get_size_in_bits() == 0)
+	      || (f->get_size_in_bits() == s->get_size_in_bits())))
 	return true;
     }
   else if (const qualified_type_diff *d = is_qualified_type_diff(dif))
@@ -2036,7 +2038,8 @@  has_void_ptr_to_ptr_change(const diff* dif)
       if (is_void_pointer_type_equivalent(f)
 	  && is_pointer_type(s)
 	  && !is_void_pointer_type_equivalent(s)
-	  && f->get_size_in_bits() == s->get_size_in_bits())
+	  && ((f->get_size_in_bits() == 0)
+	      || (f->get_size_in_bits() == s->get_size_in_bits())))
 	return true;
     }
 
diff --git a/tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt b/tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt
index e644b0f1..41fc64d9 100644
--- a/tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt
+++ b/tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt
@@ -1,26 +1,3 @@ 
-Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
+Functions changes summary: 0 Removed, 0 Changed (2 filtered out), 0 Added functions
 Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
 
-2 functions with some indirect sub-type change:
-
-  [C] 'function void bar(S1*)' at test47-filter-void-ptr-change-v0.c:17:1 has some indirect sub-type changes:
-    parameter 1 of type 'S1*' has sub-type changes:
-      in pointed to type 'struct S1' at test47-filter-void-ptr-change-v1.c:8:1:
-        type size hasn't changed
-        1 data member change:
-          type of 'POINTER m0' changed:
-            underlying type 'void*' changed:
-              in pointed to type 'void':
-                entity changed from 'void' to 'const char'
-                type size changed from 0 to 8 (in bits)
-
-  [C] 'function void foo(S0*)' at test47-filter-void-ptr-change-v0.c:13:1 has some indirect sub-type changes:
-    parameter 1 of type 'S0*' has sub-type changes:
-      in pointed to type 'struct S0' at test47-filter-void-ptr-change-v1.c:1:1:
-        type size hasn't changed
-        1 data member change:
-          type of 'void* m0' changed:
-            in pointed to type 'void':
-              type name changed from 'void' to 'int'
-              type size changed from 0 to 32 (in bits)
-