~ chicken-core (chicken-5) 88a2b5181dab1f267e001453739fdacc8bd3ad70
commit 88a2b5181dab1f267e001453739fdacc8bd3ad70
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Fri Apr 3 20:34:39 2020 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Sat Apr 4 22:11:57 2020 +0200
Always register a feature corresponding to the word size
Before this change, only 64bit was registered for 64bit platforms.
Now we have a feature <word-size>bit for all platforms, regardless of
the word size.
Fixes #1693.
Signed-off-by: felix <felix@call-with-current-continuation.org>
diff --git a/NEWS b/NEWS
index d86ffe23..5f2f380e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@
- Sleeping primordial thread doesn't forget mutations made to
parameters in interrupt handlers anymore. (See #1638. Fix
contributed by Sebastien Marie)
+- A feature corresponding to the word size is available
+ regardless of the word size (#1693)
5.1.1
diff --git a/csi.scm b/csi.scm
index f8c4b32a..5560024f 100644
--- a/csi.scm
+++ b/csi.scm
@@ -483,7 +483,7 @@ EOF
(display (make-string pad #\space))))))
fs))
(printf "~%~%~
- Machine type: \t~A ~A~%~
+ Machine type: \t~A (~A-bit)~%~
Software type: \t~A~%~
Software version:\t~A~%~
Build platform: \t~A~%~
@@ -499,7 +499,7 @@ EOF
nursery size is ~S bytes, stack grows ~A~%~
Command line: \t~S~%"
(machine-type)
- (if (feature? #:64bit) "(64-bit)" "")
+ (foreign-value "C_WORD_SIZE" int)
(software-type)
(software-version)
(build-platform)
diff --git a/library.scm b/library.scm
index 67c555f3..199057f7 100644
--- a/library.scm
+++ b/library.scm
@@ -6435,7 +6435,7 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
(string-append (str sv) (str st) (str bp) (##sys#symbol->string mt))))
(if full
(let ((spec (string-append
- (if (feature? #:64bit) " 64bit" "")
+ " " (number->string (foreign-value "C_WORD_SIZE" int)) "bit"
(if (feature? #:dload) " dload" "")
(if (feature? #:ptables) " ptables" "")
(if (feature? #:gchooks) " gchooks" "")
@@ -6549,8 +6549,14 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
(set! ##sys#features (cons #:gchooks ##sys#features)))
(when (foreign-value "IS_CROSS_CHICKEN" bool)
(set! ##sys#features (cons #:cross-chicken ##sys#features)))
-(when (fx= (foreign-value "C_WORD_SIZE" int) 64)
- (set! ##sys#features (cons #:64bit ##sys#features)))
+
+;; Register a feature to represent the word size (e.g., 32bit, 64bit)
+(set! ##sys#features
+ (cons (string->keyword
+ (string-append
+ (number->string (foreign-value "C_WORD_SIZE" int))
+ "bit"))
+ ##sys#features))
(set! ##sys#features
(let ((major (##sys#number->string (foreign-value "C_MAJOR_VERSION" int)))
Trap