Hi all,

Here's a series of patches to get rid of some stuff marked OBSOLETE.
Since we have a 5.0.0pre2 development snapshot, we no longer need to
keep all these bootstrapping workarounds.  New ones will be introduced
anyway, so let's clean up some cruft.

I also noticed that C_mutate2() has been deprecated for a very long time,
but we still generate calls to it in the compiler, so we can't get rid
of it just yet.  The second patch at least changes the compiler to
generate C_mutate() calls instead (which is identical to C_mutate2()).
This means in the next cleanup round, we can finally get rid of it.

Finally, the -n switch for csc (an old alias for -emit-inline-file) has
been deprecated for a very very long time, so let's finally drop it too.

Cheers,
Peter
From 6e182136c48fef03ed92593173bf43908ebd65c4 Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Thu, 12 Oct 2017 16:09:33 +0200
Subject: [PATCH 1/3] Delete things marked OBSOLETE for the pre2 snapshot

We'll introduce a couple more with the (chicken base) change and
perhaps others, too.  So let's remove the ones which are no longer
necessary.

Note: the scheduler used the flonum 0.0 as a default timeout value as
an argument to a foreign-lambda that accepts an unsigned-int, this had
to be changed to fixnum 0 to avoid a crash due to the removal of the
OBSOLETE compatibility for automatically coercing flonums to these
argument types.  This crash only happens because the scheduler has an
`unsafe' declaration.
---
 NEWS                         |  1 +
 c-platform.scm               |  4 +-
 chicken-syntax.scm           |  3 --
 chicken.condition.import.scm |  5 +--
 chicken.h                    | 55 ++++---------------------
 chicken.import.scm           | 10 -----
 extras.scm                   |  4 --
 library.scm                  |  9 -----
 runtime.c                    | 95 +-------------------------------------------
 scheduler.scm                |  2 +-
 support.scm                  |  9 +----
 synrules.scm                 |  5 ---
 tweaks.scm                   | 12 +-----
 13 files changed, 18 insertions(+), 196 deletions(-)

diff --git a/NEWS b/NEWS
index 3727dba0..9fa2daaf 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@
   - Continuations which discard additional values beyond the first now
     also accept multiple values via direct invocation after being
     captured through `call/cc`, not just via `values` (#1390)
+  - Removed the deprecated C_locative_ref C function.
 
 - Compiler
   - Fixed an off by one allocation problem in generated C code for (list ...).
diff --git a/c-platform.scm b/c-platform.scm
index b01b6edb..4ce20a17 100644
--- a/c-platform.scm
+++ b/c-platform.scm
@@ -66,8 +66,8 @@
      ##sys#list ##sys#cons ##sys#append ##sys#vector ##sys#foreign-char-argument ##sys#foreign-fixnum-argument
      ##sys#foreign-flonum-argument ##sys#error ##sys#peek-c-string ##sys#peek-nonnull-c-string 
      ##sys#peek-and-free-c-string ##sys#peek-and-free-nonnull-c-string
-     ##sys#foreign-block-argument ##sys#foreign-string-argument ##sys#foreign-pointer-argument ##sys#foreign-integer-argument
-     ##sys#call-with-current-continuation) ) )
+     ##sys#foreign-block-argument ##sys#foreign-string-argument
+     ##sys#foreign-pointer-argument ##sys#call-with-current-continuation) ) )
 
 (define default-profiling-declarations
   '((##core#declare
diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index c951d467..cf675f6d 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -1129,9 +1129,6 @@
 	   (x (r 'x))
 	   (y (r 'y))
 	   (slotnames (map car slots)))
-      ;; TODO OBSOLETE remove after snapshot release
-      (unless (feature? #:namespaced-record-type-tags)
-	(set! tag plain-name))
       `(##core#begin
 	;; TODO: Maybe wrap this in an opaque object?
 	(,%define ,type-name (##core#quote ,tag))
diff --git a/chicken.condition.import.scm b/chicken.condition.import.scm
index 6ab6ce8b..943996c1 100644
--- a/chicken.condition.import.scm
+++ b/chicken.condition.import.scm
@@ -39,7 +39,4 @@
    (condition-predicate . chicken.condition#condition-predicate)
    (condition-property-accessor . chicken.condition#condition-property-accessor)
    (get-condition-property . chicken.condition#get-condition-property))
- ;; OBSOLETE: This can be removed after bootstrapping
- (if (##sys#symbol-has-toplevel-binding? '##sys#chicken.condition-macro-environment)
-     ##sys#chicken.condition-macro-environment
-     ##sys#chicken-macro-environment))
+ ##sys#chicken.condition-macro-environment)
diff --git a/chicken.h b/chicken.h
index 3aeb0028..b08f0de2 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1113,9 +1113,6 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
  */
 #if C_STACK_GROWS_DOWNWARD
 # define C_demand(n)              (C_stress && ((C_word)(C_stack_pointer - C_stack_limit) > ((n)+C_scratch_usage)))
-/* OBSOLETE: */
-# define C_stack_probe(p)         (C_stress && (((C_word *)(p)-C_scratch_usage) >= C_stack_limit))
-
 # define C_stack_check1(err)      if(!C_disable_overflow_check) {	\
                                     do { C_byte *_sp = (C_byte*)(C_stack_pointer); \
 				      if(_sp < (C_byte *)C_stack_hard_limit && \
@@ -1125,9 +1122,6 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
 
 #else
 # define C_demand(n)              (C_stress && ((C_word)(C_stack_limit - C_stack_pointer) > ((n)+C_scratch_usage)))
-/* OBSOLETE: */
-# define C_stack_probe(p)         (C_stress && (((C_word *)(p)+C_scratch_usage) < C_stack_limit))
-
 # define C_stack_check1(err)      if(!C_disable_overflow_check) {	\
                                     do { C_byte *_sp = (C_byte*)(C_stack_pointer); \
 				      if(_sp > (C_byte *)C_stack_hard_limit && \
@@ -1186,16 +1180,12 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
 #define C_setsubchar(x, i, n)     (((C_char *)C_data_pointer(x))[ C_unfix(i) ] = C_character_code(n), C_SCHEME_UNDEFINED)
 #define C_setsubbyte(x, i, n)     (((C_char *)C_data_pointer(x))[ C_unfix(i) ] = C_unfix(n), C_SCHEME_UNDEFINED)
 
-/* XXX TODO OBSOLETE, but still used by fx* */
 #define C_fixnum_times(n1, n2)          (C_fix(C_unfix(n1) * C_unfix(n2)))
-/* XXX TODO OBSOLETE, but still used by C_fixnum_plus, which is fx+ */
 #define C_u_fixnum_plus(n1, n2)         (((n1) - C_FIXNUM_BIT) + (n2))
 #define C_fixnum_plus(n1, n2)           (C_u_fixnum_plus(n1, n2) | C_FIXNUM_BIT)
-/* XXX TODO OBSOLETE, but still used by C_fixnum_difference, which is fx- */
 #define C_u_fixnum_difference(n1, n2)   ((n1) - (n2) + C_FIXNUM_BIT)
 #define C_fixnum_difference(n1, n2)     (C_u_fixnum_difference(n1, n2) | C_FIXNUM_BIT)
 #define C_u_fixnum_divide(n1, n2)       (C_fix(C_unfix(n1) / C_unfix(n2)))
-/* XXX TODO OBSOLETE, but still used in unsafe mode in c-platform.scm */
 #define C_u_fixnum_modulo(n1, n2)       (C_fix(C_unfix(n1) % C_unfix(n2)))
 #define C_u_fixnum_and(n1, n2)          ((n1) & (n2))
 #define C_fixnum_and(n1, n2)            (C_u_fixnum_and(n1, n2) | C_FIXNUM_BIT)
@@ -1205,7 +1195,6 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
 #define C_fixnum_not(n)                 ((~(n)) | C_FIXNUM_BIT)
 #define C_fixnum_shift_left(n1, n2)     (C_fix(((C_uword)C_unfix(n1) << (C_uword)C_unfix(n2))))
 #define C_fixnum_shift_right(n1, n2)    (((n1) >> (C_uword)C_unfix(n2)) | C_FIXNUM_BIT)
-/* XXX TODO OBSOLETE, but still used by C_fixnum_negate, which is fxneg */
 #define C_u_fixnum_negate(n)            (-(n) + 2 * C_FIXNUM_BIT)
 #define C_fixnum_negate(n)              (C_u_fixnum_negate(n) | C_FIXNUM_BIT)
 #define C_fixnum_greaterp(n1, n2)       (C_mk_bool((C_word)(n1) > (C_word)(n2)))
@@ -1943,7 +1932,6 @@ C_fctexport C_cpsproc(C_register_finalizer) C_noret;
 C_fctexport C_cpsproc(C_set_dlopen_flags) C_noret;
 C_fctexport C_cpsproc(C_dload) C_noret;
 C_fctexport C_cpsproc(C_become) C_noret;
-C_fctexport C_cpsproc(C_locative_ref) C_noret; /* DEPRECATED */
 C_fctexport C_cpsproc(C_call_with_cthulhu) C_noret;
 C_fctexport C_cpsproc(C_copy_closure) C_noret;
 C_fctexport C_cpsproc(C_dump_heap_state) C_noret;
@@ -1973,12 +1961,8 @@ C_fctexport C_word C_fcall C_i_infinitep(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_zerop(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_u_i_zerop(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_positivep(C_word x) C_regparm;
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_fctexport C_word C_fcall C_u_i_positivep(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_integer_positivep(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_negativep(C_word x) C_regparm;
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_fctexport C_word C_fcall C_u_i_negativep(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_integer_negativep(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_car(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_cdr(C_word x) C_regparm;
@@ -1991,13 +1975,9 @@ C_fctexport C_word C_fcall C_i_cdddr(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_cadddr(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_cddddr(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_list_tail(C_word lst, C_word i) C_regparm;
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
 C_fctexport C_word C_fcall C_i_evenp(C_word x) C_regparm;
-C_fctexport C_word C_fcall C_u_i_evenp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_integer_evenp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_oddp(C_word x) C_regparm;
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_fctexport C_word C_fcall C_u_i_oddp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_integer_oddp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_vector_ref(C_word v, C_word i) C_regparm;
 C_fctexport C_word C_fcall C_i_block_ref(C_word x, C_word i) C_regparm;
@@ -2133,8 +2113,6 @@ C_fctexport C_word C_fcall C_i_foreign_symbol_argumentp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_foreign_tagged_pointer_argumentp(C_word x, C_word t) C_regparm;
 C_fctexport C_word C_fcall C_i_foreign_pointer_argumentp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_foreign_scheme_or_c_pointer_argumentp(C_word x) C_regparm;
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_fctexport C_word C_fcall C_i_foreign_integer_argumentp(C_word x) C_regparm;
 C_fctexport C_word C_fcall C_i_foreign_ranged_integer_argumentp(C_word x, C_word bits) C_regparm;
 C_fctexport C_word C_fcall C_i_foreign_unsigned_ranged_integer_argumentp(C_word x, C_word bits) C_regparm;
 
@@ -2472,12 +2450,10 @@ inline static C_word C_num_to_int(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
+  } else {
+    C_CHECKp(x,C_bignump(C_VAL1(x)),0);
     if (C_bignum_negativep(x)) return -(C_word)C_bignum_digits(x)[0];
     else return (C_word)C_bignum_digits(x)[0];  /* should never be larger */
-  } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_word)C_flonum_magnitude(x);
   }
 }
 
@@ -2486,16 +2462,13 @@ inline static C_s64 C_num_to_int64(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return (C_s64)C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
+  } else {
     C_s64 num = C_bignum_digits(x)[0];
 #ifndef C_SIXTY_FOUR
     if (C_bignum_size(x) > 1) num |= (C_s64)(((C_u64)C_bignum_digits(x)[1]) << 32);
 #endif
     if (C_bignum_negativep(x)) return -num;
     else return num;
-  } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_s64)C_flonum_magnitude(x);
   }
 }
 
@@ -2504,15 +2477,12 @@ inline static C_u64 C_num_to_uint64(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return (C_u64)C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
-    C_u64 num = C_bignum_digits(x)[0];
+  } else {
+    C_s64 num = C_bignum_digits(x)[0];
 #ifndef C_SIXTY_FOUR
     if (C_bignum_size(x) > 1) num |= ((C_u64)C_bignum_digits(x)[1]) << 32;
 #endif
     return num;
-  } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_u64)C_flonum_magnitude(x);
   }
 }
 
@@ -2521,11 +2491,8 @@ inline static C_uword C_num_to_unsigned_int(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return (C_uword)C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
-    return C_bignum_digits(x)[0]; /* should never be larger */
   } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_uword)C_flonum_magnitude(x);
+    return C_bignum_digits(x)[0]; /* should never be larger */
   }
 }
 
@@ -2632,12 +2599,9 @@ inline static C_long C_num_to_long(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return (C_long)C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
+  } else {
     if (C_bignum_negativep(x)) return -(C_long)C_bignum_digits(x)[0];
     else return (C_long)C_bignum_digits(x)[0];
-  } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_long)C_flonum_magnitude(x);
   }
 }
 
@@ -2646,11 +2610,8 @@ inline static C_ulong C_num_to_unsigned_long(C_word x)
 {
   if(x & C_FIXNUM_BIT) {
     return (C_ulong)C_unfix(x);
-  } else if (C_truep(C_bignump(x))) {
-    return (C_ulong)C_bignum_digits(x)[0];
   } else {
-    /* XXX OBSOLETE remove on the next round, remove check above */
-    return (C_ulong)C_flonum_magnitude(x);
+    return (C_ulong)C_bignum_digits(x)[0];
   }
 }
 
diff --git a/chicken.import.scm b/chicken.import.scm
index 06212515..8e2fbebe 100644
--- a/chicken.import.scm
+++ b/chicken.import.scm
@@ -23,16 +23,6 @@
 ; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 ; POSSIBILITY OF SUCH DAMAGE.
 
-;; OBSOLETE: This can be removed after bootstrapping
-(if (not (##sys#symbol-has-toplevel-binding? 'chicken.syntax#expand))
-    (begin
-      (set! chicken.syntax#expand chicken.expand#expand)
-      (set! chicken.syntax#er-macro-transformer chicken.expand#er-macro-transformer)
-      (set! chicken.syntax#ir-macro-transformer chicken.expand#ir-macro-transformer)
-      (set! chicken.syntax#strip-syntax chicken.expand#strip-syntax)
-      (set! chicken.syntax#syntax-error chicken.expand#syntax-error)
-      (set! chicken.syntax#get-line-number chicken.expand#get-line-number)))
-
 (##sys#register-primitive-module
  'chicken
  '((abort . chicken.condition#abort)
diff --git a/extras.scm b/extras.scm
index 6508a551..7c148cdf 100644
--- a/extras.scm
+++ b/extras.scm
@@ -183,10 +183,6 @@
 (define chicken.io#read-string/port read-string/port)
 (define chicken.io#read-string!/port read-string!/port)
 
-;; XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm
-(define ##sys#read-string/port read-string/port)
-(define ##sys#read-string!/port read-string!/port)
-
 (define (read-buffered #!optional (port ##sys#standard-input))
   (##sys#check-input-port port #t 'read-buffered)
   (let ((rb (##sys#slot (##sys#slot port 2) 9))) ; read-buffered method
diff --git a/library.scm b/library.scm
index 584e539c..f87553c6 100644
--- a/library.scm
+++ b/library.scm
@@ -4895,12 +4895,6 @@ EOF
 
 (import chicken.condition)
 
-;; OBSOLETE: This can be removed after bootstrapping, when the
-;; handle-exceptions macro won't be rewritten to a primitive alias.
-;; This is necessary because the compiler uses this macro itself.
-(define #%with-exception-handler with-exception-handler)
-
-
 ;;; Miscellaneous low-level routines:
 
 (define (##sys#structure? x s) (##core#inline "C_i_structurep" x s))
@@ -5067,9 +5061,6 @@ EOF
 (define (##sys#foreign-pointer-argument x) (##core#inline "C_i_foreign_pointer_argumentp" x))
 (define (##sys#foreign-tagged-pointer-argument x tx) (##core#inline "C_i_foreign_tagged_pointer_argumentp" x tx))
 
-;; OBSOLETE
-(define (##sys#foreign-integer-argument x) (##core#inline "C_i_foreign_integer_argumentp" x))
-
 (define (##sys#foreign-ranged-integer-argument obj size)
   (##core#inline "C_i_foreign_ranged_integer_argumentp" obj size))
 (define (##sys#foreign-unsigned-ranged-integer-argument obj size)
diff --git a/runtime.c b/runtime.c
index 12471fdf..260e660d 100644
--- a/runtime.c
+++ b/runtime.c
@@ -866,7 +866,7 @@ static C_PTABLE_ENTRY *create_initial_ptable()
 {
   /* IMPORTANT: hardcoded table size -
      this must match the number of C_pte calls + 1 (NULL terminator)! */
-  C_PTABLE_ENTRY *pt = (C_PTABLE_ENTRY *)C_malloc(sizeof(C_PTABLE_ENTRY) * 63);
+  C_PTABLE_ENTRY *pt = (C_PTABLE_ENTRY *)C_malloc(sizeof(C_PTABLE_ENTRY) * 62);
   int i = 0;
 
   if(pt == NULL)
@@ -921,7 +921,6 @@ static C_PTABLE_ENTRY *create_initial_ptable()
   C_pte(C_peek_uint64);
   C_pte(C_context_switch);
   C_pte(C_register_finalizer);
-  C_pte(C_locative_ref); /* OBSOLETE */
   C_pte(C_copy_closure);
   C_pte(C_dump_heap_state);
   C_pte(C_filter_heap_objects);
@@ -5383,13 +5382,6 @@ C_regparm C_word C_fcall C_i_integer_positivep(C_word x)
   else return C_mk_nbool(C_bignum_negativep(x));
 }
 
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_regparm C_word C_fcall C_u_i_positivep(C_word x)
-{
-  return C_i_positivep(x);
-}
-
-
 C_regparm C_word C_fcall C_i_negativep(C_word x)
 {
   if (x & C_FIXNUM_BIT)
@@ -5409,12 +5401,6 @@ C_regparm C_word C_fcall C_i_negativep(C_word x)
 }
 
 
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_regparm C_word C_fcall C_u_i_negativep(C_word x)
-{
-  return C_i_negativep(x);
-}
-
 C_regparm C_word C_fcall C_i_integer_negativep(C_word x)
 {
   if (x & C_FIXNUM_BIT) return C_i_fixnum_negativep(x);
@@ -5442,12 +5428,6 @@ C_regparm C_word C_fcall C_i_evenp(C_word x)
   }
 }
 
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_regparm C_word C_fcall C_u_i_evenp(C_word x)
-{
-  return C_i_evenp(x);
-}
-
 C_regparm C_word C_fcall C_i_integer_evenp(C_word x)
 {
   if (x & C_FIXNUM_BIT) return C_i_fixnumevenp(x);
@@ -5476,12 +5456,6 @@ C_regparm C_word C_fcall C_i_oddp(C_word x)
 }
 
 
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_regparm C_word C_fcall C_u_i_oddp(C_word x)
-{
-  return C_i_oddp(x);
-}
-
 C_regparm C_word C_fcall C_i_integer_oddp(C_word x)
 {
   if (x & C_FIXNUM_BIT) return C_i_fixnumoddp(x);
@@ -6945,30 +6919,6 @@ C_regparm C_word C_fcall C_i_foreign_unsigned_ranged_integer_argumentp(C_word x,
   }
 }
 
-/* XXX TODO OBSOLETE: This can be removed after recompiling c-platform.scm */
-C_regparm C_word C_fcall C_i_foreign_integer_argumentp(C_word x)
-{
-  double m;
-
-  if((x & C_FIXNUM_BIT) != 0) return x;
-
-  if(C_truep(C_i_bignump(x))) {
-    if (C_bignum_size(x) == 1) return x;
-    else barf(C_BAD_ARGUMENT_TYPE_FOREIGN_LIMITATION, NULL, x);
-  }
-
-  /* XXX OBSOLETE: This should be removed on the next round */
-  if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
-    m = C_flonum_magnitude(x);
-
-    if(m >= C_WORD_MIN && m <= C_WORD_MAX) return x;
-  }
-
-  barf(C_BAD_ARGUMENT_TYPE_NO_INTEGER_ERROR, NULL, x);
-  return C_SCHEME_UNDEFINED;
-}
-
-
 /* I */
 C_regparm C_word C_fcall C_i_not_pair_p_2(C_word x)
 {
@@ -11443,49 +11393,6 @@ C_regparm C_word C_fcall C_a_i_make_locative(C_word **a, int c, C_word type, C_w
   return (C_word)loc;
 }
 
-/* DEPRECATED */
-void C_ccall C_locative_ref(C_word c, C_word *av)
-{
-  C_word
-    /* closure = av[ 0 ] */
-    k = av[ 1 ],
-    loc,
-    *ptr, val,
-#ifdef C_SIXTY_FOUR
-    ab[nmax(C_SIZEOF_BIGNUM(2), WORDS_PER_FLONUM)],
-#else
-    ab[nmax(C_SIZEOF_BIGNUM(1), WORDS_PER_FLONUM)],
-#endif
-    *a = ab;
-
-  if(c != 3) C_bad_argc(c, 3);
-
-  loc = av[ 2 ];
-
-  if(C_immediatep(loc) || C_block_header(loc) != C_LOCATIVE_TAG)
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "locative-ref", loc);
-
-  ptr = (C_word *)C_block_item(loc, 0);
-
-  if(ptr == NULL) barf(C_LOST_LOCATIVE_ERROR, "locative-ref", loc);
-
-  switch(C_unfix(C_block_item(loc, 2))) {
-  case C_SLOT_LOCATIVE: C_kontinue(k, *ptr);
-  case C_CHAR_LOCATIVE: C_kontinue(k, C_make_character(*((char *)ptr)));
-  case C_U8_LOCATIVE: C_kontinue(k, C_fix(*((unsigned char *)ptr)));
-  case C_S8_LOCATIVE: C_kontinue(k, C_fix(*((char *)ptr)));
-  case C_U16_LOCATIVE: C_kontinue(k, C_fix(*((unsigned short *)ptr)));
-  case C_S16_LOCATIVE: C_kontinue(k, C_fix(*((short *)ptr)));
-  case C_U32_LOCATIVE: C_kontinue(k, C_unsigned_int_to_num(&a, *((C_u32 *)ptr)));
-  case C_S32_LOCATIVE: C_kontinue(k, C_int_to_num(&a, *((C_s32 *)ptr)));
-  case C_U64_LOCATIVE: C_kontinue(k, C_uint64_to_num(&a, *((C_u64 *)ptr)));
-  case C_S64_LOCATIVE: C_kontinue(k, C_int64_to_num(&a, *((C_s64 *)ptr)));
-  case C_F32_LOCATIVE: C_kontinue(k, C_flonum(&a, *((float *)ptr)));
-  case C_F64_LOCATIVE: C_kontinue(k, C_flonum(&a, *((double *)ptr)));
-  default: panic(C_text("bad locative type"));
-  }
-}
-
 C_regparm C_word C_fcall C_a_i_locative_ref(C_word **a, int c, C_word loc)
 {
   C_word *ptr;
diff --git a/scheduler.scm b/scheduler.scm
index 1cc67536..d23d24d8 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -457,7 +457,7 @@ EOF
 		  (let* ((tmo1 (caar ##sys#timeout-list))
 			 (now (##core#inline_allocate ("C_a_i_current_milliseconds" 7) #f)))
 		    (max 0 (- tmo1 now)) )
-		  0.0) ) )		; otherwise immediate timeout.
+		  0) ) )		; otherwise immediate timeout.
     (dbg "waiting for I/O with timeout " tmo)
     (let ((n ((foreign-lambda int "C_ready_fds_timeout" bool unsigned-integer)
 	      (or rq? to?) tmo)))
diff --git a/support.scm b/support.scm
index 1c2d27c5..9d00b370 100644
--- a/support.scm
+++ b/support.scm
@@ -483,13 +483,8 @@
 (define-record-printer (node n out)
   (fprintf out "#<node ~a ~a>" (node-class n) (node-parameters n)))
 
-;; this kludge is for allowing the inlined `make-node'
-(cond-expand
-  (namespaced-record-type-tags
-   (define (make-node c p s)
-     (##sys#make-structure 'chicken.compiler.support#node c p s)))
-  (else ; TODO OBSOLETE remove after snapshot release
-   (define (make-node c p s) (##sys#make-structure 'node c p s))))
+(define (make-node c p s)
+  (##sys#make-structure 'chicken.compiler.support#node c p s))
 
 (define (varnode var) (make-node '##core#variable (list var) '()))
 (define (qnode const) (make-node 'quote (list const) '()))
diff --git a/synrules.scm b/synrules.scm
index 7fdf7fa9..d0919862 100644
--- a/synrules.scm
+++ b/synrules.scm
@@ -86,11 +86,6 @@
       (loop (- len 1) (cdr input)))
      (else input))))
 
-;; OBSOLETE
-;; These two can be removed after the next snapshot
-(define ##sys#drop-right drop-right)
-(define ##sys#take-right take-right)
-
 (define (process-syntax-rules ellipsis rules subkeywords r c)
 
   (define %append '##sys#append)
diff --git a/tweaks.scm b/tweaks.scm
index e7d94183..f252a6de 100644
--- a/tweaks.scm
+++ b/tweaks.scm
@@ -38,16 +38,8 @@
      (no-argc-checks)))
   (else))
 
-;; TODO OBSOLETE remove after snapshot release
-(register-feature! #:namespaced-record-type-tags)
-
-(cond-expand
-  (namespaced-record-type-tags
-   (define-inline (node? x) (##sys#structure? x 'chicken.compiler.support#node))
-   (define-inline (make-node c p s) (##sys#make-structure 'chicken.compiler.support#node c p s)))
-  (else ; TODO OBSOLETE remove after snapshot release
-   (define-inline (node? x) (##sys#structure? x 'node))
-   (define-inline (make-node c p s) (##sys#make-structure 'node c p s))))
+(define-inline (node? x) (##sys#structure? x 'chicken.compiler.support#node))
+(define-inline (make-node c p s) (##sys#make-structure 'chicken.compiler.support#node c p s))
 
 (cond-expand
   ((not debugbuild)
-- 
2.11.0

From d7fad9379b535485127fad569e3dde2d85c8b959 Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Thu, 12 Oct 2017 16:35:14 +0200
Subject: [PATCH 2/3] Replace all uses of C_mutate2() with C_mutate()

C_mutate2 has been deprecated for a long time (it has been in core
since 6c90c4a1a89 in 2012, as a temporary compatibility workaround),
but calls to it were *still* being generated by the compiler.  In
order to get rid of the definition, we first need to ensure we don't
generate any calls to it ourselves.

This means that after the next snapshot we can finally and completely
remove C_mutate2().
---
 NEWS          |  2 +-
 c-backend.scm |  8 ++++----
 chicken.h     | 10 +++++-----
 runtime.c     | 26 +++++++++++++-------------
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/NEWS b/NEWS
index 9fa2daaf..52887945 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@
   - Continuations which discard additional values beyond the first now
     also accept multiple values via direct invocation after being
     captured through `call/cc`, not just via `values` (#1390)
-  - Removed the deprecated C_locative_ref C function.
+  - Removed the deprecated C_locative_ref and C_mutate2 C functions.
 
 - Compiler
   - Fixed an off by one allocation problem in generated C code for (list ...).
diff --git a/c-backend.scm b/c-backend.scm
index f1328c42..25fc2157 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -156,7 +156,7 @@
 	     (gen #\)) )
 
 	    ((##core#update)
-	     (gen "C_mutate2(((C_word *)")
+	     (gen "C_mutate(((C_word *)")
 	     (expr (car subs) i)
 	     (gen ")+" (+ (first params) 1) ",")
 	     (expr (cadr subs) i) 
@@ -170,7 +170,7 @@
 	     (gen #\)) )
 
 	    ((##core#updatebox)
-	     (gen "C_mutate2(((C_word *)")
+	     (gen "C_mutate(((C_word *)")
 	     (expr (car subs) i)
 	     (gen ")+1,")
 	     (expr (cadr subs) i) 
@@ -216,8 +216,8 @@
 		   (block (second params)) 
 		   (var (third params)))
 	       (if block
-		   (gen "C_mutate2(&lf[" index "]")
-		   (gen "C_mutate2((C_word*)lf[" index "]+1") )
+		   (gen "C_mutate(&lf[" index "]")
+		   (gen "C_mutate((C_word*)lf[" index "]+1") )
 	       (gen " /* (set! " (uncommentify (##sys#symbol->qualified-string var)) " ...) */,")
 	       (expr (car subs) i)
 	       (gen #\)) ) )
diff --git a/chicken.h b/chicken.h
index b08f0de2..9e2af974 100644
--- a/chicken.h
+++ b/chicken.h
@@ -800,10 +800,10 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
 #define C_cpsproc(name)   C_ccall void name(C_word c, C_word *av) C_noret
 
 #define CHICKEN_gc_root_ref(root)      (((C_GC_ROOT *)(root))->value)
-#define CHICKEN_gc_root_set(root, x)   C_mutate2(&((C_GC_ROOT *)(root))->value, (x))
+#define CHICKEN_gc_root_set(root, x)   C_mutate(&((C_GC_ROOT *)(root))->value, (x))
 
 #define CHICKEN_global_ref(root)       C_u_i_car(((C_GC_ROOT *)(root))->value)
-#define CHICKEN_global_set(root, x)    C_mutate2(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x))
+#define CHICKEN_global_set(root, x)    C_mutate(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x))
 
 #define CHICKEN_default_toplevel       ((void *)C_default_5fstub_toplevel)
 
@@ -1352,10 +1352,10 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
 #define C_a_unsigned_int_to_num(ptr, n, i)  C_unsigned_int_to_num(ptr, i)
 #define C_a_i_vector                    C_vector
 #define C_list                          C_a_i_list
-#define C_i_setslot(x, i, y)            (C_mutate2(&C_block_item(x, C_unfix(i)), y), C_SCHEME_UNDEFINED)
+#define C_i_setslot(x, i, y)            (C_mutate(&C_block_item(x, C_unfix(i)), y), C_SCHEME_UNDEFINED)
 #define C_i_set_i_slot(x, i, y)         (C_set_block_item(x, C_unfix(i), y), C_SCHEME_UNDEFINED)
-#define C_u_i_set_car(p, x)             (C_mutate2(&C_u_i_car(p), x), C_SCHEME_UNDEFINED)
-#define C_u_i_set_cdr(p, x)             (C_mutate2(&C_u_i_cdr(p), x), C_SCHEME_UNDEFINED)
+#define C_u_i_set_car(p, x)             (C_mutate(&C_u_i_car(p), x), C_SCHEME_UNDEFINED)
+#define C_u_i_set_cdr(p, x)             (C_mutate(&C_u_i_cdr(p), x), C_SCHEME_UNDEFINED)
 #define C_a_i_putprop(p, c, x, y, z)    C_putprop(p, x, y, z)
 
 #define C_i_not(x)                      (C_truep(x) ? C_SCHEME_FALSE : C_SCHEME_TRUE)
diff --git a/runtime.c b/runtime.c
index 260e660d..e1970cd6 100644
--- a/runtime.c
+++ b/runtime.c
@@ -2052,7 +2052,7 @@ C_word C_fcall C_restore_callback_continuation(void)
   assert(!C_immediatep(p) && C_block_header(p) == C_PAIR_TAG);
   k = C_u_i_car(p);
 
-  C_mutate2(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p));
+  C_mutate(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p));
   --callback_continuation_level;
   return k;
 }
@@ -2068,7 +2068,7 @@ C_word C_fcall C_restore_callback_continuation2(int level)
 
   k = C_u_i_car(p);
 
-  C_mutate2(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p));
+  C_mutate(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p));
   --callback_continuation_level;
   return k;
 }
@@ -2340,7 +2340,7 @@ C_regparm C_word C_fcall C_intern3(C_word **ptr, C_char *str, C_word value)
 {
   C_word s = C_intern_in(ptr, C_strlen(str), str, symbol_table);
   
-  C_mutate2(&C_block_item(s,0), value);
+  C_mutate(&C_block_item(s,0), value);
   C_i_persist_symbol(s); /* Symbol has a value now; persist it */
   return s;
 }
@@ -2491,7 +2491,7 @@ C_word add_symbol(C_word **ptr, C_word key, C_word string, C_SYMBOL_TABLE *stabl
        heap-top (say, in a toplevel literal frame allocation) then we have
        to inform the memory manager that a 2nd gen. block points to a 
        1st gen. block, hence the mutation: */
-    C_mutate2(&C_block_item(bucket,1), b2);
+    C_mutate(&C_block_item(bucket,1), b2);
     stable->table[ key ] = bucket;
   }
 
@@ -4566,12 +4566,12 @@ C_word C_fetch_trace(C_word starti, C_word buffer)
       if(ptr >= trace_buffer_limit) ptr = trace_buffer;
 
       /* outside-pointer, will be ignored by GC */
-      C_mutate2(&C_block_item(buffer, p++), (C_word)ptr->raw);
+      C_mutate(&C_block_item(buffer, p++), (C_word)ptr->raw);
 
       /* subject to GC */
-      C_mutate2(&C_block_item(buffer, p++), ptr->cooked1);
-      C_mutate2(&C_block_item(buffer, p++), ptr->cooked2);
-      C_mutate2(&C_block_item(buffer, p++), ptr->thread);
+      C_mutate(&C_block_item(buffer, p++), ptr->cooked1);
+      C_mutate(&C_block_item(buffer, p++), ptr->cooked2);
+      C_mutate(&C_block_item(buffer, p++), ptr->thread);
     }
   }
 
@@ -5782,7 +5782,7 @@ C_regparm C_word C_fcall C_i_set_car(C_word x, C_word val)
   if(C_immediatep(x) || C_block_header(x) != C_PAIR_TAG)
     barf(C_BAD_ARGUMENT_TYPE_ERROR, "set-car!", x);
 
-  C_mutate2(&C_u_i_car(x), val);
+  C_mutate(&C_u_i_car(x), val);
   return C_SCHEME_UNDEFINED;
 }
 
@@ -5792,7 +5792,7 @@ C_regparm C_word C_fcall C_i_set_cdr(C_word x, C_word val)
   if(C_immediatep(x) || C_block_header(x) != C_PAIR_TAG)
     barf(C_BAD_ARGUMENT_TYPE_ERROR, "set-cdr!", x);
 
-  C_mutate2(&C_u_i_cdr(x), val);
+  C_mutate(&C_u_i_cdr(x), val);
   return C_SCHEME_UNDEFINED;
 }
 
@@ -5809,7 +5809,7 @@ C_regparm C_word C_fcall C_i_vector_set(C_word v, C_word i, C_word x)
 
     if(j < 0 || j >= C_header_size(v)) barf(C_OUT_OF_RANGE_ERROR, "vector-set!", v, i);
 
-    C_mutate2(&C_block_item(v, j), x);
+    C_mutate(&C_block_item(v, j), x);
   }
   else barf(C_BAD_ARGUMENT_TYPE_ERROR, "vector-set!", i);
 
@@ -11434,7 +11434,7 @@ C_regparm C_word C_fcall C_i_locative_set(C_word loc, C_word x)
     barf(C_LOST_LOCATIVE_ERROR, "locative-set!", loc);
 
   switch(C_unfix(C_block_item(loc, 2))) {
-  case C_SLOT_LOCATIVE: C_mutate2(ptr, x); break;
+  case C_SLOT_LOCATIVE: C_mutate(ptr, x); break;
 
   case C_CHAR_LOCATIVE:
     if((x & C_IMMEDIATE_TYPE_BITS) != C_CHARACTER_BITS)
@@ -12138,7 +12138,7 @@ C_putprop(C_word **ptr, C_word sym, C_word prop, C_word val)
 
   while(pl != C_SCHEME_END_OF_LIST) {
     if(C_block_item(pl, 0) == prop) {
-      C_mutate2(&C_u_i_car(C_u_i_cdr(pl)), val);
+      C_mutate(&C_u_i_car(C_u_i_cdr(pl)), val);
       return val;
     }
     else pl = C_u_i_cdr(C_u_i_cdr(pl));
-- 
2.11.0

From fe4d50fb43b80f60dde4c6b105c7d3a6dbbf379d Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Thu, 12 Oct 2017 16:44:48 +0200
Subject: [PATCH 3/3] Remove deprecated -n option from csc

This has been deprecated a long time ago in 4.9.0, let's remove it.
---
 NEWS    | 1 +
 csc.scm | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 52887945..c1c85d61 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@
 
 - Tools
   - The new "-link" option to csc allows linking with objects from extensions.
+  - Removed deprecated "-n" shorthand for "-emit-inline-file" from csc.
 
 - Core libraries
   - Removed support for memory-mapped files (posix), queues
diff --git a/csc.scm b/csc.scm
index 15882f27..89d8c9c8 100644
--- a/csc.scm
+++ b/csc.scm
@@ -176,7 +176,6 @@
     (-x "-explicit-use")
     (-u "-unsafe")
     (-j "-emit-import-library")
-    (-n "-emit-inline-file")		; DEPRECATED
     (-b "-block")
     (-types "-consult-type-file")))
 
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to