unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* unexmacosx.c and limits.h problem
@ 2016-09-16 23:04 Bob Halley
  2016-09-17  1:02 ` Paul Eggert
  0 siblings, 1 reply; 16+ messages in thread
From: Bob Halley @ 2016-09-16 23:04 UTC (permalink / raw)
  To: emacs-devel

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





^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-09-17 18:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 23:04 unexmacosx.c and limits.h problem Bob Halley
2016-09-17  1:02 ` 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

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).