From c57459a6ada03c8708bbce37322f95e9b63a1933 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 25 Oct 2008 01:17:15 +0200 Subject: [PATCH] When the list of functions is empty, no need to create the array (it is actually an error for some compilers). --- src/cmp/cmptop.lsp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cmp/cmptop.lsp b/src/cmp/cmptop.lsp index 8561b4bda..cbaf131b8 100644 --- a/src/cmp/cmptop.lsp +++ b/src/cmp/cmptop.lsp @@ -196,8 +196,13 @@ (wt-nl-h "#else") (wt-nl-h "static cl_object VV[VM];") (wt-nl-h "#endif")))) - (wt-nl-h "#define compiler_cfuns_size " (length *global-cfuns-array*)) - (wt-nl-h "static const struct ecl_cfun compiler_cfuns[" (length *global-cfuns-array*) "];") + + (let ((n-cfuns (length *global-cfuns-array*))) + (wt-nl-h "#define compiler_cfuns_size " n-cfuns) + (if (zerop n-cfuns) + (wt-nl-h "#define compiler_cfuns NULL") + (wt-nl-h "static const struct ecl_cfun compiler_cfuns[" n-cfuns "];"))) + (dolist (l *linking-calls*) (let* ((c-name (fourth l)) (var-name (fifth l))) @@ -697,7 +702,8 @@ (close-inline-blocks))) (defun output-cfuns (stream) - (format stream "~%static const struct ecl_cfun compiler_cfuns[] = {~ + (format stream "~%#ifndef compiler_cfuns~ +~%static const struct ecl_cfun compiler_cfuns[] = {~ ~%~t/*t,m,narg,padding,name,entry,block*/"); (loop for (loc fname-loc fun) in (nreverse *global-cfuns-array*) do (let* ((cfun (fun-cfun fun)) @@ -706,7 +712,7 @@ (narg (if (= minarg maxarg) maxarg nil))) (format stream "~%{0,0,~D,0,MAKE_FIXNUM(~D),(cl_objectfn)~A,MAKE_FIXNUM(~D)}," (or narg -1) (second loc) cfun (second fname-loc)))) - (format stream "~%};")) + (format stream "~%};~%#endif")) ;;; ----------------------------------------------------------------------