Changeset 9848


Ignore:
Timestamp:
Jun 30, 2008, 7:05:03 AM (11 years ago)
Author:
gz
Message:

Make program-errors always cause an immediate error outside of file compilation.

For file compilation, the behavior is now controlled by a new :break-on-program-errors
argument to compile-file, defaulting from ccl::*fasl-break-on-program-errors*:

(defvar *fasl-break-on-program-errors* #+ccl-0711 nil #-ccl-0711 :defer

"Controls what happens when the compiler detects PROGRAM-ERROR's during file compilation.

If T, the compiler signals an error immediately when it detects the program-error.

If :DEFER, program errors are reported as compiler warnings, and in addition, an error

is signalled at the end of file compilation. This allows all warnings for the file
to be reported, but prevents the creation of a fasl file.

If NIL, program errors are treated the same as any other error condition detected by

the compiler, i.e. they are reported as compiler warnings and do not cause any
error to be signalled at compile time.")

Location:
trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx0.lisp

    r9763 r9848  
    5151(defparameter *nx-hoist-declarations* t)
    5252(defparameter *nx-loop-nesting-level* 0)
     53(defvar *nx-break-on-program-errors* t)
    5354
    5455(defvar *nx1-vcells* nil)
     
    13251326          (setf (afunc-acode p) (nx1-lambda '(&rest args) `(args ,(runtime-program-error-form c)) nil)))
    13261327      (handler-bind ((warning (lambda (c)
    1327                                 (nx1-whine :program-error c)
    1328                                 (muffle-warning c)))
    1329                      (program-error (lambda (c)
    1330                                       (when (typep c 'compile-time-program-error)
    1331                                         (setq c (make-condition 'simple-program-error
    1332                                                   :format-control (simple-condition-format-control c)
    1333                                                   :format-arguments (simple-condition-format-arguments c))))
    1334                                       (nx1-whine :program-error c)
    1335                                       (throw 'program-error-handler c))))
     1328                                (nx1-whine :program-error c)
     1329                                (muffle-warning c)))
     1330                     (program-error (lambda (c)
     1331                                      (when *nx-break-on-program-errors*
     1332                                        (cerror "continue compilation ignoring this form" c))
     1333                                      (when (typep c 'compile-time-program-error)
     1334                                        (setq c (make-condition 'simple-program-error
     1335                                                                :format-control (simple-condition-format-control c)
     1336                                                                :format-arguments (simple-condition-format-arguments c))))
     1337                                      (unless *nx-break-on-program-errors*
     1338                                        (nx1-whine :program-error c))
     1339                                      (throw 'program-error-handler c))))
    13361340        (multiple-value-bind (body decls)
    13371341            (with-program-error-handler (lambda (c) (runtime-program-error-form c))
  • trunk/source/level-1/sysutils.lisp

    r9061 r9848  
    625625    (unless muffled
    626626      (setq any-p t)
    627       (unless (typep w 'style-warning) (setq harsh-p t))
     627      (unless (typep w 'style-warning)
     628        (unless (eq harsh-p :very)
     629          (setq harsh-p t)
     630          (when (and (typep w 'compiler-warning)
     631                     (eq (compiler-warning-warning-type w) :program-error)
     632                     (typep (car (compiler-warning-args w)) 'error))
     633            (setq harsh-p :very))))
    628634      (when (or init-p (not (equalp w-file last-w-file)))
    629635        (format s "~&;~A warnings " (if (null eval-p) "Compiler" "Interpreter"))
  • trunk/source/lib/nfcomp.lisp

    r9167 r9848  
    6767(defvar *fcomp-external-format* :default)
    6868
     69(defvar *fasl-break-on-program-errors* #+ccl-0711 nil #-ccl-0711 :defer
     70  "Controls what happens when the compiler detects PROGRAM-ERROR's during file compilation.
     71
     72  If T, the compiler signals an error immediately when it detects the program-error.
     73
     74  If :DEFER, program errors are reported as compiler warnings, and in addition, an error
     75    is signalled at the end of file compilation.  This allows all warnings for the file
     76    to be reported, but prevents the creation of a fasl file.
     77
     78  If NIL, program errors are treated the same as any other error condition detected by
     79   the compiler, i.e. they are reported as compiler warnings and do not cause any
     80   error to be signalled at compile time.")
     81 
     82
    6983(defvar *compile-print* nil ; Might wind up getting called *compile-FILE-print*
    7084  "The default for the :PRINT argument to COMPILE-FILE.")
     
    110124                         (save-doc-strings *fasl-save-doc-strings*)
    111125                         (save-definitions *fasl-save-definitions*)
    112                          (external-format :default)
     126                         (break-on-program-errors *fasl-break-on-program-errors*)
     127                         (external-format :default)
    113128                         force)
    114129  "Compile INPUT-FILE, producing a corresponding fasl file and returning
     
    121136        (restart-case
    122137         (return (%compile-file src output-file verbose print load features
    123                                 save-local-symbols save-doc-strings save-definitions force backend external-format))
     138                                save-local-symbols save-doc-strings save-definitions
     139                                break-on-program-errors
     140                                force backend external-format))
    124141         (retry-compile-file ()
    125142                             :report (lambda (stream) (format stream "Retry compiling ~s" src))
     
    131148
    132149(defun %compile-file (src output-file verbose print load features
    133                           save-local-symbols save-doc-strings save-definitions force target-backend external-format
     150                          save-local-symbols save-doc-strings save-definitions
     151                          break-on-program-errors
     152                          force target-backend external-format
    134153                          &aux orig-src)
    135154
     
    166185             (*fasl-save-doc-strings* save-doc-strings)
    167186             (*fasl-save-definitions* save-definitions)
     187             (*fasl-break-on-program-errors* break-on-program-errors)
    168188             (*fcomp-warnings-header* nil)
    169189             (*compile-file-pathname* orig-src)
     
    192212            (multiple-value-bind (any harsh) (report-deferred-warnings)
    193213              (setq *fasl-warnings-signalled-p* (or *fasl-warnings-signalled-p* any)
    194                     *fasl-non-style-warnings-signalled-p* (or *fasl-non-style-warnings-signalled-p* harsh))))
     214                    *fasl-non-style-warnings-signalled-p* (if (eq harsh :very) :very
     215                                                              (or *fasl-non-style-warnings-signalled-p* harsh)))))
     216          (when (and *fasl-break-on-program-errors* (eq *fasl-non-style-warnings-signalled-p* :very))
     217            (cerror "create the output file despite the errors"
     218                    "Serious errors encountered during compilation of ~s"
     219                    src))
    195220          (fasl-scan-forms-and-dump-file forms output-file lexenv)))
    196221      (when load (load output-file :verbose (or verbose *load-verbose*)))
    197222      (values (truename (pathname output-file))
    198223              *fasl-warnings-signalled-p*
    199               *fasl-non-style-warnings-signalled-p*))))
     224              (and *fasl-non-style-warnings-signalled-p* t)))))
    200225
    201226(defvar *fcomp-locked-hash-tables*)
     
    839864;;; making an lfun, but it's simpler this way...
    840865(defun fcomp-named-function (def name env)
    841   (let* ((env (new-lexical-environment env)))
     866  (let* ((env (new-lexical-environment env))
     867         (*nx-break-on-program-errors* (not (memq *fasl-break-on-program-errors* '(nil :defer)))))
    842868    (multiple-value-bind (lfun warnings)
    843869                         (compile-named-function
Note: See TracChangeset for help on using the changeset viewer.