diff mbox series

[v2,4/5] Make set_drops_artifact_from_ir non-const.

Message ID 20200501155148.98623-5-gprocida@google.com
State Committed
Headers show
Series Clean-ups. | expand

Commit Message

Giuliano Procida May 1, 2020, 3:51 p.m. UTC
Setters should be non-const but set_drops_artifact_from_ir isn't.
This patch fixes this.

This reason this didn't cause a compilation failure is that const
shared_ptr<X> is equivalent to X *const, not const X*.

Note that resolving the apparent const-safety issue will require
std::experimental::propagate_const or similar.

	* include/abg-suppression.h
	(suppression_base::set_drops_artifact_from_ir):
	Drop const qualifier.
	* src/abg-suppression.cc
	(suppression_base::set_drops_artifact_from_ir):
	Drop const qualifier.

Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 include/abg-suppression.h | 2 +-
 src/abg-suppression.cc    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Dodji Seketeli May 11, 2020, 1:03 p.m. UTC | #1
Giuliano Procida <gprocida@google.com> a ?crit:

> Setters should be non-const but set_drops_artifact_from_ir isn't.
> This patch fixes this.
>
> This reason this didn't cause a compilation failure is that const
> shared_ptr<X> is equivalent to X *const, not const X*.
>
> Note that resolving the apparent const-safety issue will require
> std::experimental::propagate_const or similar.
>
> 	* include/abg-suppression.h
> 	(suppression_base::set_drops_artifact_from_ir):
> 	Drop const qualifier.
> 	* src/abg-suppression.cc
> 	(suppression_base::set_drops_artifact_from_ir):
> 	Drop const qualifier.

Applied to master, thanks!

Cheers,
diff mbox series

Patch

diff --git a/include/abg-suppression.h b/include/abg-suppression.h
index 4f1fb417..6383b932 100644
--- a/include/abg-suppression.h
+++ b/include/abg-suppression.h
@@ -71,7 +71,7 @@  public:
   get_drops_artifact_from_ir() const;
 
   void
-  set_drops_artifact_from_ir(bool) const;
+  set_drops_artifact_from_ir(bool);
 
   bool
   get_is_artificial() const;
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index ab67f40a..6d9a0f5f 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -96,7 +96,7 @@  suppression_base::get_drops_artifact_from_ir() const
 /// specification is to avoid adding the matched ABI artifact to the
 /// internal representation.
 void
-suppression_base::set_drops_artifact_from_ir(bool f) const
+suppression_base::set_drops_artifact_from_ir(bool f)
 {priv_->drops_artifact_ = f;}
 
 /// Test is the suppression specification is artificial.