bug#41467: Compiling extensions using Guile 3.0.2 headers doesn't work with clang without -std=c11

Sevan Janiyan <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
On 01/08/2023 02:38, Sevan Janiyan wrote:
> There's more issues after addressing these. I will follow up with a 
> patch of what I took out for the build to succeed (not necessarily 
> correct but to highlight where the issues are).

Here's the changes related to redefinitions I made in order to be able 
to mostly compile Guile 3.0.9 with GCC 4.0.1 on PowerPC Mac OS X 10.4. I 
say mostly as I'm not sure if there are further redefinition issues 
since I'm currently stuck with issues related to the supplied 
32-bit-big-endian image and regenerating it.

The MAX macro in socket.h conflicts with the MAX macro in the system 
header files.

diff -ur /tmp/guile-3.0.9/libguile/dynstack.h ./libguile/dynstack.h
--- /tmp/guile-3.0.9/libguile/dynstack.h	2018-09-22 21:51:40.000000000 +0100
+++ ./libguile/dynstack.h	2023-07-26 16:47:37.000000000 +0100
@@ -28,7 +28,7 @@
  #include "libguile/scm.h"



-
+#undef scm_t_dynstack;
  typedef struct scm_dynstack
  {
    scm_t_bits *base;
diff -ur /tmp/guile-3.0.9/libguile/foreign.h ./libguile/foreign.h
--- /tmp/guile-3.0.9/libguile/foreign.h	2022-01-10 16:58:37.000000000 +0000
+++ ./libguile/foreign.h	2023-07-26 17:33:42.000000000 +0100
@@ -22,6 +22,7 @@

  #include "libguile/gc.h"
  #include "libguile/snarf.h"
+#include "libguile/print.h"

  /* A "foreign pointer" is a wrapped C pointer.  It is represented by a
     cell whose second word is a pointer.  The first word has the
diff -ur /tmp/guile-3.0.9/libguile/pairs.h ./libguile/pairs.h
--- /tmp/guile-3.0.9/libguile/pairs.h	2018-09-22 21:51:40.000000000 +0100
+++ ./libguile/pairs.h	2023-07-26 17:30:00.000000000 +0100
@@ -200,6 +200,7 @@
  #endif

  #ifdef BUILDING_LIBGUILE
+/*
  #ifndef HAVE_GC_IS_HEAP_PTR
  static int
  GC_is_heap_ptr (void *ptr)
@@ -207,6 +208,7 @@
    return GC_base (ptr) != NULL;
  }
  #endif
+*/

  static inline int
  scm_is_mutable_pair (SCM x)
diff -ur /tmp/guile-3.0.9/libguile/programs.h ./libguile/programs.h
--- /tmp/guile-3.0.9/libguile/programs.h	2018-09-22 21:51:40.000000000 +0100
+++ ./libguile/programs.h	2023-07-26 17:32:06.000000000 +0100
@@ -21,6 +21,7 @@
  #define _SCM_PROGRAMS_H_

  #include <libguile/gc.h>
+#include <libguile/print.h>

  /*
   * Programs
diff -ur /tmp/guile-3.0.9/libguile/scm.h ./libguile/scm.h
--- /tmp/guile-3.0.9/libguile/scm.h	2020-05-27 21:48:00.000000000 +0100
+++ ./libguile/scm.h	2023-07-26 16:48:30.000000000 +0100
@@ -821,8 +821,8 @@
  #endif

  typedef struct scm_dynamic_state scm_t_dynamic_state;
-typedef struct scm_print_state scm_print_state;
-typedef struct scm_dynstack scm_t_dynstack;
+/* typedef struct scm_print_state scm_print_state;
+typedef struct scm_dynstack scm_t_dynstack; */
  typedef int32_t scm_t_wchar;
  struct scm_frame;
  struct scm_vm;
diff -ur /tmp/guile-3.0.9/libguile/socket.c ./libguile/socket.c
--- /tmp/guile-3.0.9/libguile/socket.c	2022-10-21 16:39:38.000000000 +0100
+++ ./libguile/socket.c	2023-07-26 17:14:20.000000000 +0100
@@ -774,7 +774,7 @@
     proc is the name of the original procedure.
     size returns the size of the structure allocated.  */

-#define MAX(A, B) ((A) >= (B) ? (A) : (B))
+#define AMAX(A, B) ((A) >= (B) ? (A) : (B))

  static struct sockaddr *
  scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
@@ -864,7 +864,7 @@
  	   connect/bind etc., to fail.  sun_path is always the last
  	   member of the structure.  */
  	addr_size = sizeof (struct sockaddr_un)
-	  + MAX (0, c_address_size + 1 - (sizeof soka->sun_path));
+	  + AMAX (0, c_address_size + 1 - (sizeof soka->sun_path));
  	soka = (struct sockaddr_un *) scm_malloc (addr_size);
  	memset (soka, 0, addr_size);
  	soka->sun_family = AF_UNIX;
diff -ur /tmp/guile-3.0.9/libguile/strings.h ./libguile/strings.h
--- /tmp/guile-3.0.9/libguile/strings.h	2022-02-04 10:15:39.000000000 +0000
+++ ./libguile/strings.h	2023-07-26 17:43:11.000000000 +0100
@@ -26,6 +26,7 @@
  #include <libguile/error.h>
  #include "libguile/inline.h"
  #include <libguile/snarf.h>
+#include <libguile/print.h>




diff -ur /tmp/guile-3.0.9/libguile/threads.h ./libguile/threads.h
--- /tmp/guile-3.0.9/libguile/threads.h	2020-02-08 14:11:34.000000000 +0000
+++ ./libguile/threads.h	2023-07-26 16:41:30.000000000 +0100
@@ -28,6 +28,7 @@
  #include "libguile/iselect.h"
  #include "libguile/smob.h"
  #include "libguile/vm.h"
+#include "libguile/scm.h"

  #if SCM_USE_PTHREAD_THREADS
  #include "libguile/pthread-threads.h"
diff -ur /tmp/guile-3.0.9/libguile/vm.h ./libguile/vm.h
--- /tmp/guile-3.0.9/libguile/vm.h	2019-12-14 17:28:57.000000000 +0000
+++ ./libguile/vm.h	2023-07-26 17:36:53.000000000 +0100
@@ -24,6 +24,7 @@

  #include <libguile/gc.h>
  #include <libguile/programs.h>
+#include <libguile/dynstack.h>

  #define SCM_VM_REGULAR_ENGINE 0
  #define SCM_VM_DEBUG_ENGINE 1
diff -ur /tmp/guile-3.0.9/libguile/weak-set.c ./libguile/weak-set.c
--- /tmp/guile-3.0.9/libguile/weak-set.c	2020-03-27 11:33:32.000000000 +0000
+++ ./libguile/weak-set.c	2023-07-26 17:46:25.000000000 +0100
@@ -165,6 +165,7 @@
      return size - origin + k;
  }

+/*
  #ifndef HAVE_GC_MOVE_DISAPPEARING_LINK
  static void
  GC_move_disappearing_link (void **from, void **to)
@@ -173,6 +174,7 @@
    SCM_I_REGISTER_DISAPPEARING_LINK (to, *to);
  }
  #endif
+*/

  static void
  move_weak_entry (scm_t_weak_entry *from, scm_t_weak_entry *to)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.