[bind10-dev] DNS message API: name class is ready for review

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Mon Dec 21 20:42:34 UTC 2009


At Mon, 21 Dec 2009 08:49:42 -0600 (CST),
"Jeremy C. Reed" <jreed at isc.org> wrote:

> First I needed this with gcc 4.4.1 but also worked with 4.1.3.

> run_unittests-name_unittest.o: In function `(anonymous namespace)::NameTest_fromText_Test::TestBody()':
> name_unittest.cc:(.text+0x881d): undefined reference to `(anonymous namespace)::NameTest::MAX_LABELS'
> run_unittests-name_unittest.o: In function `(anonymous namespace)::NameTest_fromWire_Test::TestBody()':
> name_unittest.cc:(.text+0x9caf): undefined reference to `(anonymous namespace)::NameTest::MAX_WIRE'
> name_unittest.cc:(.text+0x9fe7): undefined reference to `(anonymous namespace)::NameTest::MAX_LABELS'

I suspect these are the ones used in the EXPECT_EQ() macro.  This
macro seems to do something strange that effectively "hides" the
symbols.  With my g++ 4.2.1 on MacOS 10.6, I encountered this problem
in a way that the g++ complained that it couldn't find
isc::dns::Name::MAX_xxx.  I worked around this by defining copy
constants of these in the test class (which is ugly per se), but your
g++ even complained about it...this is particularly strange because
Name::MAX_WIRE used in NameTest::nameFactoryLowerCase() didn't seem to
cause this problem.

I've not demystified the problem, but I suspect this is related to the
fact that these are class statics constants.  So, following Scott
Meyers advice, I've adopted a different type of workaround: defining
them in the .cc causing the trouble.  In fact, as a workaround this
would be better than my original hack.

I've committed the change to the branch (rev 396).  I confirmed it
worked on NetBSD 5.0 (while the previous rev failed just for the same
errors).  I guess you're using NetBSD, so I believe it works for you,
too.

---
JINMEI, Tatuya



More information about the bind10-dev mailing list