Checking for minor-minor GCC version in testsuite

Michael Elizabeth Chastain
Wed Jun 9 15:49:00 GMT 2004

Andrew Cagney writes:
> Is there a way to check the minor-minor GCC version?

gcc provides __GNUC_PATCHLEVEL__ but the test suite doesn't use it.

In lib/compiler.c and lib/ you could edit:

  -set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__} -]
  +set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCH_LEVEL__} -]

Test before-and-after; for extra style, change the existing 39 calls
to test_compiler_info:

  gcc-2-*  gcc-2-*-*
  gcc-*-*  gcc-*-*-*
  et cetera

One gotcha: __GNUC_PATCHLEVEL__ is not available in gcc 2.95.3.  I think
this is okay because the compiler_info string will just expand to
"gcc-2-95-__GNUC_PATCHLEVEL__" so as long as no one is looking to
distinguish between gcc 2.95.2 and gcc 2.95.3 it's okay.  Tests for
"gcc-2-*" or "gcc-2-*-*" ought to work.  This gotcha will need a comment
though.  (The gcc doco for 3.3.3 says that __GNUC_PATCHLEVEL__ was
introduced with gcc 3.0 and also works in gcc 2.96 and gcc 2.97).

You could do this, or file a PR and I'll do it.

> The problem, present in gcc 3.3.2 appears to be fixed in gcc 3.3.3 (or 
> at least Red Hat's variant).

Or you could just cop out and treat all of gcc-3-3 as broken.


More information about the Gdb mailing list