[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stdbool.h test v. Compaq C on Tru64

From: Steven M. Schweda
Subject: stdbool.h test v. Compaq C on Tru64
Date: Fri, 19 Oct 2007 22:22:07 -0500 (CDT)


   While trying to build a recent edition of wget on a Tru64 system, I
ran into a problem, apparently involving autoconf's
lib/autoconf/headers.m4 (autoconf 2.61).  (But if I'm lost, feel free to
redirect me.)

   The problem involves the test for a working stdbool.h, which test
fails unexpectedly, for a novel (quirky) reason.  While the system's
stdbool.h should be adequate for normal purposes, the DEC/Compaq/HP C
compiler can not cope with the test used.  Then, when that test fails,
gnulib substitues its own stdbool.h, with which the compiler can't cope
either (for other reasons).

   The following code extract demonstrates the problem with the
stdbool.h test:

urtx# cat ct_bd.c
#include <stdbool.h>

struct s { _Bool s: 1; _Bool t; } s;
bool e = &s;

int main( void) {}

urtx# cc -c ct_bd.c
cc: Error: ct_bd.c, line 4: In the initializer for e, the address cannot be conv
erted to the destination type. (badstaticcvt)
bool e = &s;

This is a compiler problem, not a stdbool.h problem.  Sadly, the future
of Tru64 being pretty dismal, I don't see much hope of getting a cheap
fix from HP for this.  On the bright side, a relatively simple (and
harmless?) change to the test program seems to avoid this problem, by
changing the scope of the variables:

urtx# cat ct_ok.c
#include <stdbool.h>

int main( void)
    struct s { _Bool s: 1; _Bool t; } s;
    bool e = &s;

urtx# cc -c ct_ok.c

   Assuming that moving the variables (or at least these) from outside
of main() to inside of main() in this test doesn't actually break
anything anywhere, that would seem to be a cleaner fix than adding a
"#ifdef __DECC" exception to gnulib's stdbool.h to work around the
consequent problem there.

   For the record, this was on Tru64 V5.1B-4 (Patch Kit 6), and:

urtx# cc -V
Compaq C V6.5-303 (dtk) on HP Tru64 UNIX V5.1B (Rev. 2650)
Compiler Driver V6.5-302 (dtk) cc Driver

which, so far as I know, is the latest (last?) one available.

   Thoughts?  Opinions?  Comments?  Questions?


   Steven M. Schweda               address@hidden
   382 South Warwick Street        (+1) 651-699-9818
   Saint Paul  MN  55105-2547

reply via email to

[Prev in Thread] Current Thread [Next in Thread]