This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: autoconf for type sizes
- To: zackw at Stanford dot EDU
- Subject: Re: autoconf for type sizes
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 12 Mar 2001 23:47:39 -0500 (EST)
- Cc: akim at epita dot fr, aoliva at redhat dot com, gcc-patches at gcc dot gnu dot org, rth at redhat dot com
> From: "Zack Weinberg" <zackw@Stanford.EDU>
>
> > Because IMHO, the compile-time sizeof check is a gross hack and I wish
> > to reduce our reliance on it. (BTW, I originally wrote it.)
> >
> > I'm especially concerned because it may not work on some non-gcc
> > compilers. We just don't know and while the unreleased upcoming
> > autoconf uses similar hacks, it hasn't been widely tested on non-gcc
> > compilers AFAIK.
>
> Can you be more specific about what you think won't work? I am not
> worried, it seems to me that either hack - duplicate case values or
> negative array lengths - is unlikely to be acceptable to any compiler
> ever, unless you're talking about the pathological compilers they
> argue about on comp.std.c sometimes...[1]
There was a vague report about this method failing on hpux's bundled cc.
http://sources.redhat.com/ml/autoconf-patches/2000-11/subjects.html#00176
I don't know what the resolution of that thread was or whether the
same issue might appear elsewhere.
Whether you use the array or switch trick its the same issue.
Essentially, the compiler used by the autoconf test must be able to
"fold" the sizeof() algebraic or boolean expression down to a
constant.
Recall when using cc (not gcc) the compiler is only passed -g, not -O,
by autoconf, so compilers have to do this folding without having had
opts turned on.
I've cc'ed Alexandre and Akim, maybe they can tell us how this thread
turned out.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions