unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Fixing a few C99isms
@ 2005-05-04 15:52 Ludovic Courtès
  2005-05-11  7:41 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2005-05-04 15:52 UTC (permalink / raw)


Hi,

Guile 1.7.2 contains a few C99isms, namely local variable declarations
in the middle of a block.  GCC 3 expects C99 by default.  However, older
versions or other compilers may expect raw ANSI code.  Here's a patch
for this.

Thanks,
Ludovic.


--- guile-1.7.2/libguile/gc-card.c~	2005-03-09 22:16:56.000000000 +0100
+++ guile-1.7.2/libguile/gc-card.c	2005-05-04 17:35:25.000000000 +0200
@@ -308,7 +308,9 @@
 
   for (p += offset; p < end; p += span, offset += span)
     {
+      scm_t_bits tag;
       SCM scmptr = PTR2SCM (p);
+
       if (!SCM_C_BVEC_GET (bitvec, offset))
         continue;
 
@@ -312,7 +314,7 @@
       if (!SCM_C_BVEC_GET (bitvec, offset))
         continue;
 
-      scm_t_bits tag = SCM_TYP7 (scmptr);
+      tag = SCM_TYP7 (scmptr);
       if (tag  == scm_tc7_smob)
 	{
 	  tag = SCM_TYP16(scmptr);
@@ -338,12 +340,16 @@
 	  break;
 	}
       
-      SCM tag_as_scm = scm_from_int (tag);
-      SCM current = scm_hashq_ref (hashtab, tag_as_scm, SCM_I_MAKINUM (0));
+      {
+	SCM tag_as_scm, current;
+
+	tag_as_scm = scm_from_int (tag);
+	current = scm_hashq_ref (hashtab, tag_as_scm, SCM_I_MAKINUM (0));
 
       scm_hashq_set_x (hashtab, tag_as_scm,
 		       scm_from_int (scm_to_int (current) + 1));
     }
+    }
 }
 
 
--- guile-1.7.2/libguile/gc.c~	2005-03-03 23:12:32.000000000 +0100
+++ guile-1.7.2/libguile/gc.c	2005-05-04 17:18:57.000000000 +0200
@@ -292,10 +292,11 @@
 	    "Return an alist of statistics of the current live objects. ")
 #define FUNC_NAME s_scm_gc_live_object_stats
 {
+  SCM alist;
   SCM tab = scm_make_hash_table (scm_from_int (57));
   scm_i_all_segments_statistics (tab);
   
-  SCM alist
+  alist
     = scm_internal_hash_fold (&tag_table_to_type_alist, NULL, SCM_EOL, tab);
   
   return alist;
--- guile-1.7.2/libguile/threads.c~	2005-03-09 22:16:56.000000000 +0100
+++ guile-1.7.2/libguile/threads.c	2005-05-04 17:34:58.000000000 +0200
@@ -882,8 +882,8 @@
 "thread.  That is, Guile's mutexes are @emph{recursive}. ")
 #define FUNC_NAME s_scm_lock_mutex
 {
-  SCM_VALIDATE_MUTEX (1, mx);
   char *msg;
+  SCM_VALIDATE_MUTEX (1, mx);
 
   msg = fat_mutex_lock (mx);
   if (msg)



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2005-05-11  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-04 15:52 Fixing a few C99isms Ludovic Courtès
2005-05-11  7:41 ` Neil Jerram

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