[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiler messages

From: Tobin Harding
Subject: Re: compiler messages
Date: Thu, 7 Jul 2016 22:52:14 +1000
User-agent: Mutt/1.6.1 (2016-04-27)

On Thu, Jul 07, 2016 at 12:25:03PM +0200, Andy Wingo wrote:
> On Thu 30 Jun 2016 12:57, Tobin Harding <address@hidden> writes:
> > Request for advice as to whether to submit patch?
> Sure, please do.  I guess --quiet is the name that is most often asked
> for.

I've left the option name as I originally wrote it, not to ignore you Andy but
simply to get any other feed back on the patch then I will re-submit it.

The option --with-compiler-messages is redundant (since its the default
behaviour). I added it to be inline with --auto-compile/--no-auto-compile.

I have two issues with this patch after developing with a patched Guile for a
week or so. First is that I have not been able to pass command line options to
Guile while using Geiser, my workaround has been setting the variable
%quiet-compiler directly with (set! %quiet-compiler #t) from within ~/.guile.

The second, and bigger problem, is that messages are suppressed only for the 
that is directly named in the load statement i.e (load "file.scm"). If file.scm 
has any
load statements then when these files are loaded/compiled messages are still


commit f680d7ca5bfc5c1c88f0789f418fbdc1c84e2ae6
Author: Tobin Harding <address@hidden>
Date:   Thu Jul 7 22:38:16 2016 +1000

    Add command line option to quiet compiler messages

diff --git a/libguile/load.c b/libguile/load.c
index 7ad9a75..901ffe4 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -226,6 +226,9 @@ static SCM *scm_loc_fresh_auto_compile;
 /* The fallback path for auto-compilation */
 static SCM *scm_loc_compile_fallback_path;
+/* Whether we output compiler informational messages */
+static SCM *scm_loc_quiet_compiler;
 /* Ellipsis: "..." */
 static SCM scm_ellipsis;
@@ -1349,7 +1352,9 @@ scm_init_load ()
     = SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", 
     = SCM_VARIABLE_LOC (scm_c_define ("%fresh-auto-compile", SCM_BOOL_F));
+  scm_loc_quiet_compiler
+    = SCM_VARIABLE_LOC (scm_c_define ("%quiet-compiler", SCM_BOOL_F));
   scm_ellipsis = scm_from_latin1_string ("...");
   the_reader = scm_make_fluid_with_default (SCM_BOOL_F);
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 6eae844..034bc72 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -3755,17 +3755,20 @@ when none is available, reading FILE-NAME with READER."
            (load-thunk-from-file go-file-name)
              (when gostat
-               (format (current-warning-port)
-                       ";;; note: source file ~a\n;;;       newer than 
compiled ~a\n"
-                       name go-file-name))
+               (or %quiet-compiler
+                   (format (current-warning-port)
+                           ";;; note: source file ~a\n;;;       newer than 
compiled ~a\n"
+                           name go-file-name)))
-               (format (current-warning-port) ";;; compiling ~a\n" name)
+               (or %quiet-compiler
+                   (format (current-warning-port) ";;; compiling ~a\n" name))
                (let ((cfn (compile name)))
-                 (format (current-warning-port) ";;; compiled ~a\n" cfn)
+                 (or %quiet-compiler
+                     (format (current-warning-port) ";;; compiled ~a\n" cfn))
                  (load-thunk-from-file cfn)))
-              (else #f)))))
+               (else #f)))))
      #:warning "WARNING: compilation of ~a failed:\n" name))
   (define (sans-extension file)
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index 98d3855..77ecf71 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -133,6 +133,9 @@ If FILE begins with `-' the -s switch is mandatory.
   --no-auto-compile  disable automatic source file compilation;
                  default is to enable auto-compilation of source
+  --with-compiler-messages  show informational messages when compiling.
+  --without-compiler-messages do not show informational messages when
+                 compiling.
   --listen[=P]   listen on a local port or a path for REPL clients;
                  if P is not given, the default is local port 37146
   -q             inhibit loading of user init file
@@ -358,6 +361,14 @@ If FILE begins with `-' the -s switch is mandatory.
             (set! inhibit-user-init? #t)
             (parse args out))
+           ((string=? arg "--with-compiler-messages")
+            (set! %quiet-compiler #f)
+            (parse args out))
+           ((string=? arg "--without-compiler-messages")
+            (set! %quiet-compiler #t)
+            (parse args out))
            ((string-prefix? "--use-srfi=" arg)
             (let ((srfis (map (lambda (x)
                                 (let ((n (string->number x)))
@@ -407,7 +418,7 @@ If FILE begins with `-' the -s switch is mandatory.
             (exit 0))
-            (error "unrecognized switch ~a" arg)))))))
+            (error "EDIT: unrecognized switch ~a" arg)))))))
     (define (finish args out)
       ;; Check to make sure the -ds got a -s.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]