From 599111920090326d17a90853f9db5fd3c617b336 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
Date: Mon, 22 Jun 2020 00:30:24 -0700
Subject: [PATCH] tclx8.4: Use Tcl_Panic instead of deprecated / implicitly
 declared panic()

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
---
 generic/tclExtdInt.h  |  2 +-
 generic/tclXdup.c     |  2 +-
 generic/tclXfcntl.c   |  4 ++--
 generic/tclXhandles.c |  2 +-
 generic/tclXprofile.c | 12 ++++++------
 generic/tclXsignal.c  |  6 +++---
 generic/tclXstring.c  |  2 +-
 generic/tclXutil.c    | 10 +++++-----
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/generic/tclExtdInt.h b/generic/tclExtdInt.h
index fd3812ff6..ffa8b30ac 100644
--- generic/tclExtdInt.h
+++ generic/tclExtdInt.h
@@ -47,7 +47,7 @@
  */
 #ifdef TCLX_DEBUG
 #   define TclX_Assert(expr) ((expr) ? (void)0 : \
-                              panic("TclX assertion failure: %s:%d \"%s\"\n",\
+                              Tcl_Panic("TclX assertion failure: %s:%d \"%s\"\n",\
                                     __FILE__, __LINE__, "expr"))
 #else
 #   define TclX_Assert(expr)
diff --git a/generic/tclXdup.c b/generic/tclXdup.c
index 41f3eec39..263e5d483 100644
--- generic/tclXdup.c
+++ generic/tclXdup.c
@@ -76,7 +76,7 @@ DupChannelOptions (interp, srcChannel, targetChannel)
         goto errorExit;
     }
     if ((optArgc % 2) != 0) {
-        panic("channel didn't return keyword/value pairs");
+        Tcl_Panic("channel didn't return keyword/value pairs");
     }
 
     for (idx = 0; idx < optArgc; idx += 2) {
diff --git a/generic/tclXfcntl.c b/generic/tclXfcntl.c
index 43a26117b..a83e8af15 100644
--- generic/tclXfcntl.c
+++ generic/tclXfcntl.c
@@ -211,7 +211,7 @@ GetFcntlAttr (interp, channel, mode, attrib)
             return TCL_ERROR;
         break;
       default:
-        panic ("bug in fcntl get attrib");
+        Tcl_Panic ("bug in fcntl get attrib");
     }
 
     Tcl_SetIntObj (Tcl_GetObjResult (interp), value != 0);
@@ -267,7 +267,7 @@ SetFcntlAttrObj (interp, channel, attrib, valueObj)
       case ATTR_KEEPALIVE:
         return TclXOSsetsockopt (interp, channel, SO_KEEPALIVE, value);
       default:
-        panic ("buf in fcntl set attrib");
+        Tcl_Panic ("buf in fcntl set attrib");
     }
     return TCL_ERROR;  /* Should never be reached */
 }
diff --git a/generic/tclXhandles.c b/generic/tclXhandles.c
index 83159139f..cc854367e 100644
--- generic/tclXhandles.c
+++ generic/tclXhandles.c
@@ -567,7 +567,7 @@ TclX_HandleFree (headerPtr, entryPtr)
 
     entryHdrPtr = HEADER_AREA (entryPtr);
     if (entryHdrPtr->freeLink != ALLOCATED_IDX)
-        panic ("Tcl_HandleFree: entry not allocated %x\n", entryHdrPtr);
+        Tcl_Panic ("Tcl_HandleFree: entry not allocated %x\n", entryHdrPtr);
 
     entryHdrPtr->freeLink = tblHdrPtr->freeHeadIdx;
     tblHdrPtr->freeHeadIdx =
diff --git a/generic/tclXprofile.c b/generic/tclXprofile.c
index e45b78669..7444aa7f3 100644
--- generic/tclXprofile.c
+++ generic/tclXprofile.c
@@ -240,7 +240,7 @@ PushEntry (infoPtr, cmdName, isProc, procLevel, scopeLevel, evalLevel)
          * Only global level can be NULL.
          */
         if (scanPtr == NULL)
-            panic (PROF_PANIC, 1);
+            Tcl_Panic (PROF_PANIC, 1);
     }
     entryPtr->prevScopePtr = scanPtr;
     infoPtr->scopeChainPtr = entryPtr;
@@ -450,7 +450,7 @@ ProfCommandEvalSetup (infoPtr, isProcPtr)
         UpdateTOSTimes (infoPtr);
     while (infoPtr->stackPtr->procLevel > procLevel) {
         if (infoPtr->stackPtr->evalLevel != UNKNOWN_LEVEL) 
-            panic (PROF_PANIC, 2);  /* Not an initial entry */
+            Tcl_Panic (PROF_PANIC, 2);  /* Not an initial entry */
         PopEntry (infoPtr);
     }
 
@@ -595,15 +595,15 @@ ProfTraceRoutine (clientData, interp, evalLevel, command, cmdProc,
     Tcl_Command cmd;
 
     if (infoPtr->currentCmdPtr != NULL)
-        panic (PROF_PANIC, 3);
+        Tcl_Panic (PROF_PANIC, 3);
 
     cmd = Tcl_FindCommand (interp, argv [0], NULL, 0);
     if (cmd == NULL)
-        panic (PROF_PANIC, 4);
+        Tcl_Panic (PROF_PANIC, 4);
     cmdPtr = (Command *) cmd;
 
     if ((cmdPtr->proc != cmdProc) || (cmdPtr->clientData != cmdClientData))
-        panic (PROF_PANIC, 5);
+        Tcl_Panic (PROF_PANIC, 5);
 
     /*
      * If command is to be compiled, we can't profile it.
@@ -740,7 +740,7 @@ TurnOnProfiling (infoPtr, commandMode, evalMode)
          * Only global level can be NULL.
          */
         if (scanPtr == NULL)
-            panic (PROF_PANIC, 6);
+            Tcl_Panic (PROF_PANIC, 6);
     }
     infoPtr->scopeChainPtr = scanPtr;
 
diff --git a/generic/tclXsignal.c b/generic/tclXsignal.c
index 21c226cb6..96942a5f5 100644
--- generic/tclXsignal.c
+++ generic/tclXsignal.c
@@ -649,11 +649,11 @@ SignalTrap (signalNum)
 #ifdef SIGCHLD
     if (signalNum != SIGCHLD) {
         if (SetSignalState (signalNum, SignalTrap, FALSE) == TCL_ERROR)
-            panic ("SignalTrap bug");
+            Tcl_Panic ("SignalTrap bug");
     }
 #else
     if (SetSignalState (signalNum, SignalTrap, FALSE) == TCL_ERROR)
-        panic ("SignalTrap bug");
+        Tcl_Panic ("SignalTrap bug");
 #endif /* SIGCHLD */
 #endif /* NO_SIGACTION */
 }
@@ -1581,7 +1581,7 @@ SignalCmdCleanUp (clientData, interp)
             break;
     }
     if (idx == numInterps)
-        panic ("signal interp lost");
+        Tcl_Panic ("signal interp lost");
 
     interpTable [idx] = interpTable [--numInterps];
 
diff --git a/generic/tclXstring.c b/generic/tclXstring.c
index 93e8b1e39..761148fee 100644
--- generic/tclXstring.c
+++ generic/tclXstring.c
@@ -677,7 +677,7 @@ TclX_CtypeObjCmd (dummy, interp, objc, objv)
 #define IS_8BIT_UNICHAR(c) (c <= 255)
 
     if (TCL_UTF_MAX > sizeof(number)) {
-        panic("TclX_CtypeObjCmd: UTF character longer than a int");
+        Tcl_Panic("TclX_CtypeObjCmd: UTF character longer than a int");
     }
 
     /*FIX: Split into multiple procs */
diff --git a/generic/tclXutil.c b/generic/tclXutil.c
index 633e19ba8..d0ed7a487 100644
--- generic/tclXutil.c
+++ generic/tclXutil.c
@@ -503,7 +503,7 @@ ParseTranslationOption (strValue)
     } else if (STREQU (strValue, "platform")) {
         return TCLX_TRANSLATE_PLATFORM;
     }
-    panic ("ParseTranslationOption bug");
+    Tcl_Panic ("ParseTranslationOption bug");
     return TCL_ERROR;  /* Not reached */
 }
 
@@ -535,7 +535,7 @@ FormatTranslationOption (value)
       case TCLX_TRANSLATE_PLATFORM:
         return "platform";
       default:
-        panic ("FormatTranslationOption bug");
+        Tcl_Panic ("FormatTranslationOption bug");
     }
     return NULL;  /* Not reached */
 }
@@ -649,7 +649,7 @@ TclX_GetChannelOption (interp, channel, option, valuePtr)
     return TCL_OK;
 
   fatalError:
-    panic ("TclX_GetChannelOption bug");  /* FIX: return error. */
+    Tcl_Panic ("TclX_GetChannelOption bug");  /* FIX: return error. */
     return 0;  /* Not reached */
 }
 
@@ -745,7 +745,7 @@ TclX_SetChannelOption (interp, channel, option, value)
     return Tcl_SetChannelOption (interp, channel, strOption, strValue);
 
   fatalError:
-    panic ("TclX_SetChannelOption bug");
+    Tcl_Panic ("TclX_SetChannelOption bug");
     return TCL_ERROR;  /* Not reached */
 }
 
@@ -965,7 +965,7 @@ TclX_RestoreResultErrorInfo (interp, saveObjPtr)
 	/*
 	 * This should never happen
 	 */
-        panic ("invalid TclX result save object");
+        Tcl_Panic ("invalid TclX result save object");
     }
 
     Tcl_SetVar2Ex(interp, ERRORCODE, NULL, saveObjv[2], TCL_GLOBAL_ONLY);
