This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weird testsuite behaviour


Hi,

I just found out the hard way that if a testcase uses
{ dg-options "..." } then _GLIBCXX_ASSERT is not defined by default
for that testcase.

The culprit seems to be this hunk from libstdc++-dg/normal.exp
(I may be wrong here, I'm not a Dejagnu expert)

global DEFAULT_CXXFLAGS
if ![info exists DEFAULT_CXXFLAGS] then {
    set DEFAULT_CXXFLAGS "-D_GLIBCXX_ASSERT"
}

If DEFAULT_CXXFLAGS contained flags such as -O3 or -fstrict-aliasing
this would make sense - the options specified for the testcase should
override the default.

To make matters worse, a number of testcases use both dg-options and
VERIFY():

./18_support/numeric_limits.cc
./23_containers/vector/resize/1.cc
./26_numerics/complex_value.cc
./27_io/ios_base/storage/2.cc
./27_io/manipulators/standard/char/2.cc
./thread/pthread7-rope.cc

Of these, the last contains:

// { dg-options "-D_GLIBCXX_ASSERT -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } }

The VERIFY() checks in the rest seem to be no-ops.

It would be possible to add "-D_GLIBCXX_ASSERT" to every testcase
that uses both dg-options and VERIFY, but this seems really ugly.
Since _GLIBCXX_ASSERT is the default, it shouldn't need a special
switch to turn it on; and hardcoding it in the testcases defeats
the purpose of having it configurable.

It seems to me that either -D_GLIBCXX_ASSERT should be added
unconditionally in normal.exp, or assert should be used by default
in testsuite_hooks.h with a switch (say, _GLIBCXX_NO_ASSERT) to
turn it off.

Does this make sense?

Petur


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]