From dec670ff757e056ad57b3b5afa4b11124f1f09f4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 11 Sep 2007 20:56:08 +0000 Subject: [PATCH] fix problem where --save-temps didn't work for 3m-generated file (due to lingering handler installed by 3m) svn: r7320 --- collects/compiler/private/driver.ss | 50 ++++++++++++++++------------- collects/compiler/private/xform.ss | 4 ++- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/collects/compiler/private/driver.ss b/collects/compiler/private/driver.ss index 2f077b546b..d0da5b2a83 100644 --- a/collects/compiler/private/driver.ss +++ b/collects/compiler/private/driver.ss @@ -1370,29 +1370,33 @@ (when (compiler:option:verbose) (printf " [compiling native code to \"~a\"]~n" obj-output-path)) - ;; Compile - (let ([compile-thunk - (lambda () - (with-handlers - ([void (lambda (exn) - (compiler:fatal-error - #f - (string-append - " C compiler did not complete successfully" - (string #\newline) - (exn-message exn))) - (compiler:report-messages! #t))]) - (compile-extension (not (compiler:option:verbose)) - (or c3m-output-path c-output-path) obj-output-path - (list (collection-path "compiler")))))]) - (verbose-time compile-thunk)) - - ;; clean-up - (when (and (compiler:option:clean-intermediate-files) - input-path) - (if c3m-output-path - (delete-file c3m-output-path) - (delete-file c-output-path))) + (let ([clean-up + (lambda () + (when (and (compiler:option:clean-intermediate-files) + input-path) + (if c3m-output-path + (delete-file c3m-output-path) + (delete-file c-output-path))))]) + + ;; Compile + (let ([compile-thunk + (lambda () + (with-handlers + ([void (lambda (exn) + (clean-up) + (compiler:fatal-error + #f + (string-append + " C compiler did not complete successfully" + (string #\newline) + (exn-message exn))) + (compiler:report-messages! #t))]) + (compile-extension (not (compiler:option:verbose)) + (or c3m-output-path c-output-path) obj-output-path + (list (collection-path "compiler")))))]) + (verbose-time compile-thunk)) + + (clean-up)) (if multi-o? (printf " [output to \"~a\"]~n" obj-output-path) diff --git a/collects/compiler/private/xform.ss b/collects/compiler/private/xform.ss index 1b420e5122..a9eff23a6e 100644 --- a/collects/compiler/private/xform.ss +++ b/collects/compiler/private/xform.ss @@ -13,7 +13,9 @@ precompiling-header? precompiled-header show-info? output-depends-info? gc-variable-stack-through-funcs?) - (parameterize ([current-output-port (current-output-port)]) + (parameterize ([current-output-port (current-output-port)] ; because we mutate these... + [error-escape-handler (error-escape-handler)] + [current-inspector (current-inspector)]) (begin-with-definitions (define power-inspector (current-inspector)) (current-inspector (make-inspector))