public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] Remove defined but not used functions pointed out by GCC6.
  2016-01-01  0:00 [PATCH] Remove defined but not used functions pointed out by GCC6 Mark Wielaard
@ 2016-01-01  0:00 ` Dodji Seketeli
  2016-01-01  0:00 ` Ben Woodard
  1 sibling, 0 replies; 4+ messages in thread
From: Dodji Seketeli @ 2016-01-01  0:00 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: libabigail

Mark Wielaard <mjw@redhat.com> a écrit:

> 	* src/abg-ir.cc (convert_node_to_decl(decl_base_sptr)): Remove
> 	definition.
> 	(get_node_name(decl_base_sptr)): Likewise.

Applied to master, thanks!

Cheers,

-- 
		Dodji

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

* Re: [PATCH] Remove defined but not used functions pointed out by GCC6.
  2016-01-01  0:00 ` Ben Woodard
@ 2016-01-01  0:00   ` Dodji Seketeli
  0 siblings, 0 replies; 4+ messages in thread
From: Dodji Seketeli @ 2016-01-01  0:00 UTC (permalink / raw)
  To: Ben Woodard; +Cc: Mark Wielaard, libabigail

Hello,

Ben Woodard <woodard@redhat.com> a écrit:

> I don’t know if these are the kinds of functions that I would get rid
> of. They don’t look like much but even though they aren’t being used
> now, they are the kinds of data access and type conversion functions
> that C++ is known for.

I agree with you that these are small and simple getter/conversion
functions.

The special thing, though, is that they are explicit specializations of
a template function, for the decl_base_sptr type.

What is used in the code today is the specializations of these functions
the the var_decl_sptr type.  Note that var_decl_sptr can be seen as
deriving from decl_base_sptr.  In other words, we use a more specialized
version of these template functions.

And it appears that the more general specialization is not used.  So we
might as well just get rid of it, because we already have a more precise
tool for the task.  If we need it later, it's simple enough to be added
again.  But I suspect that we'll then add even more specialized versions
of it.

Thank you for this comment.  It's cool to have discussions like this :-)

Cheers,

-- 
		Dodji

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

* [PATCH] Remove defined but not used functions pointed out by GCC6.
@ 2016-01-01  0:00 Mark Wielaard
  2016-01-01  0:00 ` Dodji Seketeli
  2016-01-01  0:00 ` Ben Woodard
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Wielaard @ 2016-01-01  0:00 UTC (permalink / raw)
  To: libabigail; +Cc: Mark Wielaard

abg-ir.cc:6041:1: warning: ‘abigail::ir::decl_base_sptr abigail::ir::convert_node_to_decl(std::tr1::shared_ptr<_Tp>) [with NodeKind = abigail::ir::decl_base]’ defined but not used [-Wunused-function]
 convert_node_to_decl(decl_base_sptr node)
 ^~~~~~~~~~~~~~~~~~~~

abg-ir.cc:5990:1: warning: ‘const string& abigail::ir::get_node_name(std::tr1::shared_ptr<_Tp>) [with NodeKind = abigail::ir::decl_base]’ defined but not used -Wunused-function]
 get_node_name(decl_base_sptr node)
 ^~~~~~~~~~~~~

	* src/abg-ir.cc (convert_node_to_decl(decl_base_sptr)): Remove
	definition.
	(get_node_name(decl_base_sptr)): Likewise.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 src/abg-ir.cc | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 8a959f7..4b34916 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -5980,16 +5980,6 @@ template<typename NodeKind>
 static const string&
 get_node_name(shared_ptr<NodeKind> node);
 
-/// Gets the name of a decl_base node.
-///
-/// @param node the decl_base node to get the name from.
-///
-/// @return the name of the node.
-template<>
-const string&
-get_node_name(decl_base_sptr node)
-{return node->get_name();}
-
 /// Gets the name of a class_decl node.
 ///
 /// @param node the decl_base node to get the name from.
@@ -6031,16 +6021,6 @@ template<typename NodeKind>
 static decl_base_sptr
 convert_node_to_decl(shared_ptr<NodeKind> node);
 
-/// Get the declaration of a given decl_base node
-///
-/// @param node the decl_base node to consider.
-///
-/// @return the declaration of the node.
-template<>
-decl_base_sptr
-convert_node_to_decl(decl_base_sptr node)
-{return node;}
-
 /// Get the declaration of a given class_decl node
 ///
 /// @param node the class_decl node to consider.
-- 
2.5.0

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

* Re: [PATCH] Remove defined but not used functions pointed out by GCC6.
  2016-01-01  0:00 [PATCH] Remove defined but not used functions pointed out by GCC6 Mark Wielaard
  2016-01-01  0:00 ` Dodji Seketeli
@ 2016-01-01  0:00 ` Ben Woodard
  2016-01-01  0:00   ` Dodji Seketeli
  1 sibling, 1 reply; 4+ messages in thread
From: Ben Woodard @ 2016-01-01  0:00 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: libabigail

I don’t know if these are the kinds of functions that I would get rid of. They don’t look like much but even though they aren’t being used now, they are the kinds of data access and type conversion functions that C++ is known for. Dodji is the final arbiter in this but I think that removing these functions just to silence a warning isn’t the right approach in this case.

Other opinions?

-ben

> On Jan 26, 2016, at 2:46 AM, Mark Wielaard <mjw@redhat.com> wrote:
> 
> abg-ir.cc:6041:1: warning: ‘abigail::ir::decl_base_sptr abigail::ir::convert_node_to_decl(std::tr1::shared_ptr<_Tp>) [with NodeKind = abigail::ir::decl_base]’ defined but not used [-Wunused-function]
> convert_node_to_decl(decl_base_sptr node)
> ^~~~~~~~~~~~~~~~~~~~
> 
> abg-ir.cc:5990:1: warning: ‘const string& abigail::ir::get_node_name(std::tr1::shared_ptr<_Tp>) [with NodeKind = abigail::ir::decl_base]’ defined but not used -Wunused-function]
> get_node_name(decl_base_sptr node)
> ^~~~~~~~~~~~~
> 
> 	* src/abg-ir.cc (convert_node_to_decl(decl_base_sptr)): Remove
> 	definition.
> 	(get_node_name(decl_base_sptr)): Likewise.
> 
> Signed-off-by: Mark Wielaard <mjw@redhat.com>
> ---
> src/abg-ir.cc | 20 --------------------
> 1 file changed, 20 deletions(-)
> 
> diff --git a/src/abg-ir.cc b/src/abg-ir.cc
> index 8a959f7..4b34916 100644
> --- a/src/abg-ir.cc
> +++ b/src/abg-ir.cc
> @@ -5980,16 +5980,6 @@ template<typename NodeKind>
> static const string&
> get_node_name(shared_ptr<NodeKind> node);
> 
> -/// Gets the name of a decl_base node.
> -///
> -/// @param node the decl_base node to get the name from.
> -///
> -/// @return the name of the node.
> -template<>
> -const string&
> -get_node_name(decl_base_sptr node)
> -{return node->get_name();}
> -
> /// Gets the name of a class_decl node.
> ///
> /// @param node the decl_base node to get the name from.
> @@ -6031,16 +6021,6 @@ template<typename NodeKind>
> static decl_base_sptr
> convert_node_to_decl(shared_ptr<NodeKind> node);
> 
> -/// Get the declaration of a given decl_base node
> -///
> -/// @param node the decl_base node to consider.
> -///
> -/// @return the declaration of the node.
> -template<>
> -decl_base_sptr
> -convert_node_to_decl(decl_base_sptr node)
> -{return node;}
> -
> /// Get the declaration of a given class_decl node
> ///
> /// @param node the class_decl node to consider.
> -- 
> 2.5.0
> 

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

end of thread, other threads:[~2016-01-28  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-01  0:00 [PATCH] Remove defined but not used functions pointed out by GCC6 Mark Wielaard
2016-01-01  0:00 ` Dodji Seketeli
2016-01-01  0:00 ` Ben Woodard
2016-01-01  0:00   ` 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).