all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <4F394100.2030704@cs.ucla.edu> (raw)
In-Reply-To: <20120213130702.GA26954@acm.acm>

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.



  reply	other threads:[~2012-02-13 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-12 11:02 Building: alloc.c:766:1: error: negative width in bit-field `_gl_verify_error_if_negative' Alan Mackenzie
2012-02-12 21:31 ` Paul Eggert
2012-02-13 13:07   ` Alan Mackenzie
2012-02-13 16:57     ` Paul Eggert [this message]
2012-02-13 20:34       ` Alan Mackenzie
2012-02-13 20:50         ` Paul Eggert
2012-02-13 22:41           ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F394100.2030704@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.