From 0e3bdbb2d9022686df594fa829be385d2924c93a Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <fare@tunes.org>
Date: Tue, 7 Mar 2017 18:14:17 -0500
Subject: [PATCH] Only warn in recursive calls to operate

Don't error out but only warn when operate is recursively called.
Too much legacy code uses load-system or require inside lisp files
and/or perform methods.
---
 find-system.lisp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/find-system.lisp b/find-system.lisp
index 71a8c3d94..00693bc66 100644
--- a/find-system.lisp
+++ b/find-system.lisp
@@ -53,14 +53,17 @@
       (if-let ((action (first (visiting-action-list *asdf-session*))))
         (let ((parent-operation (action-operation action))
               (parent-component (action-component action)))
-          (unless (and (typep parent-operation 'define-op) (typep parent-component 'system))
-            (error "Invalid recursive use of (OPERATE ~S ~S) while visiting ~S ~
-- please use proper dependencies instead."
-                   operation component action))
-          (let ((action (cons operation component)))
-            (unless (gethash action (definition-dependency-set parent-component))
-              (push (cons operation component) (definition-dependency-list parent-component))
-              (setf (gethash action (definition-dependency-set parent-component)) t)))))))
+          (cond
+            ((and (typep parent-operation 'define-op)
+                  (typep parent-component 'system))
+             (let ((action (cons operation component)))
+               (unless (gethash action (definition-dependency-set parent-component))
+                 (push (cons operation component) (definition-dependency-list parent-component))
+                 (setf (gethash action (definition-dependency-set parent-component)) t))))
+            (t
+             (warn (compatfmt "~@<Deprecated recursive use of (~S '~S '~S) while visiting ~S ~
+- please use proper dependencies instead~@:>")
+                   'operate (type-of operation) (component-find-path component) (action-path action))))))))
 
   (defmethod component-depends-on ((o define-op) (s system))
     `(;;NB: 1- ,@(system-defsystem-depends-on s)) ; Should be already included in the below.
-- 
GitLab