unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bob Halley <halley@play-bow.org>
To: emacs-devel@gnu.org
Subject: unexmacosx.c and limits.h problem
Date: Fri, 16 Sep 2016 16:04:44 -0700	[thread overview]
Message-ID: <17A5977B-7474-4740-BEC7-CFF27E57FC73@play-bow.org> (raw)

Note that I build with -with-wide-int in my ./configure, which is likely relevant here.

The recent changes to generate limits.h on the master branch run because my platform (MacOS Sierra) does not define things like ULLONG_WIDTH).

Most of the C source compiles, but unexmacosx.c fails with:

In file included from unexmacosx.c:100:
./lisp.h:93:26: error: use of undeclared identifier 'LLONG_WIDTH'
enum { EMACS_INT_WIDTH = LLONG_WIDTH };
                         ^
./lisp.h:119:29: error: use of undeclared identifier 'SIZE_WIDTH'
enum { BITS_PER_BITS_WORD = SIZE_WIDTH };
                            ^

And a bunch more related errors, all because those limits.h constants are not defined.

Analysis reveals that while the generated ../lib/limits.h is indeed read, it does NOT define LLONG_WIDTH, etc.  The reason for this is that

#if (! defined ULLONG_WIDTH                                             \
     && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))

is false, because neither _GNU_SOURCE nor  __STDC_WANT_IEC_60559_BFP_EXT__ are defined.

The reason other code works is because it #include <config.h> which defines it before including <limits.h>, but unexmacosx.c includes <stdlib.h> before including <config.h> for reasons it describes, and this causes <limits.h> to get included as well.

My fix was:

diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index bdacc8b..4dd35fb 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -90,6 +90,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    with the #define:s in place, the prototypes will be wrong and we get
    warnings.  To prevent that, include stdlib.h before config.h.  */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
 #include <stdlib.h>
 #include <config.h>
 #undef malloc

Regards,

/Bob





             reply	other threads:[~2016-09-16 23:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 23:04 Bob Halley [this message]
2016-09-17  1:02 ` unexmacosx.c and limits.h problem Paul Eggert
2016-09-17 11:03   ` Richard Copley
2016-09-17 11:18     ` Eli Zaretskii
2016-09-17 11:28       ` Richard Copley
2016-09-17 11:31         ` Richard Copley
2016-09-17 11:51           ` Eli Zaretskii
2016-09-17 12:28             ` Richard Copley
2016-09-17 12:40               ` Richard Copley
2016-09-17 12:56                 ` Richard Copley
2016-09-17 13:38                   ` Eli Zaretskii
2016-09-17 18:14                     ` Paul Eggert
2016-09-17 12:41               ` Eli Zaretskii
2016-09-17 12:46                 ` Richard Copley
2016-09-17 11:34         ` Eli Zaretskii
2016-09-17 11:38           ` Richard Copley

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=17A5977B-7474-4740-BEC7-CFF27E57FC73@play-bow.org \
    --to=halley@play-bow.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).