Re: uname -o does not exist on mac

2021-07-28 Thread Mario Domenech Goulart
On Sun, 18 Jul 2021 12:01:54 +0300 Lassi Kortela  wrote:

> Here's a small patch to silence a warning in `make` output on systems
> where the `uname` command does not have the `-o` flag.
>
> diff --git a/Makefile.detect b/Makefile.detect
> index 10d36545..9694b125 100644
> --- a/Makefile.detect
> +++ b/Makefile.detect
> @@ -19,7 +19,7 @@ else
>
>  # Now we can use uname tests
>  uname_s:=$(shell uname)
> -uname_o:=$(shell uname -o)
> +uname_o:=$(shell uname -o 2>/dev/null)
>
>  # Check for specific platforms
>  ifeq ($(uname_o),Msys)

Thanks, Lassi.  Attached is a git-formatted signed-off patch.

All the best.
Mario
-- 
http://parenteses.org/mario
>From d9ab2a823c1176f036818b76f0d38b7fffae4e6b Mon Sep 17 00:00:00 2001
From: Mario Domenech Goulart 
Date: Wed, 28 Jul 2021 21:51:54 +0200
Subject: [PATCH] Makefile.detect: uname -o does not exist on mac

Silence a warning in `make` output on systems where the `uname`
command does not have the `-o` flag.

This patch was submitted by Lassi Kortela:
https://lists.nongnu.org/archive/html/chicken-hackers/2021-07/msg00011.html

Signed-off-by: Mario Domenech Goulart 
---
 Makefile.detect | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.detect b/Makefile.detect
index 10d36545..9694b125 100644
--- a/Makefile.detect
+++ b/Makefile.detect
@@ -19,7 +19,7 @@ else
 
 # Now we can use uname tests
 uname_s:=$(shell uname)
-uname_o:=$(shell uname -o)
+uname_o:=$(shell uname -o 2>/dev/null)
 
 # Check for specific platforms
 ifeq ($(uname_o),Msys)
-- 
2.20.1



Misc scrutizer annotation fixes for FFI

2021-07-28 Thread megane
Hi,

Here are some fixes that will result in more specific scrutinizer
annotations, and removes some spurious type warnings (0003).

>From 42657f466937e2dcaf19b385eed31ed27fda0dbd Mon Sep 17 00:00:00 2001
From: megane 
Date: Sat, 22 May 2021 07:47:53 +0300
Subject: [PATCH 1/4] FFI: Make scrutinizer not allow #t where nullable value
 is expected

E.g. annotate (foreign-lambda* void ((blob x)) "return;") with

  ((or false blob) -> undefined)

instead of current

  ((or boolean blob) -> undefined)
---
 support.scm | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/support.scm b/support.scm
index b56b7d00..19702271 100644
--- a/support.scm
+++ b/support.scm
@@ -1363,17 +1363,17 @@
  ((scheme-pointer nonnull-scheme-pointer) '*)
  ((blob)
   (case mode
-((arg) '(or boolean blob))
+((arg) '(or false blob))
 (else 'blob)))
  ((nonnull-blob) 'blob)
  ((pointer-vector)
   (case mode
-((arg) '(or boolean pointer-vector))
+((arg) '(or false pointer-vector))
 (else 'pointer-vector)))
  ((nonnull-pointer-vector) 'pointer-vector)
  ((u8vector u16vector s8vector s16vector u32vector s32vector u64vector 
s64vector f32vector f64vector)
   (case mode
-((arg) `(or boolean (struct ,ft)))
+((arg) `(or false (struct ,ft)))
 (else `(struct ,ft
  ((nonnull-u8vector) '(struct u8vector))
  ((nonnull-s8vector) '(struct s8vector))
@@ -1389,10 +1389,10 @@
unsigned-long)
   'integer)
  ((c-pointer)
-  '(or boolean pointer locative))
+  '(or false pointer locative))
  ((nonnull-c-pointer) 'pointer)
  ((c-string c-string* unsigned-c-string unsigned-c-string*)
-  '(or boolean string))
+  '(or false string))
  ((c-string-list c-string-list*)
   '(list-of string))
  ((nonnull-c-string nonnull-c-string* nonnull-unsigned-c-string*) 
'string)
@@ -1401,7 +1401,7 @@
   (cond ((pair? t)
  (case (car t)
((ref pointer function c-pointer)
-'(or boolean pointer locative))
+'(or false pointer locative))
((const) (foreign-type->scrutiny-type (cadr t) mode))
((enum) 'integer)
((nonnull-pointer nonnull-c-pointer) 'pointer)
-- 
2.25.1

>From c8e604fc386be2ff163eb1e264748d39983df344 Mon Sep 17 00:00:00 2001
From: megane 
Date: Sat, 22 May 2021 07:53:54 +0300
Subject: [PATCH 2/4] FFI: Remove annotation of locative as return type for
 c-pointer

The c-pointers are converted to pointers or #f, not locatives.

See foreign-result-conversion
---
 support.scm | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/support.scm b/support.scm
index 19702271..c7408903 100644
--- a/support.scm
+++ b/support.scm
@@ -1389,7 +1389,9 @@
unsigned-long)
   'integer)
  ((c-pointer)
-  '(or false pointer locative))
+  (if (eq? 'arg mode)
+  '(or false pointer locative)
+  '(or false pointer)))
  ((nonnull-c-pointer) 'pointer)
  ((c-string c-string* unsigned-c-string unsigned-c-string*)
   '(or false string))
@@ -1401,7 +1403,9 @@
   (cond ((pair? t)
  (case (car t)
((ref pointer function c-pointer)
-'(or false pointer locative))
+(if (eq? 'arg mode)
+'(or false pointer locative)
+'(or false pointer)))
((const) (foreign-type->scrutiny-type (cadr t) mode))
((enum) 'integer)
((nonnull-pointer nonnull-c-pointer) 'pointer)
-- 
2.25.1

>From 1886d131b20e377b13d032bd3108d590b80d0e51 Mon Sep 17 00:00:00 2001
From: megane 
Date: Sat, 22 May 2021 08:13:45 +0300
Subject: [PATCH 3/4] FFI: Make scrutinizer accept locatives for
 nonnull-c-pointer arguments

E.g. annotate (foreign-lambda* void ((nonnull-c-pointer x)) "return;")
with

  ((or pointer locative) -> undefined)

instead of current

  (pointer -> undefined)
---
 support.scm | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/support.scm b/support.scm
index c7408903..7929334c 100644
--- a/support.scm
+++ b/support.scm
@@ -1392,7 +1392,10 @@
   (if (eq? 'arg mode)
   '(or false pointer locative)
   '(or false pointer)))
- ((nonnull-c-pointer) 'pointer)
+ ((nonnull-c-pointer)
+  (if (eq? 'arg mode)
+  '(or pointer locative)
+  'pointer))
  ((c-string c-string* unsigned-c-string unsigned-c-string*)
   '(or false string))
  ((c-string-list c-string-list*)
@@ -1408,7 +1411,10 @@
 '(or false pointer)))