Subject: Either lint is broken or libbfd
To: None <tech-toolchain@NetBSD.ORG>
From: Martin Husemann <martin@duskware.de>
List: tech-toolchain
Date: 08/18/2003 02:38:23
When bringing sparc64 support for the new gdb in shape I found that this
code would not pass our lint.

The problem is:

 - libbfd generates a "bfd.h" file that needs to determine host int types.
   It uses #ifdef __GNUC__ and then #if __GNUC__ >= 2 to check for the
   presence of "long long" and then uses this to define a at least 64 bit
   wide int type.

 - The configure scirpt knows of no other ways to find an appropriate type
   for this define (BFD_HOST_64_BIT)

 - On 64 bit archs, to get support for elf64, we need BFD64 to be defined.
   The bfd.h file later verifies that if BFD64 is requested, there is some
   int type at least 64 bits wide.

Fine so far, and works.

Now, the gdb build creates a libbfd, and all libs are linted.
Lint, for some reason I don't realy understand, insists on undefinining
__GNUC__ (see usr.bin/xlint/xlint/xlint.c:345).

Thus, the lint pass on bfd errors out, since we request a 64 bit bfd library
on 64 bit archs, but apparently provide no host int type at least 64 bit
wide.

What to do now? There are three obvious solutions:

 - disable lint on this subtree
 - remove the -U__GNUC__ from lint
 - fix bfd configure or bfd.h.in to at least check for <inttypes.h> and use
   the C99 integer types if available

I would say the latter is the right thing to do, and the first a good
hot fix.

Martin