[v2,03/21] libcc1: inline some simple methods

Message ID 20210428010119.806184-4-tom@tromey.com
State New
Headers show
Series
  • C++11-based improvements for libcc1
Related show

Commit Message

Tom Tromey April 28, 2021, 1:01 a.m.
This changes libcc1 to inline a trivial method and to use the default
constructor.

libcc1/ChangeLog
2021-04-27  Tom Tromey  <tom@tromey.com>

	* connection.hh (~connection): Use default.
	(print): Inline.
	* connection.cc (cc1_plugin::connection::~connection)
	(cc1_plugin::connection::print): Remove definitions.
---
 libcc1/ChangeLog     | 7 +++++++
 libcc1/connection.cc | 9 ---------
 libcc1/connection.hh | 6 ++++--
 3 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.26.2

Comments

Richard Biener via Gcc-patches April 28, 2021, 3:54 p.m. | #1
On 4/27/2021 7:01 PM, Tom Tromey wrote:
> This changes libcc1 to inline a trivial method and to use the default

> constructor.

>

> libcc1/ChangeLog

> 2021-04-27  Tom Tromey  <tom@tromey.com>

>

> 	* connection.hh (~connection): Use default.

> 	(print): Inline.

> 	* connection.cc (cc1_plugin::connection::~connection)

> 	(cc1_plugin::connection::print): Remove definitions.


OK

Jeff

Patch

diff --git a/libcc1/connection.cc b/libcc1/connection.cc
index 64a6d4922c15..66d573911080 100644
--- a/libcc1/connection.cc
+++ b/libcc1/connection.cc
@@ -27,15 +27,6 @@  along with GCC; see the file COPYING3.  If not see
 #include "connection.hh"
 #include "rpc.hh"
 
-cc1_plugin::connection::~connection ()
-{
-}
-
-void
-cc1_plugin::connection::print (const char *)
-{
-}
-
 cc1_plugin::status
 cc1_plugin::connection::send (char c)
 {
diff --git a/libcc1/connection.hh b/libcc1/connection.hh
index 50e8a8b5a032..a0e99bdbd98f 100644
--- a/libcc1/connection.hh
+++ b/libcc1/connection.hh
@@ -46,7 +46,7 @@  namespace cc1_plugin
     {
     }
 
-    virtual ~connection ();
+    virtual ~connection () = default;
 
     // Send a single character.  This is used to introduce various
     // higher-level protocol elements.
@@ -89,7 +89,9 @@  namespace cc1_plugin
       m_callbacks.add_callback (name, func);
     }
 
-    virtual void print (const char *);
+    virtual void print (const char *)
+    {
+    }
 
   private: