unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* compiler messages
@ 2016-06-30 10:57 Tobin Harding
  2016-07-07 10:25 ` Andy Wingo
  0 siblings, 1 reply; 6+ messages in thread
From: Tobin Harding @ 2016-06-30 10:57 UTC (permalink / raw)
  To: guile-devel

Request for advice as to whether to submit patch?

I have hacked together a patch to quieten down the compiler when loading a file
at the REPL (when using --auto-compile).

I found one thread discussing this, but with no apparent solution or decision.

https://lists.gnu.org/archive/html/guile-user/2011-03/msg00079.html

Patch adds command line option --without-compiler-messages. This option inhibits
the messages

;;; note: source file /home/tobin/build/scheme/test.scm
;;;       newer than compiled /home/tobin/.cache/guile/ccache/2.2-LE-8-3.8/home/tobin/build/scheme/test.scm.go
;;; compiling /home/tobin/build/scheme/test.scm
;;; compiled
;;;       /home/tobin/.cache/guile/ccache/2.2-LE-8-3.8/home/tobin/build/scheme/test.scm.go

from being output when a file is loaded (and auto-compiled).

thanks,
Tobin.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiler messages
  2016-06-30 10:57 compiler messages Tobin Harding
@ 2016-07-07 10:25 ` Andy Wingo
  2016-07-07 12:52   ` Tobin Harding
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Wingo @ 2016-07-07 10:25 UTC (permalink / raw)
  To: Tobin Harding; +Cc: guile-devel

On Thu 30 Jun 2016 12:57, Tobin Harding <me@tobin.cc> 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.

Andy



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiler messages
  2016-07-07 10:25 ` Andy Wingo
@ 2016-07-07 12:52   ` Tobin Harding
  2016-07-11 16:29     ` Andy Wingo
  0 siblings, 1 reply; 6+ messages in thread
From: Tobin Harding @ 2016-07-07 12:52 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

On Thu, Jul 07, 2016 at 12:25:03PM +0200, Andy Wingo wrote:
> On Thu 30 Jun 2016 12:57, Tobin Harding <me@tobin.cc> 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 file
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
output.

thanks,
Tobin.


commit f680d7ca5bfc5c1c88f0789f418fbdc1c84e2ae6
Author: Tobin Harding <me@tobin.cc>
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_BOOL_F));
   scm_loc_fresh_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)
            (begin
              (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)))
              (cond
               (%load-should-auto-compile
                (%warn-auto-compilation-enabled)
-               (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
                  files.
+  --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))
 
            (else
-            (error "unrecognized switch ~a" arg)))))))
+            (error "EDIT: unrecognized switch ~a" arg)))))))
 
     (define (finish args out)
       ;; Check to make sure the -ds got a -s.



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: compiler messages
  2016-07-07 12:52   ` Tobin Harding
@ 2016-07-11 16:29     ` Andy Wingo
  2016-07-12  0:08       ` Tobin Harding
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Wingo @ 2016-07-11 16:29 UTC (permalink / raw)
  To: Tobin Harding; +Cc: guile-devel

On Thu 07 Jul 2016 14:52, Tobin Harding <me@tobin.cc> writes:

> 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.

I think you can do this.  Customize geiser-guile-binary to be a "guile
--quiet" or whatever.

> The second, and bigger problem, is that messages are suppressed only for the file
> 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
> output.

This is a blocker unfortunately.  You need to change the C code as well
(load.c).

Andy



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiler messages
  2016-07-11 16:29     ` Andy Wingo
@ 2016-07-12  0:08       ` Tobin Harding
  2016-07-12  6:58         ` Andy Wingo
  0 siblings, 1 reply; 6+ messages in thread
From: Tobin Harding @ 2016-07-12  0:08 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

On Mon, Jul 11, 2016 at 06:29:43PM +0200, Andy Wingo wrote:
> On Thu 07 Jul 2016 14:52, Tobin Harding <me@tobin.cc> writes:
> 
> > 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.
> 
> I think you can do this.  Customize geiser-guile-binary to be a "guile
> --quiet" or whatever.

I tried that already to no avail, thanks for the idea though.

> 
> > The second, and bigger problem, is that messages are suppressed only for the file
> > 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
> > output.
> 
> This is a blocker unfortunately.  You need to change the C code as well
> (load.c).

I should be able to manage that, thanks for the pointer to the file.

thanks,
Tobin.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiler messages
  2016-07-12  0:08       ` Tobin Harding
@ 2016-07-12  6:58         ` Andy Wingo
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Wingo @ 2016-07-12  6:58 UTC (permalink / raw)
  To: Tobin Harding; +Cc: guile-devel

On Tue 12 Jul 2016 02:08, Tobin Harding <me@tobin.cc> writes:

> On Mon, Jul 11, 2016 at 06:29:43PM +0200, Andy Wingo wrote:
>> On Thu 07 Jul 2016 14:52, Tobin Harding <me@tobin.cc> writes:
>> 
>> > 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.
>> 
>> I think you can do this.  Customize geiser-guile-binary to be a "guile
>> --quiet" or whatever.
>
> I tried that already to no avail, thanks for the idea though.

Did you try making it a list?  Sorry, that's what I meant to type.
'("guile" "--foo").

Andy



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-12  6:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 10:57 compiler messages Tobin Harding
2016-07-07 10:25 ` Andy Wingo
2016-07-07 12:52   ` Tobin Harding
2016-07-11 16:29     ` Andy Wingo
2016-07-12  0:08       ` Tobin Harding
2016-07-12  6:58         ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).