>From b0f476c44ed3137e55e8267344f0f3ec41054fd9 Mon Sep 17 00:00:00 2001
From: Mario Domenech Goulart
Date: Fri, 3 Apr 2020 20:34:39 +0200
Subject: [PATCH] Always register a feature corresponding to the word size
Before this change, only 64bit was registered for 64bit platforms.
Now we have a feature bit for all platforms, regardless of
the word size.
Fixes #1693.
---
NEWS | 2 ++
csi.scm | 4 ++--
library.scm | 12 +++++++++---
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 5fd808e0..dc5abb47 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,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)
- Build system
- Auto-configure at build time on most platforms. Cross-compilation
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)))
--
2.11.0