Bug 5118 - Incorrect inttypes.h/stdint.h order causes HP-UX build failure in GT4.0.4
: Incorrect inttypes.h/stdint.h order causes HP-UX build failure in GT4.0.4
: Toolkit Internals
: development
: P3 major
: 4.0.5
Assigned To:
  Show dependency treegraph
Reported: 2007-03-20 16:09 by
Modified: 2007-06-07 13:15 (History)

Reorder #include from stdint/inttypes to inttypes/stdint (4.60 KB, patch)
2007-03-20 16:11, Jeff Forys


You need to log in before you can comment on or make changes to this bug.

Description From 2007-03-20 16:09:59
Hi all,

In the autoconfig for the globus core source, the order of the include files
for the inttypes tests (e.g., "uint8_t", "int64_t") differs from GNU's standard
"Factoring default headers" section.  On HP-UX, this causes all the inttype
typedef's to be declared as macros, which in turn results in compilation
failures when other system include files reference <inttypes.h> and try to
redeclare them as typedef's.

Specifically, in "source-trees/core/source/config/acsizes.m4" the order of
inclusion for the inttypes tests is:

    #ifdef HAVE_STDINT_H
    #    include <stdint.h>
    #elif defined(HAVE_INTTYPES_H)
    #    include <inttypes.h>

Note that the GNU standard order puts <inttypes.h> before <stdint.h>.

According to the Open Group, <inttypes.h> always includes <stdint.h>, so if
<inttypes.h> exists, that should be used first:

    "The <inttypes.h> header shall include the <stdint.h> header."
    - http://www.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html

Interestingly (?), on HP-UX, <stdint.h> only includes <inttypes.h> when
compiling in the C99 environment so simply including <stdint.h> does not result
in the inttype typedef's being defined.

The fix is to reorder the inttypes tests in "acsizes.m4" to read:

    #ifdef HAVE_INTTYPES_H
    #    include <inttypes.h>
    #elif defined(HAVE_STDINT_H)
    #    include <stdint.h>

I've attached a patch to "acsizes.m4" that makes this change (along with a set
of matching patches to the "configure" script for those trying to build GT4.0.4
from source on HP-UX).

------- Comment #1 From 2007-03-20 16:11:28 -------
Created an attachment (id=1210) [details]
Reorder #include from stdint/inttypes to inttypes/stdint
------- Comment #2 From 2007-03-21 10:34:53 -------
Thanks for the report Jeff.  I'm assigning this to Mike to merge into the
------- Comment #3 From 2007-06-07 13:15:32 -------

This is committed for the 4.0.5 release.