From 8525362b33606c7cd37a750fcf9cfee3bc0f20c5 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 9 May 2010 23:54:01 +0200 Subject: [PATCH] Whenever we check the argument types, also check the argument number --- src/cmp/cmplam.lsp | 2 +- src/cmp/cmppolicy.lsp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cmp/cmplam.lsp b/src/cmp/cmplam.lsp index 3b44b8608..f29764e95 100644 --- a/src/cmp/cmplam.lsp +++ b/src/cmp/cmplam.lsp @@ -336,7 +336,7 @@ The function thus belongs to the type of functions that ecl_make_cfun accepts." (baboon)) ;; check arguments - (unless (or local-entry-p (not (compiler-check-args))) + (unless (or local-entry-p (not (policy-check-nargs))) (incf *inline-blocks*) (if (and use-narg (not varargs)) (wt-nl "if (ecl_unlikely(narg!=" nreq ")) FEwrong_num_arguments_anonym();") diff --git a/src/cmp/cmppolicy.lsp b/src/cmp/cmppolicy.lsp index 98941558d..c26794499 100644 --- a/src/cmp/cmppolicy.lsp +++ b/src/cmp/cmppolicy.lsp @@ -212,7 +212,7 @@ (define-policy check-stack-overflow :on safety 2 "Add a stack check to every function") -(define-policy check-arguments-type :on safety 1 +(define-policy ext:check-arguments-type :on safety 1 "Generate CHECK-TYPE forms for function arguments with type declarations") (define-policy array-bounds-check :alias assume-no-errors @@ -224,7 +224,7 @@ (define-policy global-function-checking :alias assume-no-errors "Read the binding of a global function even if it is discarded") -(define-policy check-nargs :on safety 1 +(define-policy check-nargs :on safety 1 :on ext:check-arguments-type 1 "Check that the number of arguments a function receives is within bounds") ;; @@ -268,8 +268,5 @@ INTGERP, STRINGP.") (defun safe-compile () (>= (cmp-env-optimization 'safety) 2)) -(defun compiler-check-args () - (>= (cmp-env-optimization 'safety) 1)) - (defun compiler-push-events () (>= (cmp-env-optimization 'safety) 3))