View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013274CMakeCMakepublic2012-06-06 13:332012-11-05 14:33
ReporterDaniel Richard G. 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPowerPCOSAIXOS Version4.3
Product VersionCMake 2.8.8 
Target VersionCMake 2.8.9Fixed in VersionCMake 2.8.9 
Summary0013274: test_INT_C.c and test_INT_CXX.cxx fail to compile due to broken PRIxNN macros
DescriptionBuilding CMake git nightly on AIX 4.3 yields these errors:

In file included from .../CMake/Utilities/KWIML/test/test_INT_C.c:14:
.../CMake-build/Utilities/KWIML/test/test_INT_format.h: In function `test_INT_format':
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:106: `hi' undeclared (first use in this function)
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:106: (Each undeclared identifier is reported only once
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:106: for each function it appears in.)
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:108: parse error before string constant
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:110: `hd' undeclared (first use in this function)
.../CMake-build/Utilities/KWIML/test/test_INT_format.h:112: parse error before string constant
[...]

(Refer to http://open.cdash.org/viewBuildError.php?buildid=2337121 [^] for the full list)

This platform has a long-standing issue with broken PRIxNN format macros in /usr/include/inttypes.h. An excerpt:

    #define PRId8 %hd
    #define PRId16 %hd
    #define PRId32 %d
    #if defined(__64BIT__)
    #define PRId64 %ld
    #else
    #if defined(_LONG_LONG)
    #define PRId64 %lld
    #endif
    #endif

On the Autoconf side, Gettext has an m4 macro gt_INTTYPES_PRI that checks for this:

    https://gnunet.org/svn/Extractor/m4/inttypes-pri.m4 [^]

CMake could probably avoid the use of inttypes.h on this system altogether; the above files compile correctly with -DcmIML_INT_NO_INTTYPES_H. Either that, or it needs to know to use its own format-string macros instead of the system's.
TagsNo tags attached.
Attached Filespatch file icon kwiml-aix43.patch [^] (14,513 bytes) 2012-06-07 08:20 [Show Content]
? file icon inttypes.h [^] (15,292 bytes) 2012-06-07 14:10
patch file icon kwiml-aix43-2.patch [^] (19,697 bytes) 2012-06-07 14:17 [Show Content]

 Relationships

  Notes
(0029620)
Brad King (manager)
2012-06-06 14:06

The Utilities/KWIML code is designed to *not* do any compiler checks and just "know" everything based on the preprocessor.

What would be an appropriate preprocessor test to identify this system and define cmIML_INT_NO_INTTYPES_H? Some test of __IBMC__?
(0029621)
Daniel Richard G. (reporter)
2012-06-06 15:17

You could do

    #if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51)
    /* Uh oh, broken PRIxNN macros */
    #endif

_AIX43 will be defined on AIX 4.3, but also all later versions. There is no AIX 4.4, so no _AIX44. There appears to have been no 5.0, but the IBM compiler does define _AIX50 (see http://www.ibm.com/developerworks/forums/thread.jspa?threadID=339423 [^]), so it may exist in the wild. 5.1 was the subsequent official release. On my AIX 5.3 system, I get

    > gnu-cpp -dM empty.h | grep -i aix
    #define _AIX 1
    #define _AIX32 1
    #define _AIX41 1
    #define _AIX43 1
    #define _AIX51 1
    #define _AIX52 1
    #define _AIX53 1

and on 4.3,

    > gnu-cpp -dM empty.h | grep -i aix
    #define _AIX 1
    #define _AIX32 1
    #define _AIX41 1
    #define _AIX43 1
(0029623)
Brad King (manager)
2012-06-06 15:40

Please try this patch:
diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in
index 3c1f05d..a7a3218 100644
--- a/Utilities/KWIML/INT.h.in
+++ b/Utilities/KWIML/INT.h.in
@@ -137,6 +137,8 @@ An includer may test the following macros after inclusion:
 # define @KWIML@_INT_NO_INTTYPES_H 1
 #elif defined(__WATCOMC__) /* Watcom */
 # define @KWIML@_INT_NO_INTTYPES_H 1
+#elif defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) /* AIX 4.3 */
+# define @KWIML@_INT_NO_INTTYPES_H 1
 #else /* Assume it exists.  */
 # define @KWIML@_INT_HAVE_INTTYPES_H 1
 #endif


BTW, do the intN_t types get defined correctly by that header?
(0029624)
Daniel Richard G. (reporter)
2012-06-06 16:22

The patch does the trick. (Tested in an existing build tree, because this machine is doggedy-dog-slow.)

inttypes.h does define the intN_t types correctly. The only types I've had trouble with are three of the int_fastN_t set:

    > grep int_fast /usr/include/inttypes.h
    typedef signed char int_fast8_t;
    typedef int32_t int_fast16_t; <--- this one
    typedef int32_t int_fast32_t;
    typedef uint32_t uint_fast8_t; <--- and this one
    typedef uint32_t uint_fast16_t; <--- ditto
    typedef uint32_t uint_fast32_t;
    typedef int64_t int_fast64_t;
    typedef uint64_t uint_fast64_t;

(The standard says these can be larger than advertised, but in practice, no one does this---particularly not GCC, which leads to type conflicts I'm currently working on.)

These three types and the PRIxNN macros aside, the header is good.
(0029625)
Brad King (manager)
2012-06-07 08:21

Thanks for testing. This is at least the second compiler I've encountered that defines its own format macros incorrectly. I haven't actually committed changes for the other one yet, but it needs more granular conditions.

Please test the attached "kwiml-aix43.patch" instead, without the patch in 0013274:0029623.
(0029630)
Daniel Richard G. (reporter)
2012-06-07 14:10

Also need to cover the 64-bit and pointer types:

[ 0%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_C.c.o
In file included from .../CMake/Utilities/KWIML/test/test_INT_C.c:14:
.../Utilities/KWIML/test/test_INT_format.h: In function `test_INT_format':
.../Utilities/KWIML/test/test_INT_format.h:143: `lli' undeclared (first use in this function)
.../Utilities/KWIML/test/test_INT_format.h:143: (Each undeclared identifier is reported only once
.../Utilities/KWIML/test/test_INT_format.h:143: for each function it appears in.)
.../Utilities/KWIML/test/test_INT_format.h:145: parse error before string constant
.../Utilities/KWIML/test/test_INT_format.h:147: `lld' undeclared (first use in this function)
.../Utilities/KWIML/test/test_INT_format.h:149: parse error before string constant
[...]

These lines are the ones generating errors:

  TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560")
  TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560")
  TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560")
  TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000")
  TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056")
  TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000")
  TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000")
  TEST(dPTR, intptr_t, uint32_t, "-1426063360")
  TEST(oPTR, uintptr_t, uintptr_t, "25300000000")
  TEST(uPTR, uintptr_t, uintptr_t, "2868903936")
  TEST(xPTR, uintptr_t, uintptr_t, "ab000000")
  TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB000000")

For reference purposes, I've attached the broken inttypes.h header.
(0029631)
Brad King (manager)
2012-06-07 14:18

Re 0013274:0029630: Oops, cut-n-paste error. Thanks. Please try "kwiml-aix43-2.patch" instead.
(0029632)
Daniel Richard G. (reporter)
2012-06-07 14:41

Yep, that one does the trick. I've got a cmIML_test binary now.

(If you don't mind my asking, which is the other compiler you've seen with broken PRIxNN macros? Only some of the macros are broken?)
(0029635)
Brad King (manager)
2012-06-07 15:14

Re 0013274:0029632: Thanks for testing. The other compiler is Clang on Windows which is still under development anyway. It doesn't understand the MS-extension "I64" format specifier but the <inttypes.h> header it loads specifies it.
(0029637)
Brad King (manager)
2012-06-07 15:23

Applied in two pieces:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1b0fc9c [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6240f853 [^]
(0029638)
Daniel Richard G. (reporter)
2012-06-07 15:23

Ah, so not an old compiler, but a bleeding-edge one. Good to know, thanks :-)
(0031445)
David Cole (manager)
2012-11-05 14:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-06-06 13:33 Daniel Richard G. New Issue
2012-06-06 14:06 Brad King Note Added: 0029620
2012-06-06 15:17 Daniel Richard G. Note Added: 0029621
2012-06-06 15:40 Brad King Note Added: 0029623
2012-06-06 16:22 Daniel Richard G. Note Added: 0029624
2012-06-07 08:20 Brad King File Added: kwiml-aix43.patch
2012-06-07 08:21 Brad King Note Added: 0029625
2012-06-07 14:10 Daniel Richard G. File Added: inttypes.h
2012-06-07 14:10 Daniel Richard G. Note Added: 0029630
2012-06-07 14:17 Brad King File Added: kwiml-aix43-2.patch
2012-06-07 14:18 Brad King Note Added: 0029631
2012-06-07 14:41 Daniel Richard G. Note Added: 0029632
2012-06-07 15:14 Brad King Note Added: 0029635
2012-06-07 15:23 Brad King Note Added: 0029637
2012-06-07 15:23 Daniel Richard G. Note Added: 0029638
2012-06-07 15:23 Brad King Assigned To => Brad King
2012-06-07 15:23 Brad King Status new => resolved
2012-06-07 15:23 Brad King Resolution open => fixed
2012-06-07 15:23 Brad King Fixed in Version => CMake 2.8.9
2012-06-07 15:23 Brad King Target Version => CMake 2.8.9
2012-11-05 14:33 David Cole Note Added: 0031445
2012-11-05 14:33 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team