summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-12-05 15:43:18 +0100
committerAndy Wingo <wingo@pobox.com>2011-12-05 18:11:24 +0100
commit2c27dd57c7ec4a8168e2668aed380594a99dda8f (patch)
treea0b865a254c2f5933af273ee34a7dbe02ff647d4 /module
parent3972de7675bf771b403eaef97f0741280649b5ed (diff)
warnings written to warning port
* libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/load.c (auto_compile_catch_handler): (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): * module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers) (load-in-vicinity): * module/system/base/message.scm (warning): Write to the warning port. (*current-warning-port*): Alias the warning port.
Diffstat (limited to 'module')
-rw-r--r--module/ice-9/boot-9.scm18
-rw-r--r--module/system/base/message.scm12
2 files changed, 16 insertions, 14 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 1d25f63df..2659d6cb3 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -217,7 +217,7 @@ If there is no handler at all, Guile prints an error and then exits."
(define current-warning-port current-error-port)
(define (warn . stuff)
- (with-output-to-port (current-error-port)
+ (with-output-to-port (current-warning-port)
(lambda ()
(newline)
(display ";;; WARNING ")
@@ -1382,7 +1382,7 @@ VALUE."
(define (%load-announce file)
(if %load-verbosely
- (with-output-to-port (current-error-port)
+ (with-output-to-port (current-warning-port)
(lambda ()
(display ";;; ")
(display "loading ")
@@ -3393,7 +3393,7 @@ module '(ice-9 q) '(make-q q-length))}."
#f))
(define (warn module name int1 val1 int2 val2 var val)
- (format (current-error-port)
+ (format (current-warning-port)
"WARNING: ~A: `~A' imported from both ~A and ~A\n"
(module-name module)
name
@@ -3415,7 +3415,7 @@ module '(ice-9 q) '(make-q q-length))}."
(define (warn-override-core module name int1 val1 int2 val2 var val)
(and (eq? int1 the-scm-module)
(begin
- (format (current-error-port)
+ (format (current-warning-port)
"WARNING: ~A: imported module ~A overrides core binding `~A'\n"
(module-name module)
(module-name int2)
@@ -3537,13 +3537,13 @@ module '(ice-9 q) '(make-q q-length))}."
go-path
(begin
(if gostat
- (format (current-error-port)
+ (format (current-warning-port)
";;; note: source file ~a\n;;; newer than compiled ~a\n"
name go-path))
(cond
(%load-should-auto-compile
(%warn-auto-compilation-enabled)
- (format (current-error-port) ";;; compiling ~a\n" name)
+ (format (current-warning-port) ";;; compiling ~a\n" name)
(let ((cfn
((module-ref
(resolve-interface '(system base compile))
@@ -3551,15 +3551,15 @@ module '(ice-9 q) '(make-q q-length))}."
name
#:opts %auto-compilation-options
#:env (current-module))))
- (format (current-error-port) ";;; compiled ~a\n" cfn)
+ (format (current-warning-port) ";;; compiled ~a\n" cfn)
cfn))
(else #f))))))
(lambda (k . args)
- (format (current-error-port)
+ (format (current-warning-port)
";;; WARNING: compilation of ~a failed:\n" name)
(for-each (lambda (s)
(if (not (string-null? s))
- (format (current-error-port) ";;; ~a\n" s)))
+ (format (current-warning-port) ";;; ~a\n" s)))
(string-split
(call-with-output-string
(lambda (port) (print-exception port #f k args)))
diff --git a/module/system/base/message.scm b/module/system/base/message.scm
index aed35021c..75e14ea1e 100644
--- a/module/system/base/message.scm
+++ b/module/system/base/message.scm
@@ -54,11 +54,13 @@
;;; Warnings
;;;
+;; This name existed before %current-warning-port was introduced, but
+;; otherwise it is a deprecated binding.
(define *current-warning-port*
- ;; The port where warnings are sent.
- (make-fluid (current-error-port)))
-
-(fluid-set! *current-warning-port* (current-error-port))
+ ;; Can't play the identifier-syntax deprecation game in Guile 2.0, as
+ ;; other modules might depend on this being a normal binding and not a
+ ;; syntax binding.
+ (parameter-fluid current-warning-port))
(define *current-warning-prefix*
;; Prefix string when emitting a warning.
@@ -194,7 +196,7 @@
"Emit a warning of type TYPE for source location LOCATION (a source
property alist) using the data in ARGS."
(let ((wt (lookup-warning-type type))
- (port (fluid-ref *current-warning-port*)))
+ (port (current-warning-port)))
(if (warning-type? wt)
(apply (warning-type-printer wt)
port (location-string location)