Browse Source

[master] define virtual dtor for master lexer state classes.

just for silencing some compilers.  in our usage this doesn't matter
in practice.  committing at my discretion.
JINMEI Tatuya 12 years ago
parent
commit
3f1afa7c18
2 changed files with 8 additions and 0 deletions
  1. 2 0
      src/lib/dns/master_lexer.cc
  2. 6 0
      src/lib/dns/master_lexer_state.h

+ 2 - 0
src/lib/dns/master_lexer.cc

@@ -170,6 +170,7 @@ namespace {
 class CRLF : public State {
 class CRLF : public State {
 public:
 public:
     CRLF() {}
     CRLF() {}
+    virtual ~CRLF() {}          // see the base class for the destructor
     virtual const State* handle(MasterLexer& lexer) const {
     virtual const State* handle(MasterLexer& lexer) const {
         // We've just seen '\r'.  If this is part of a sequence of '\r\n',
         // We've just seen '\r'.  If this is part of a sequence of '\r\n',
         // we combine them as a single END-OF-LINE.  Otherwise we treat the
         // we combine them as a single END-OF-LINE.  Otherwise we treat the
@@ -195,6 +196,7 @@ public:
 class String : public State {
 class String : public State {
 public:
 public:
     String() {}
     String() {}
+    virtual ~String() {}      // see the base class for the destructor
     virtual const State* handle(MasterLexer& /*lexer*/) const {
     virtual const State* handle(MasterLexer& /*lexer*/) const {
         return (NULL);
         return (NULL);
     }
     }

+ 6 - 0
src/lib/dns/master_lexer_state.h

@@ -55,6 +55,12 @@ namespace master_lexer_internal {
 /// this library are expected to use this class.
 /// this library are expected to use this class.
 class State {
 class State {
 public:
 public:
+    /// \brief Virtual destructor.
+    ///
+    /// In our usage this actually doesn't matter, but some compilers complain
+    /// about it and we need to silence them.
+    virtual ~State() {}
+
     /// \brief Begin state transitions to get the next token.
     /// \brief Begin state transitions to get the next token.
     ///
     ///
     /// This is the first method that \c MasterLexer needs to call for a
     /// This is the first method that \c MasterLexer needs to call for a