unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Current master fails to compile
@ 2018-12-09  6:30 Eli Zaretskii
  2018-12-09  7:03 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2018-12-09  6:30 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

  In file included from lisp.h:35:0,
		   from alloc.c:33:
  alloc.c: In function 'allocate_pseudovector':
  alloc.c:3414:31: error: expression in static assertion is not constant
     verify (size_max + rest_max <= VECTOR_ELTS_MAX);
	     ~~~~~~~~~~~~~~~~~~~~^~~~
  ../lib/verify.h:252:32: note: in definition of macro 'verify'
   # define verify(R) _GL_VERIFY (R, "verify (" #R ")")
				  ^
  Makefile:384: recipe for target `alloc.o' failed
  make[1]: *** [alloc.o] Error 1

I see this both on GNU/Linux and on MS-Windows.



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

* Re: Current master fails to compile
  2018-12-09  6:30 Current master fails to compile Eli Zaretskii
@ 2018-12-09  7:03 ` Paul Eggert
  2018-12-09  7:10   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2018-12-09  7:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Eli Zaretskii wrote:
> I see this both on GNU/Linux and on MS-Windows.

Ah, it worked for me under GNU/Linux with GCC 7.3.0 (Ubuntu 18.04) and with GCC 
8.2.1 20181105 (Red Hat 8.2.1-5) (Fedora 29). But I see now that the code was 
relying on a feature that C99 does not require, and perhaps you're using older 
GCCs. I installed the attached patch, which should port to C99; I hope it works 
for you.

[-- Attachment #2: emacs.diff --]
[-- Type: text/x-patch, Size: 755 bytes --]

diff --git a/src/alloc.c b/src/alloc.c
index 3bc9277a7b..201e3f0b13 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3336,10 +3336,14 @@ sweep_vectors (void)
     }
 }
 
-static ptrdiff_t const VECTOR_ELTS_MAX
-  = min (((min (PTRDIFF_MAX, SIZE_MAX) - header_size - large_vector_offset)
-	  / word_size),
-	 MOST_POSITIVE_FIXNUM);
+/* Maximum number of elements in a vector.  This is a macro so that it
+   can be used in an integer constant expression.  */
+
+#define VECTOR_ELTS_MAX \
+  ((ptrdiff_t) \
+   min (((min (PTRDIFF_MAX, SIZE_MAX) - header_size - large_vector_offset) \
+	 / word_size), \
+	MOST_POSITIVE_FIXNUM))
 
 /* Value is a pointer to a newly allocated Lisp_Vector structure
    with room for LEN Lisp_Objects.  LEN must be positive and

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

* Re: Current master fails to compile
  2018-12-09  7:03 ` Paul Eggert
@ 2018-12-09  7:10   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2018-12-09  7:10 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 8 Dec 2018 23:03:03 -0800
> 
> Eli Zaretskii wrote:
> > I see this both on GNU/Linux and on MS-Windows.
> 
> Ah, it worked for me under GNU/Linux with GCC 7.3.0 (Ubuntu 18.04) and with GCC 
> 8.2.1 20181105 (Red Hat 8.2.1-5) (Fedora 29). But I see now that the code was 
> relying on a feature that C99 does not require, and perhaps you're using older 
> GCCs. I installed the attached patch, which should port to C99; I hope it works 
> for you.

It builds now, thanks.

On GNU/Linux (fencepost), GCC version is 4.8.4, but on MS-Windows I
use GCC 7.3.0.  So I wonder why your GCC 7.3.0 did succeed with the
previous version.  But it isn't important enough for you to waste your
time on answering that question.



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

end of thread, other threads:[~2018-12-09  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-09  6:30 Current master fails to compile Eli Zaretskii
2018-12-09  7:03 ` Paul Eggert
2018-12-09  7:10   ` Eli Zaretskii

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