Also extend the deprecation framwork to support multiple replacements:
SB-EXT:QUIT should be replaced either by SB-EXT:EXIT or SB-EXT:ABORT-THREAD,
depending on the way it was being used.
"UNIX-CLOSEDIR" "UNIX-DIRENT-NAME" "UNIX-DUP"
"UNIX-FILE-MODE" "UNIX-FSTAT"
"UNIX-GETHOSTNAME" "UNIX-GETPID" "UNIX-GETRUSAGE"
"UNIX-CLOSEDIR" "UNIX-DIRENT-NAME" "UNIX-DUP"
"UNIX-FILE-MODE" "UNIX-FSTAT"
"UNIX-GETHOSTNAME" "UNIX-GETPID" "UNIX-GETRUSAGE"
- "UNIX-GETTIMEOFDAY" "UNIX-GETUID" "UNIX-GID" "UNIX-IOCTL"
+ "UNIX-GETTIMEOFDAY" "UNIX-GETUID" "UNIX-GID"
+ "UNIX-EXIT"
+ "UNIX-IOCTL"
"UNIX-ISATTY" "UNIX-LSEEK" "UNIX-LSTAT" "UNIX-MKDIR"
"UNIX-OPEN" "UNIX-OPENDIR" "UNIX-PATHNAME" "UNIX-PID"
"UNIX-PIPE" "UNIX-SIMPLE-POLL" "UNIX-READ" "UNIX-READDIR" "UNIX-READLINK" "UNIX-REALPATH"
"UNIX-ISATTY" "UNIX-LSEEK" "UNIX-LSTAT" "UNIX-MKDIR"
"UNIX-OPEN" "UNIX-OPENDIR" "UNIX-PATHNAME" "UNIX-PID"
"UNIX-PIPE" "UNIX-SIMPLE-POLL" "UNIX-READ" "UNIX-READDIR" "UNIX-READLINK" "UNIX-REALPATH"
(toplevel-init)
(critically-unreachable "after TOPLEVEL-INIT")))
(toplevel-init)
(critically-unreachable "after TOPLEVEL-INIT")))
-(defun quit (&key recklessly-p (unix-status 0))
- #!+sb-doc
- "Deprecated. See: SB-EXT:EXIT, SB-THREAD:RETURN-FROM-THREAD,
-SB-THREAD:ABORT-THREAD."
+(define-deprecated-function :early "1.0.56.55" quit (exit sb!thread:abort-thread)
+ (&key recklessly-p (unix-status 0))
(if (or recklessly-p (sb!thread:main-thread-p))
(exit :code unix-status :abort recklessly-p)
(sb!thread:abort-thread))
(if (or recklessly-p (sb!thread:main-thread-p))
(exit :code unix-status :abort recklessly-p)
(sb!thread:abort-thread))
(define-condition deprecation-condition ()
((name :initarg :name :reader deprecated-name)
(define-condition deprecation-condition ()
((name :initarg :name :reader deprecated-name)
- (replacement :initarg :replacement :reader deprecated-name-replacement)
+ (replacements :initarg :replacements :reader deprecated-name-replacements)
(since :initarg :since :reader deprecated-since)
(runtime-error :initarg :runtime-error :reader deprecated-name-runtime-error)))
(since :initarg :since :reader deprecated-since)
(runtime-error :initarg :runtime-error :reader deprecated-name-runtime-error)))
(let ((*package* (find-package :keyword)))
(if *print-escape*
(print-unreadable-object (condition stream :type t)
(let ((*package* (find-package :keyword)))
(if *print-escape*
(print-unreadable-object (condition stream :type t)
- (format stream "~S is deprecated~@[, use ~S~]"
+ (apply #'format
+ stream "~S is deprecated.~
+ ~#[~; Use ~S instead.~; ~
+ Use ~S or ~S instead.~:; ~
+ Use~@{~#[~; or~] ~S~^,~} instead.~]"
(deprecated-name condition)
(deprecated-name condition)
- (deprecated-name-replacement condition)))
- (format stream "~@<~S has been deprecated as of SBCL ~A~
- ~@[, use ~S instead~].~:@>"
+ (deprecated-name-replacements condition)))
+ (apply #'format
+ stream "~@<~S has been deprecated as of SBCL ~A.~
+ ~#[~; Use ~S instead.~; ~
+ Use ~S or ~S instead.~:; ~
+ Use~@{~#[~; or~] ~S~^,~:_~} instead.~]~:@>"
(deprecated-name condition)
(deprecated-since condition)
(deprecated-name condition)
(deprecated-since condition)
- (deprecated-name-replacement condition)))))
+ (deprecated-name-replacements condition)))))
(define-condition early-deprecation-warning (style-warning deprecation-condition)
())
(define-condition early-deprecation-warning (style-warning deprecation-condition)
())
-(defun deprecation-error (since name replacement)
+(defun normalize-deprecation-replacements (replacements)
+ (if (or (not (listp replacements))
+ (eq 'setf (car replacements)))
+ (list replacements)
+ replacements))
+
+(defun deprecation-error (since name replacements)
(error 'deprecation-error
:name name
(error 'deprecation-error
:name name
- :replacement replacement
+ :replacements (normalize-deprecation-replacements replacements)
-(defun deprecation-warning (state since name replacement
+(defun deprecation-warning (state since name replacements
&key (runtime-error (neq :early state)))
(warn (ecase state
(:early 'early-deprecation-warning)
(:late 'late-deprecation-warning)
(:final 'final-deprecation-warning))
:name name
&key (runtime-error (neq :early state)))
(warn (ecase state
(:early 'early-deprecation-warning)
(:late 'late-deprecation-warning)
(:final 'final-deprecation-warning))
:name name
- :replacement replacement
+ :replacements (normalize-deprecation-replacements replacements)
:since since
:runtime-error runtime-error))
:since since
:runtime-error runtime-error))
-(defun deprecated-function (since name replacement)
+(defun deprecated-function (since name replacements)
(lambda (&rest deprecated-function-args)
(declare (ignore deprecated-function-args))
(lambda (&rest deprecated-function-args)
(declare (ignore deprecated-function-args))
- (deprecation-error since name replacement)))
+ (deprecation-error since name replacements)))
-(defun deprecation-compiler-macro (state since name replacement)
+(defun deprecation-compiler-macro (state since name replacements)
(lambda (form env)
(declare (ignore env))
(lambda (form env)
(declare (ignore env))
- (deprecation-warning state since name replacement)
+ (deprecation-warning state since name replacements)
-(defmacro define-deprecated-function (state since name replacement lambda-list &body body)
- (let ((doc (let ((*package* (find-package :keyword)))
- (format nil "~@<~S has been deprecated as of SBCL ~A~@[, use ~S instead~].~:>"
- name since replacement))))
+(defmacro define-deprecated-function (state since name replacements lambda-list &body body)
+ (let* ((replacements (normalize-deprecation-replacements replacements))
+ (doc (let ((*package* (find-package :keyword)))
+ (apply #'format nil
+ "~@<~S has been deprecated as of SBCL ~A.~
+ ~#[~; Use ~S instead.~; ~
+ Use ~S or ~S instead.~:; ~
+ Use~@{~#[~; or~] ~S~^,~} instead.~]~@:>"
+ name since replacements))))
- ((:early :late)
- `(defun ,name ,lambda-list
- ,doc
- ,@body))
- ((:final)
- `(progn
- (declaim (ftype (function * nil) ,name))
- (setf (fdefinition ',name)
- (deprecated-function ',name ',replacement ,since))
- (setf (documentation ',name 'function) ,doc))))
+ ((:early :late)
+ `(defun ,name ,lambda-list
+ ,doc
+ ,@body))
+ ((:final)
+ `(progn
+ (declaim (ftype (function * nil) ,name))
+ (setf (fdefinition ',name)
+ (deprecated-function ',name ',replacements ,since))
+ (setf (documentation ',name 'function) ,doc))))
(setf (compiler-macro-function ',name)
(setf (compiler-macro-function ',name)
- (deprecation-compiler-macro ,state ,since ',name ',replacement)))))
+ (deprecation-compiler-macro ,state ,since ',name ',replacements)))))
;;; Anaphoric macros
(defmacro awhen (test &body body)
;;; Anaphoric macros
(defmacro awhen (test &body body)
(deftype exit-code ()
`(signed-byte 32))
(defun os-exit (code &key abort)
(deftype exit-code ()
`(signed-byte 32))
(defun os-exit (code &key abort)
+ #!+sb-doc
+ "Exit the process with CODE. If ABORT is true, exit is performed using _exit(2),
+avoiding atexit(3) hooks, etc. Otherwise exit(2) is called."
(unless (typep code 'exit-code)
(setf code (if abort 1 0)))
(if abort
(void-syscall ("_exit" int) code)
(void-syscall ("exit" int) code)))
(unless (typep code 'exit-code)
(setf code (if abort 1 0)))
(if abort
(void-syscall ("_exit" int) code)
(void-syscall ("exit" int) code)))
+(define-deprecated-function :early "1.0.56.55" unix-exit os-exit (code)
+ (os-exit code))
+
;;; Return the process id of the current process.
(define-alien-routine ("getpid" unix-getpid) int)
;;; Return the process id of the current process.
(define-alien-routine ("getpid" unix-getpid) int)