On 04/16/2010 04:39 PM, Paul Eggert wrote: > First, doesn't the stdbool module already check for this bug? It has > code that looks like this: > > char d[(bool) 0.5 == true ? 1 : -1]; > > Why does this work, while "char h[(bool)0.0==0?1:-1];" fails?
Both tests fail Solaris CC. It's just that in test-stdbool.c, test d is commented out with #if 0, because the gnulib replacement can't guarantee C99 semantics, while it can guarantee the C99 semantics of test f: char f[(_Bool) 0.0 == false ? 1 : -1]; for all reasonable C compilers (we hope). The problem we're up against is a broken C++ compiler. > Second, I don' think that this particular test case is that important. > If we understand why it doesn't work, then the simplest thing to do is > to comment it out. (If we don't understand it, then I'd be a little > more cautious....) Well, given that the test appears to be due to a bug in the Solaris compiler (it accepts (int)0.0, and accepts (bool)0, but rejects (bool)0.0 as constants), I'm okay with that approach. So, the question is now what preprocessor flags to we examine in order to skip that particular portion of test-stdbool.c only for CC? Or do we go full-bore and use #if 0, skipping test f everywhere? -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
