Hi all,

Here's a little patch to fix #1159.  It is somewhat nasty but it works
and I don't really see how else to do this (unless we move the help text
into csc itself as well).

Cheers,
Peter
From 6d81dfc94199e296b7fd4b7c43c4ca023140a48c Mon Sep 17 00:00:00 2001
From: Peter Bex <pe...@more-magic.net>
Date: Fri, 5 Apr 2019 15:56:14 +0200
Subject: [PATCH] Allow "csc -debug h" without source file arguments

Fixes #1159

Also, simplify how complex-options are handled, because the
string->number converted argument was never really used.
---
 csc.scm | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/csc.scm b/csc.scm
index f12c9319..c4edf952 100644
--- a/csc.scm
+++ b/csc.scm
@@ -212,6 +212,7 @@
 (define deployed #f)
 (define rpath #f)
 (define ignore-repository #f)
+(define show-debugging-help #f)
 
 (define library-dir
   (if host-mode host-libdir default-libdir))
@@ -566,6 +567,11 @@ EOF
 	   (cond ((null? scheme-files)
 		  (when (and (null? c-files)
 			     (null? object-files))
+		    (when show-debugging-help
+		      (command
+		       (string-intersperse
+			(cons* translator "bogus.scm" translate-options)
+			" ") ))
 		    (stop "no source files specified") )
 		  (unless target-filename
 		    (set! target-filename
@@ -712,6 +718,13 @@ EOF
 	       [(|-d1|) (set! rest (cons* "-debug-level" "1" rest))]
 	       [(|-d2|) (set! rest (cons* "-debug-level" "2" rest))]
 	       [(|-d3|) (set! rest (cons* "-debug-level" "3" rest))]
+	       ((-debug)
+		(check s rest)
+		(t-options arg (car rest))
+		(when (memv #\h (string->list (car rest)))
+		  (set! show-debugging-help #t)
+		  (set! translate-only #t))
+		(set! rest (cdr rest)))
 	       [(-dry-run) 
 		(set! verbose #t)
 		(set! dry-run #t)]
@@ -777,12 +790,10 @@ EOF
 		  (set! linking-optimization-options best-linking-optimization-options) )
 		(cond [(assq s shortcuts) => (lambda (a) (set! rest (cons (cadr a) rest)))]
 		      [(memq s simple-options) (t-options arg)]
-		      [(memq s complex-options) 
+		      ((memq s complex-options) 
 		       (check s rest)
-		       (let* ((n (car rest))
-			      (ns (string->number n)) )
-			 (t-options arg n)
-			 (set! rest (cdr rest)) ) ]
+		       (t-options arg (car rest))
+		       (set! rest (cdr rest))  )
 		      [(and (> (string-length arg) 2) (string=? "-:" (substring arg 0 2)))
 		       (t-options arg) ]
 		      [(and (> (string-length arg) 1)
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to