Commit 06a85980 authored by Raymond Toy's avatar Raymond Toy
Browse files

The function database needs the relaxed declarations, if any.

Previously, the function definition would have the right declarations,
but the database would not have the relaxed declarations.  This produces
spurious warnings when converting functions that call the erroneously
declared function.

src/f2cl1.l:
o Make MAKE-F2CL-FINFO automatically relax the array declarations if
  needed.

src/f2cl5.l:
o If we update the function arg types, we need to relax the array
  declarations, if needed.
parent 24911884
......@@ -17,7 +17,7 @@
"Use (f2cl-version) instead")
(defparameter *f2cl1-version*
"$Id: f2cl1.l,v c4abe8cf9af0 2011/11/24 07:12:32 toy $")
"$Id: f2cl1.l,v 2bc8b118fd29 2011/12/03 06:01:32 toy $")
;; Forward declarations.
(defvar *f2cl2-version*)
......@@ -196,10 +196,25 @@ incorrect, so use caution.")
;; For some reason Allegro needs this eval-when because it complains
;; about undefined slot accessors without this.
(eval-when (compile load eval)
(defstruct f2cl-finfo
(defstruct (f2cl-finfo (:constructor %make-f2cl-finfo))
arg-types return-values calls)
)
(defun relax-array-decl (decls)
(flet ((relax-1 (decl)
(cond ((and *relaxed-array-decls* (subtypep decl 'array))
(destructuring-bind (a n l)
decl
`(,a ,n ,(mapcar (constantly '*) l))))
(t
decl))))
(mapcar #'relax-1 decls)))
(defun make-f2cl-finfo (&key arg-types return-values calls)
(%make-f2cl-finfo :arg-types (relax-array-decl arg-types)
:return-values return-values
:calls calls))
;; Hash table of all known converted functions.
(defvar *f2cl-function-info*
(let ((table (make-hash-table)))
......@@ -2060,16 +2075,6 @@ correctly"
;;(format t "new arglist = ~A~%" new-arglist)
new-arglist))
(defun relax-array-decl (decls)
(flet ((relax-1 (decl)
(cond ((and *relaxed-array-decls* (subtypep decl 'array))
(destructuring-bind (a n l)
decl
`(,a ,n ,(mapcar (constantly '*) l))))
(t
decl))))
(mapcar #'relax-1 decls)))
;; Subroutines and functions can modify the values of input
;; parameters. We handle this in Lisp by returning the input
;; parameters to the caller as multiple values. This function
......@@ -3345,7 +3350,7 @@ loop2
;;;-----------------------------------------------------------------------------
;;; end of f2cl1.l
;;;
;;; $Id: f2cl1.l,v c4abe8cf9af0 2011/11/24 07:12:32 toy $
;;; $Id: f2cl1.l,v 2bc8b118fd29 2011/12/03 06:01:32 toy $
;;; $Log$
;;; Revision 1.222 2010/10/08 03:05:30 rtoy
;;; src/f2cl1.l:
......
......@@ -50,7 +50,7 @@
(in-package :f2cl)
(defparameter *f2cl5-version*
"$Id: f2cl5.l,v 11bea7dae5a0 2011/06/11 17:53:39 toy $")
"$Id: f2cl5.l,v 2bc8b118fd29 2011/12/03 06:01:32 toy $")
;; functions for setting up varaible declarations and initialisations
(eval-when (compile load eval)
......@@ -1412,7 +1412,7 @@
;; (format t "declare ~S: ~S~%" (second defun-bit) var-type-list)
(let ((entry (gethash (second defun-bit) *f2cl-function-info*)))
(if entry
(setf (f2cl-finfo-arg-types entry) var-type-list)
(setf (f2cl-finfo-arg-types entry) (relax-array-decl var-type-list))
(setf (gethash (second defun-bit) *f2cl-function-info*)
(make-f2cl-finfo :arg-types var-type-list))))
(setq formal-arg-decls
......@@ -3858,7 +3858,7 @@
;;;-----------------------------------------------------------------------------
;;; end of f2cl5.l
;;;
;;; $Id: f2cl5.l,v 11bea7dae5a0 2011/06/11 17:53:39 toy $
;;; $Id: f2cl5.l,v 2bc8b118fd29 2011/12/03 06:01:32 toy $
;;; $Log$
;;; Revision 1.204 2010/02/23 05:21:30 rtoy
;;; Fix declaration for default integer type. Previously the type was
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment