]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2371] move the definition of END_OF_STREAM from test to the main impl .cc.
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 6 Nov 2012 16:56:50 +0000 (08:56 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 6 Nov 2012 16:56:50 +0000 (08:56 -0800)
based on review discussions.  it makes sense as we cannot assume its address
is never needed in non test applications.

src/lib/dns/master_lexer_inputsource.cc
src/lib/dns/master_lexer_inputsource.h
src/lib/dns/tests/master_lexer_inputsource_unittest.cc

index f38d6c3a53886b6f5518c73bfdba9d9ac11bfd49..ea249cf09da6e5953e9e26f21a594959272b7569 100644 (file)
@@ -29,6 +29,10 @@ createStreamName(std::istream& input_stream) {
 
 } // end of unnamed namespace
 
+// Explicit definition of class static constant.  The value is given in the
+// declaration so it's not needed here.
+const int InputSource::END_OF_STREAM;
+
 InputSource::InputSource(std::istream& input_stream) :
     at_eof_(false),
     line_(1),
index 9251bca1b81f57648e690704530a9909659fca2c..37d0b788629b8a2c2cc3cacebdc0deab62a60c28 100644 (file)
@@ -38,6 +38,11 @@ namespace master_lexer_internal {
 class InputSource {
 public:
     /// \brief Returned by getChar() when end of stream is reached.
+    ///
+    /// \note C++ allows a static const class member of an integral type to
+    /// be used without explicit definition as long as its address isn't
+    /// required.  But, since this is a public member variable and we cannot
+    /// assume how it's used, we give a definition in the implementation.
     static const int END_OF_STREAM = -1;
 
     /// \brief Exception thrown when ungetChar() is made to go before
index f78edb54461776aeee4fb1794b9287bfa7158adc..8e0cf622783cf6a88af7866b9e15a13a4616f076 100644 (file)
@@ -27,10 +27,6 @@ using namespace std;
 using namespace isc::dns;
 using namespace isc::dns::master_lexer_internal;
 
-// Some compilers cannot find symbols of class constants when used in the
-// EXPECT_xxx macros, so we need explicit declaration.
-const int InputSource::END_OF_STREAM;
-
 namespace {
 
 class InputSourceTest : public ::testing::Test {