This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[RFA/RFC] libdecnumber/gstdint.h is back :-(


Hello,

You might remember that we had some issues with libdecnumber/gstdint.h
when compiling dfp.c.  This was because dfp.c includes headers from
libdecnumber which in turn includes gstdint.h.  Unfortunately, GDB
also includes gnulib/stdint.h and the two header files are incompatible.
At the time, we thought we had fixed the problem by introducing
gdb/gstdint.h which only contained an include of <stdint.h>, thus
thinking that it would trick the libdecnumber header files into using
our stdint.h file while compiling GDB.

See: http://www.sourceware.org/ml/gdb-patches/2008-06/msg00513.html
and followup messages for more details.

Unfortunately, it doesn't seem to work after all. I am even wondering
whether it worked back then, but I don't want to spend the time to
do some archeology. The reason it doesn't work is because decContext.h
includes gstdint.h using double quotes:

  #include "gstdint.h"             /* C99 standard integers           */

I looked at the C90 draft that I have, and it seems to be saying
that, whether you use angled brackets or double quotes in your include
syntax, the way the file is located is implementation defined.
So, no help there. This needs to be confirmed, but it looks like
GCC will try to find the include file starting from the same directory
as the file including it when double quotes are used. In other words,
when the following directive is used from ../libdecnumber/decContext.h

   #include "gstdint.h"

GCC will first try ../libdecnumber/gstdint.h, not ./gstdint.h.
This defeats the purpose of the gstdint.h that we introduced in
the gdb subdirectory.

I experimented with using angled brackets to include gstdint.h,
just out of curiousity, and it does indeed fix the build failure.
However, I don't think that libdecnumber would agree to that
change.

What occured to me while thinking about all this is that the
root of the problem is that we have two incompatible files that
should be identical in practice. Since we are always building
libdecnumber, can we use libdecnumber's gstdint.h and ditch
gnulib's stdint.h?

Attached is a patch that implements that.  It fixes the build problem
on Tru64, for instance.

2008-09-13  Joel Brobecker  <brobecker@adacore.com>

        * defs.h: Replace include of gnulib's stdint.h by libdecnumber's
        gstdint.h.
        * Makefile.in (GNULIB_H): Remove @GNULIB_STDINT_H@.
        (HFILES_NO_SRCDIR): Remove gnulib/stdint.in.h.
        * configure.ac: Remove computation and substitution of GNULIB_STDINT_H.
        * configure: Regenerate.

Tested on x86-linux with a full rebuild.  No regression.
Also fixes the build failure on Tru64.

Thoughts? OK to apply?

Thanks,
-- 
Joel

Attachment: gstdint.diff
Description: Text document


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