guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 05/08: Remove opaque slots


From: Andy Wingo
Subject: [Guile-commits] 05/08: Remove opaque slots
Date: Sat, 23 Sep 2017 09:57:02 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit b7d88bfe6328413a4a8a09e7826f7e560f830d40
Author: Andy Wingo <address@hidden>
Date:   Sat Sep 23 14:20:58 2017 +0200

    Remove opaque slots
    
    * libguile/struct.c (scm_make_struct_layout): Remove support for opaque
      slots.
      (set_vtable_layout_flags): Remove opaque slots, and make the "switch"
      total.
      (scm_is_valid_vtable_layout): Remove opaque slots.
      (scm_struct_ref, scm_struct_set_x): Remove case for opaque slots.
---
 libguile/struct.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/libguile/struct.c b/libguile/struct.c
index 9b1fd51..4ee5a81 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -107,7 +107,6 @@ SCM_DEFINE (scm_make_struct_layout, "make-struct-layout", 
1, 0, 0,
          case 'w':
          case 'h':
          case 'r':
-         case 'o':
            break;
          default:
            SCM_MISC_ERROR ("unrecognized ref specification: ~S",
@@ -149,6 +148,7 @@ set_vtable_layout_flags (SCM vtable)
        switch (c_layout[field + 1])
          {
          case 'w':
+         case 'h':
            if (field == 0)
              flags |= SCM_VTABLE_FLAG_SIMPLE_RW;
            break;
@@ -157,15 +157,8 @@ set_vtable_layout_flags (SCM vtable)
            flags &= ~SCM_VTABLE_FLAG_SIMPLE_RW;
            break;
 
-          case 'o':
-          case 'O':
-            scm_c_issue_deprecation_warning
-              ("Opaque struct fields are deprecated.  Struct field protection "
-               "should be layered on at a higher level.");
-            /* Fall through.  */
-
          default:
-           flags = 0;
+            abort ();
          }
     }
 
@@ -196,7 +189,6 @@ scm_is_valid_vtable_layout (SCM layout)
           case 'w':
           case 'h':
           case 'r':
-          case 'o':
             break;
           default:
             return 0;
@@ -570,8 +562,7 @@ SCM_DEFINE (scm_make_vtable, "make-vtable", 1, 1, 0,
 
 
 /* Return true if S1 and S2 are equal structures, i.e., if their vtable and
-   contents are the same.  Field protections are honored.  Thus, it is an
-   error to test the equality of structures that contain opaque fields.  */
+   contents are the same.  */
 SCM
 scm_i_struct_equalp (SCM s1, SCM s2)
 #define FUNC_NAME "scm_i_struct_equalp"
@@ -651,14 +642,10 @@ SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0,
   else
     {
       SCM layout;
-      scm_t_wchar field_type, protection;
+      scm_t_wchar field_type;
 
       layout = SCM_STRUCT_LAYOUT (handle);
       field_type = scm_i_symbol_ref (layout, p * 2);
-      protection = scm_i_symbol_ref (layout, p * 2 + 1);
-
-      if (protection == 'o')
-        SCM_MISC_ERROR ("ref denied for field ~A", scm_list_1 (pos));
 
       return (field_type == 'p') ? SCM_PACK (data) : scm_from_uintptr_t (data);
     }
@@ -696,7 +683,7 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0,
       field_type = scm_i_symbol_ref (layout, p * 2);
       protection = scm_i_symbol_ref (layout, p * 2 + 1);
 
-      if (protection == 'o' || protection == 'r')
+      if (protection == 'r')
         SCM_MISC_ERROR ("set! denied for field ~A", scm_list_1 (pos));
 
       if (field_type == 'p')



reply via email to

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