diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-11-20 08:40:56 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-11-20 08:40:56 (GMT) |
commit | 16d2acf37e9ad400c2d1f7d08f6cc72f6a004776 (patch) | |
tree | 470375d1700fd5ef077fe428997c673eafcba81f | |
parent | c2828cdb9eb5b4f9340bcea177e0edcab1a4a77f (diff) | |
download | tcl-16d2acf37e9ad400c2d1f7d08f6cc72f6a004776.zip tcl-16d2acf37e9ad400c2d1f7d08f6cc72f6a004776.tar.gz tcl-16d2acf37e9ad400c2d1f7d08f6cc72f6a004776.tar.bz2 |
Add checks for the assumtions made in tclStubLib.c, making sure that those
assumtions are maintained for Tcl 9! If not, extensions compiled for Tcl9
but loaded in Tcl8 (with an incompatible stub table) cannot produce
a nice error-message any more.
<p>This is probably not the best place to do the check, maybe it's better
to do this in tclTest.c, as part of the test suite.
<p>Feedback welcome!
-rw-r--r-- | generic/tclBasic.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 2735abc..63bc4b8 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -431,6 +431,14 @@ TclFinalizeEvaluation(void) *---------------------------------------------------------------------- */ +/* Template for internal Interp structure: the stubTable entry cannot move! */ +typedef struct { + char *dumm1; + Tcl_FreeProc *dummy2; + int dummy3; + const struct TclStubs *stubTable; +} InterpTemplate; + Tcl_Interp * Tcl_CreateInterp(void) { @@ -466,6 +474,21 @@ Tcl_CreateInterp(void) /*NOTREACHED*/ Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame"); } + if ((void *) tclStubs.tcl_SetObjResult + != (void *)((&(tclStubs.tcl_PkgProvideEx))[235])) { + /*NOTREACHED*/ + Tcl_Panic("Tcl_SetObjResult entry in the stub table must be kept"); + } + if ((void *) tclStubs.tcl_NewStringObj + != (void *)((&(tclStubs.tcl_PkgProvideEx))[56])) { + /*NOTREACHED*/ + Tcl_Panic("Tcl_NewStringObj entry in the stub table must be kept"); + } + if (offsetof(InterpTemplate, stubTable) + != offsetof(Interp, stubTable)) { + /*NOTREACHED*/ + Tcl_Panic("stubsTable entry in the Interp structure must be kept"); + } if (cancelTableInitialized == 0) { Tcl_MutexLock(&cancelLock); |