guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-1-24-g4c4


From: Michael Gran
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-1-24-g4c402b8
Date: Sat, 01 Aug 2009 17:37:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=4c402b889eecaa7ffc61da6656f415c8c983507a

The branch, master has been updated
       via  4c402b889eecaa7ffc61da6656f415c8c983507a (commit)
      from  64bad3f5a8d7351a41a5b9ccb1df5c393a48b4a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4c402b889eecaa7ffc61da6656f415c8c983507a
Author: Michael Gran <address@hidden>
Date:   Sat Aug 1 10:15:20 2009 -0700

    Don't use GNU extensions for SCM_MAKE_CHAR macro
    
    Since the contents of SCM_MAKE_CHAR are evaluated more than once,
    don't use it in situations where this could cause side-effects.
    
            * libguile/vm-i-system.c (make-char8): avoid side-effects with
            SCM_MAKE_CHAR call
    
            * libguile/chars.h (SCM_MAKE_CHAR): modified

-----------------------------------------------------------------------

Summary of changes:
 libguile/chars.h       |    8 ++++----
 libguile/vm-i-system.c |    8 +++++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/libguile/chars.h b/libguile/chars.h
index e68f06d..8e1bc64 100644
--- a/libguile/chars.h
+++ b/libguile/chars.h
@@ -37,10 +37,10 @@ typedef scm_t_int32 scm_t_wchar;
 #define SCM_CHARP(x) (SCM_ITAG8(x) == scm_tc8_char)
 #define SCM_CHAR(x) ((scm_t_wchar)SCM_ITAG8_DATA(x))
 
-#define SCM_MAKE_CHAR(x) ({scm_t_int32 _x = (x);                        \
-      _x < 0                                                            \
-        ? SCM_MAKE_ITAG8((scm_t_bits)(unsigned char)_x, scm_tc8_char)   \
-        : SCM_MAKE_ITAG8((scm_t_bits)_x, scm_tc8_char);})
+#define SCM_MAKE_CHAR(x)                                              \
+  (x < 0                                                              \
+   ? SCM_MAKE_ITAG8 ((scm_t_bits) (unsigned char) x, scm_tc8_char)    \
+   : SCM_MAKE_ITAG8 ((scm_t_bits) x, scm_tc8_char))
 
 #define SCM_CODEPOINT_MAX (0x10ffff)
 #define SCM_IS_UNICODE_CHAR(c)                                          \
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index ecafbeb..4536b91 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -171,7 +171,13 @@ VM_DEFINE_INSTRUCTION (15, make_uint64, "make-uint64", 8, 
0, 1)
 
 VM_DEFINE_INSTRUCTION (16, make_char8, "make-char8", 1, 0, 1)
 {
-  PUSH (SCM_MAKE_CHAR (FETCH ()));
+  scm_t_uint8 v = 0;
+  v = FETCH ();
+
+  PUSH (SCM_MAKE_CHAR (v));
+  /* Don't simplify this to PUSH (SCM_MAKE_CHAR (FETCH ())).  The
+     contents of SCM_MAKE_CHAR may be evaluated more than once,
+     resulting in a double fetch.  */
   NEXT;
 }
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]