Use CHAR_BIT instead of NBBY in libctf
authorTom Tromey <tromey@adacore.com>
Tue, 4 Jun 2019 18:16:57 +0000 (12:16 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 4 Jun 2019 20:11:29 +0000 (14:11 -0600)
commit76fad9996335e52f177c99c1ebf024fc7f761be2
tree8666b9126108ffd6528341a4642e6c1ad069cd7e
parent63c6fc6cacf82e6b39f7373d44c1e1e1a0a757fa
Use CHAR_BIT instead of NBBY in libctf

On x86-64 Fedora 29, I tried to build a mingw-hosted gdb that targets
ppc-linux.  You can do this with:

    ../binutils-gdb/configure --host=i686-w64-mingw32 --target=ppc-linux \
        --disable-{binutils,gas,gold,gprof,ld}

The build failed with these errors in libctf:

In file included from ../../binutils-gdb/libctf/ctf-create.c:20:
../../binutils-gdb/libctf/ctf-create.c: In function 'ctf_add_encoded':
../../binutils-gdb/libctf/ctf-create.c:803:59: error: 'NBBY' undeclared (first use in this function)
   dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, NBBY) / NBBY);
                                                           ^~~~
../../binutils-gdb/libctf/ctf-impl.h:254:42: note: in definition of macro 'P2ROUNDUP'
 #define P2ROUNDUP(x, align)  (-(-(x) & -(align)))
                                          ^~~~~
../../binutils-gdb/libctf/ctf-create.c:803:59: note: each undeclared identifier is reported only once for each function it appears in
   dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, NBBY) / NBBY);
                                                           ^~~~
../../binutils-gdb/libctf/ctf-impl.h:254:42: note: in definition of macro 'P2ROUNDUP'
 #define P2ROUNDUP(x, align)  (-(-(x) & -(align)))
                                          ^~~~~
../../binutils-gdb/libctf/ctf-create.c: In function 'ctf_add_slice':
../../binutils-gdb/libctf/ctf-create.c:862:59: error: 'NBBY' undeclared (first use in this function)
   dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, NBBY) / NBBY);
                                                           ^~~~
../../binutils-gdb/libctf/ctf-impl.h:254:42: note: in definition of macro 'P2ROUNDUP'
 #define P2ROUNDUP(x, align)  (-(-(x) & -(align)))
                                          ^~~~~
../../binutils-gdb/libctf/ctf-create.c: In function 'ctf_add_member_offset':
../../binutils-gdb/libctf/ctf-create.c:1341:21: error: 'NBBY' undeclared (first use in this function)
      off += lsize * NBBY;
                     ^~~~
../../binutils-gdb/libctf/ctf-create.c: In function 'ctf_add_type':
../../binutils-gdb/libctf/ctf-create.c:1822:16: warning: unknown conversion type character 'z' in format [-Wformat=]
   ctf_dprintf ("Conflict for type %s against ID %lx: "
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/libctf/ctf-create.c:1823:35: note: format string is defined here
         "union size differs, old %zi, new %zi\n",
                                   ^
../../binutils-gdb/libctf/ctf-create.c:1822:16: warning: unknown conversion type character 'z' in format [-Wformat=]
   ctf_dprintf ("Conflict for type %s against ID %lx: "
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/libctf/ctf-create.c:1823:44: note: format string is defined here
         "union size differs, old %zi, new %zi\n",
                                            ^
../../binutils-gdb/libctf/ctf-create.c:1822:16: warning: too many arguments for format [-Wformat-extra-args]
   ctf_dprintf ("Conflict for type %s against ID %lx: "
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes the actual errors in here.  I did not try to fix the
printf warnings, though I think someone ought to.

Ok?

libctf/ChangeLog
2019-06-04  Tom Tromey  <tromey@adacore.com>

* ctf-create.c (ctf_add_encoded, ctf_add_slice)
(ctf_add_member_offset): Use CHAR_BIT, not NBBY.
libctf/ChangeLog
libctf/ctf-create.c
This page took 0.025628 seconds and 4 git commands to generate.