[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building: alloc.c:766:1: error: negative width in bit-field `_gl_ver
From: |
Paul Eggert |
Subject: |
Re: Building: alloc.c:766:1: error: negative width in bit-field `_gl_verify_error_if_negative' |
Date: |
Mon, 13 Feb 2012 08:57:36 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 |
On 02/13/2012 05:07 AM, Alan Mackenzie wrote:
> How can the compiler transform "INT_MAX <= PTRDIFF_MAX" into a message
> about bit-field widths?
That message is generated for compilers that are not known to
support C11-style static assertions
<http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01188.html>.
In GCC 4.6.0 and later, verify(X) simply expands to _Static_assert(X).
Other compilers (including older GCCs) are not known to have
_Static_assert, so verify(X) expands to:
struct { unsigned _gl_verify_error_if_negative: (X) ? 1 : -1; }
which causes a compile-time error if X is false (the desired
effect); as you've noticed, the diagnostic isn't as nice as
with GCC 4.6.0 and later.
This is implemented in lib/verify.h -- more commentary is there.
My guess is that PTRDIFF_MAX is set incorrectly in your implementation.
Emacs's 'configure' script attempts to detect that, and replace it
with a correct PTRDIFF_MAX, but perhaps we need to improve 'configure'
so that it detects the problem with your implementation.
Can you send the compressed "gcc -E ..." output of the offending
compilation, and the contents of 'config.log' and 'src/config.h' and
(if present) 'lib/stdint.h'? That should help debug the situation.
Also, if you could determine which standard header is defining
ptrdiff_t and PTRDIFF_MAX, and what they're defined to, that might
help.