Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.10-20) unstable; urgency=high
 .
   * 2.6.11pre test 19
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.10.orig/cmpnew/gcl_cmpmain.lsp
+++ gcl-2.6.10/cmpnew/gcl_cmpmain.lsp
@@ -717,10 +717,13 @@ Cannot compile ~a.~%"
 				   (format st "load2(\"~a\");~%" tem)))))
 		    (format st "return Cnil;}~%~%")
 
+		    (format st "static int my_strncmp(const char *s1,const char *s2,unsigned long n) {")
+		    (format st "  for (;n--;) if (*s1++!=*s2++) return 1; return 0;}")
+
 		    (format st "int user_match(const char *s,int n) {~%")
 		    (format st "  Fnlst *f;~%")
 		    (format st "  for (f=my_fnlst;f<my_fnlst+NF;f++){~%")
-		    (format st "     if (f->s && !strncmp(s,f->s,n)) {~%")
+		    (format st "     if (f->s && !my_strncmp(s,f->s,n)) {~%")
 		    (format st "        my_load(f->fn,f->s);~%")
 		    (format st "        return 1;~%")
 		    (format st "     }~%")
--- gcl-2.6.10.orig/configure
+++ gcl-2.6.10/configure
@@ -6490,6 +6490,44 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C extension noreturn function attribute" >&5
+$as_echo_n "checking for C extension noreturn function attribute... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+	    extern int v() __attribute__ ((noreturn));
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  no_return="__attribute__ ((noreturn))"
+else
+  no_return=
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $no_return" >&5
+$as_echo "$no_return" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define NO_RETURN $no_return
+_ACEOF
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sizeof struct contblock" >&5
 $as_echo_n "checking sizeof struct contblock... " >&6; }
 
--- gcl-2.6.10.orig/configure.in
+++ gcl-2.6.10/configure.in
@@ -1271,6 +1271,13 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
 AC_MSG_RESULT($obj_align)
 AC_DEFINE_UNQUOTED(OBJ_ALIGN,$obj_align,[can use C extension for object alignment])
 
+AC_MSG_CHECKING([for C extension noreturn function attribute])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
+	    extern int v() __attribute__ ((noreturn));
+	    return 0;]])],[no_return="__attribute__ ((noreturn))"],[no_return=])
+AC_MSG_RESULT($no_return)
+AC_DEFINE_UNQUOTED(NO_RETURN,$no_return,[can use C extension for functions that do not return])
+
 AC_MSG_CHECKING(sizeof struct contblock)
 
 # work around MSYS pwd result incompatibility
--- gcl-2.6.10.orig/h/compprotos.h
+++ gcl-2.6.10/h/compprotos.h
@@ -67,7 +67,7 @@ void princ_str(char *,object);
 void sethash(object,object,object);
 void setq(object,object);
 void super_funcall_no_event(object);
-void unwind(frame_ptr,object);
+void unwind(frame_ptr,object) NO_RETURN;
 int object_to_int(object);
 fixnum object_to_fixnum(object);
 char object_to_char(object);
@@ -175,3 +175,4 @@ int putc(int,void *);
 void vfun_wrong_number_of_args(object);
 void ihs_overflow (void);
 double object_to_double(object);
+void gcl_init_or_load1(void (*)(void),const char *);
--- gcl-2.6.10.orig/h/gclincl.h.in
+++ gcl-2.6.10/h/gclincl.h.in
@@ -351,6 +351,9 @@
 /* no profil system call */
 #undef NO_PROFILE
 
+/* can use C extension for functions that do not return */
+#undef NO_RETURN
+
 /* no uname call */
 #undef NO_UNAME
 
--- gcl-2.6.10.orig/h/lex.h
+++ gcl-2.6.10/h/lex.h
@@ -47,13 +47,13 @@ where 'FUN' is the LISP object with pnam
 
 */
 
-#define lex_copy()	ihs_top->ihs_base = vs_top;  \
+#define lex_copy()	if (ihs_top>=ihs_org) ihs_top->ihs_base = vs_top;  \
 			vs_push(lex_env[0]);  \
                   	vs_push(lex_env[1]);  \
                   	vs_push(lex_env[2]);  \
 			lex_env = vs_top - 3
 
-#define lex_new()	ihs_top->ihs_base = vs_top;  \
+#define lex_new()	if (ihs_top>=ihs_org) ihs_top->ihs_base = vs_top; \
 			lex_env = vs_top;  \
 			vs_top[0] = vs_top[1] = vs_top[2] = Cnil;  \
 			vs_top += 3
--- gcl-2.6.10.orig/h/protoize.h
+++ gcl-2.6.10/h/protoize.h
@@ -225,7 +225,7 @@ typedef void (*funcvoid)(void);
 /* format.c::OF */ extern object fLformat_1(object strm, object control,object x);
 /* format.c:2084:OF */ extern void Lformat (void); /* () */
 /* format.c:2171:OF */ extern void gcl_init_format (void); /* () */
-/* frame.c:32:OF */ extern void unwind (frame_ptr fr, object tag); /* (fr, tag) frame_ptr fr; object tag; */
+/* frame.c:32:OF */ extern void unwind (frame_ptr fr, object tag) NO_RETURN; /* (fr, tag) frame_ptr fr; object tag; */
 /* frame.c:58:OF */ extern frame_ptr frs_sch (object frame_id); /* (frame_id) object frame_id; */
 /* frame.c:69:OF */ extern frame_ptr frs_sch_catch (object frame_id); /* (frame_id) object frame_id; */
 /* funlink.c:19:OF */ extern void call_or_link (object sym, void **link); /* (sym, link) object sym; void **link; */
--- gcl-2.6.10.orig/o/fasldlsym.c
+++ gcl-2.6.10/o/fasldlsym.c
@@ -85,7 +85,7 @@ fasload(object faslfile) {
 
   if (!(dlp = dlopen(buf,RTLD_NOW))) {
     fputs(dlerror(),stderr);
-    FEerror("Cannot open for dynamic link ~a",1,make_simple_string(faslfile));
+    FEerror("Cannot open for dynamic link ~a",1,make_simple_string(filename));
   }
   
 
@@ -95,7 +95,7 @@ fasload(object faslfile) {
   b[x->st.st_fillp]=0;
   if (!(fptr=dlsym(dlp,b))) {
     fputs(dlerror(),stderr);
-    FEerror("Cannot lookup ~a in ~a",2,make_simple_string(b),make_simple_string(faslfile));
+    FEerror("Cannot lookup ~a in ~a",2,make_simple_string(b),make_simple_string(filename));
   }
 
   SEEK_TO_END_OFILE(faslstream->sm.sm_fp);
