From c0975637307cddf7a308438dd427402e1fd9c648 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Sat, 2 Jan 2021 13:36:14 -0800 Subject: [PATCH] The error() function may return under exceptional circumstances (#97) There are a few places where error() was called that in practice would never be returned from, however since it was coded with the possibility of returning all call sites must be consistent with that. modified: ../src/car-cdr.c modified: ../src/gchtfind.c modified: ../src/hardrtn.c --- src/car-cdr.c | 2 ++ src/gchtfind.c | 2 ++ src/hardrtn.c | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/car-cdr.c b/src/car-cdr.c index 2e22968..ccb90ed 100644 --- a/src/car-cdr.c +++ b/src/car-cdr.c @@ -78,6 +78,7 @@ LispPTR car(register LispPTR datum) return (NIL); else error("car : ARG not list"); + return (NIL); /* NOT REACHED */ } } /* end of car */ @@ -150,6 +151,7 @@ LispPTR rplaca(register LispPTR x, register LispPTR y) return (NIL_PTR); } else error("ARG not List"); + return (NIL_PTR); /* NOT REACHED */ } else { diff --git a/src/gchtfind.c b/src/gchtfind.c index a6ad903..ac9332b 100644 --- a/src/gchtfind.c +++ b/src/gchtfind.c @@ -94,6 +94,7 @@ IncAllocCnt(1); \ return ptr; /* new 0 entry */ \ default: error("GC error: new entry touches stack bit"); \ + return NIL; /* NOT REACHED */ \ } \ } @@ -114,6 +115,7 @@ GETGC(entry) = hiptr | (1 << HTCNTSHIFT) | HTSTKMASK; \ return NIL; \ default: error("GC error: new entry when turning off stack bit"); \ + return NIL; /* NOT REACHED */ \ } \ } diff --git a/src/hardrtn.c b/src/hardrtn.c index 855594d..d6a5bad 100644 --- a/src/hardrtn.c +++ b/src/hardrtn.c @@ -250,7 +250,8 @@ retry: /* this is retry entry after MAKE_FXCOPY etc */ else error("Shouldn't"); } - + error("Control reached end of slowreturn()!"); + return (NIL); /* NOT REACHED */ } /* slowreturn end */ #define MAXSAFEUSECOUNT 200