public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] operator!= fixes for C++-20
@ 2023-08-31 15:59 Giuliano Procida
  2023-09-07 13:31 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Giuliano Procida @ 2023-08-31 15:59 UTC (permalink / raw)
  To: libabigail
  Cc: dodji, kernel-team, gprocida, maennich, sidnayyar, vvvvvv, Ilya Biryukov

Without these changes, more recent versions of Clang will start to
emit diagnostics:

src/abg-ir.cc:15407:13: error: member 'operator!=' found in multiple base classes of different types
 15407 |   return *l == *r;
       |             ^
src/abg-ir.cc:14123:12: note: member found by ambiguous name lookup
 14123 | type_base::operator!=(const type_base& other) const
       |            ^
src/abg-ir.cc:5162:12: note: member found by ambiguous name lookup
 5162 | decl_base::operator!=(const decl_base& other) const
      |            ^

This fix was contributed by Ilya Biryukov.

	* include/abg-ir.h
	(qualified_typedef): Add definition of operator!=.
	(pointer_type_def): Likewise.
	(reference_type_def): Likewise.
	(class_or_union): Likewise.

Reported-by: Ilya Biryukov <ibiryukov@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 include/abg-ir.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/abg-ir.h b/include/abg-ir.h
index 85c14266..e6728112 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -2252,6 +2252,11 @@ public:
   virtual bool
   operator==(const qualified_type_def&) const;
 
+  virtual bool
+  operator!=(const qualified_type_def& other) const {
+    return !(*this == other);
+  }
+
   CV
   get_cv_quals() const;
 
@@ -2354,6 +2359,11 @@ public:
   bool
   operator==(const pointer_type_def&) const;
 
+  bool
+  operator!=(const pointer_type_def& other) const {
+    return !(*this == other);
+  }
+
   const type_base_sptr
   get_pointed_to_type() const;
 
@@ -2418,6 +2428,11 @@ public:
   bool
   operator==(const reference_type_def&) const;
 
+  bool
+  operator!=(const reference_type_def& other) const {
+    return !(*this == other);
+  }
+
   type_base_sptr
   get_pointed_to_type() const;
 
@@ -4092,6 +4107,11 @@ public:
   virtual bool
   operator==(const class_or_union&) const;
 
+  virtual bool
+  operator !=(const class_or_union& other) const {
+    return !(*this == other);
+  }
+
   virtual bool
   traverse(ir_node_visitor& v);
 
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] operator!= fixes for C++-20
  2023-08-31 15:59 [PATCH] operator!= fixes for C++-20 Giuliano Procida
@ 2023-09-07 13:31 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2023-09-07 13:31 UTC (permalink / raw)
  To: Giuliano Procida
  Cc: libabigail, kernel-team, maennich, sidnayyar, vvvvvv, Ilya Biryukov

Hello Giuliano,

Giuliano Procida <gprocida@google.com> a écrit:

> Without these changes, more recent versions of Clang will start to
> emit diagnostics:
>
> src/abg-ir.cc:15407:13: error: member 'operator!=' found in multiple base classes of different types
>  15407 |   return *l == *r;
>        |             ^
> src/abg-ir.cc:14123:12: note: member found by ambiguous name lookup
>  14123 | type_base::operator!=(const type_base& other) const
>        |            ^
> src/abg-ir.cc:5162:12: note: member found by ambiguous name lookup
>  5162 | decl_base::operator!=(const decl_base& other) const
>       |            ^
>
> This fix was contributed by Ilya Biryukov.
>
> 	* include/abg-ir.h
> 	(qualified_typedef): Add definition of operator!=.
> 	(pointer_type_def): Likewise.
> 	(reference_type_def): Likewise.
> 	(class_or_union): Likewise.
>
> Reported-by: Ilya Biryukov <ibiryukov@google.com>
> Signed-off-by: Giuliano Procida <gprocida@google.com>

Thanks!

I have applied the patch to mainline.

Cheers,

[...]

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-07 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 15:59 [PATCH] operator!= fixes for C++-20 Giuliano Procida
2023-09-07 13:31 ` Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).