Re: [RFA/testsuite] Test printing complex numbers in C

Michael Elizabeth Chastain
2002-12-05T04:29:14Z

Fernando Nasser writes:
> I wonder if we wouldn't do something with regards to compiler (GCC)
> versions as well.

I think we should bite the bullet and add something to lib/gdb.exp
to figure out the compiler version.

In fact, I see that we already do! The variable "gcc_compiled" is set
to __GNUC__ if that is defined, or 0 if nothing is defined. "info cpp"
says that __GNUC__ equals the major version of the compiler: 2 for gcc
2.x and 3 for gcc 3.x. This is a documented feature so we can rely on
it being the major version number for all gcc's forever.

So "gcc_compiled" is more than a boolean, it actually has the values:

0 not gnu c
2 gcc v2
3 gcc v3

I haven't actually tested this because I'm kinda tired and my test bed
is cranking on 5.2.91 and I don't want to get close to its playpen
and I don't want to start a different test bed.

As far as using it goes, I agree with Fernando, it's usually a good idea,
because it increases the specificity of the test suite. Also it makes
the test suite a lot easier to maintain because it's clear which results
are expected from which compilers, so that people can read it easier,
and obsolete compilers can be de-supported more easily.

Michael C