From 7c54b6f6fd2a99998ce0daa0b32c8940d1ed5eea Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 24 Oct 2019 10:53:58 +0000 Subject: tclAppInit.c should be built without BUILD_tcl/USE_TCL_STUBS always. All build files should be adapted now to assure that. --- generic/tclDecls.h | 9 --------- unix/tclAppInit.c | 11 ++++++----- win/tclAppInit.c | 7 +++++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index b37491a..6ab227f 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3931,19 +3931,10 @@ extern const TclStubs *tclStubsPtr; /* !END!: Do not edit above this line. */ #if defined(USE_TCL_STUBS) -# undef Tcl_CreateInterp # undef Tcl_FindExecutable -# undef Tcl_GetStringResult -# undef Tcl_Init # undef Tcl_SetPanicProc # undef Tcl_SetExitProc -# undef Tcl_ObjSetVar2 # undef Tcl_StaticPackage -# define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp()) -# define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp)) -# define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp)) -# define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \ - (tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags)) #endif #if defined(_WIN32) && defined(UNICODE) diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 3587f35..aa060ab 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -12,8 +12,9 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#undef BUILD_tcl -#undef STATIC_BUILD +#if defined(BUILD_tcl) || defined(USE_TCL_STUBS) +#error "Don't build with BUILD_tcl/USE_TCL_STUBS!" +#endif #include "tcl.h" #ifdef TCL_TEST @@ -110,7 +111,7 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { - if ((Tcl_Init)(interp) == TCL_ERROR) { + if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } @@ -152,10 +153,10 @@ Tcl_AppInit( */ #ifdef DJGPP - (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, Tcl_NewStringObj("~/tclsh.rc", -1), TCL_GLOBAL_ONLY); #else - (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, Tcl_NewStringObj("~/.tclshrc", -1), TCL_GLOBAL_ONLY); #endif diff --git a/win/tclAppInit.c b/win/tclAppInit.c index fa27756..348b32c 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -14,6 +14,9 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#if defined(BUILD_tcl) || defined(USE_TCL_STUBS) +#error "Don't build with BUILD_tcl/USE_TCL_STUBS!" +#endif #include "tcl.h" #define WIN32_LEAN_AND_MEAN #define STRICT /* See MSDN Article Q83456 */ @@ -158,7 +161,7 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { - if ((Tcl_Init)(interp) == TCL_ERROR) { + if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } @@ -205,7 +208,7 @@ Tcl_AppInit( * user-specific startup file will be run under any conditions. */ - (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, Tcl_NewStringObj("~/tclshrc.tcl", -1), TCL_GLOBAL_ONLY); return TCL_OK; } -- cgit v0.12 From b0dd51b115eda106d6dd034f4867d446d28f4e1c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Jul 2022 11:07:59 +0000 Subject: Only use -DBUILD_tcl for shared/static library --- generic/tcl.h | 2 +- unix/Makefile.in | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index d99e9fa..ca68eaa 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2379,7 +2379,7 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, #if defined(_WIN32) TCL_NORETURN void Tcl_ConsolePanic(const char *format, ...); #else -# define Tcl_ConsolePanic ((Tcl_PanicProc *)0) +# define Tcl_ConsolePanic ((Tcl_PanicProc *)NULL) #endif #ifdef USE_TCL_STUBS diff --git a/unix/Makefile.in b/unix/Makefile.in index d0a9d86..28fa446 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -176,7 +176,7 @@ NATIVE_TCLSH = @TCLSH_PROG@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ -SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DBUILD_tcl +SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ TCL_SHLIB_LD_EXTRAS = @TCL_SHLIB_LD_EXTRAS@ @@ -278,12 +278,12 @@ VALGRINDARGS = --tool=memcheck --num-callers=24 \ STUB_CC_SWITCHES = -I"${BUILD_DIR}" -I${UNIX_DIR} -I${GENERIC_DIR} -I${TOMMATH_DIR} \ ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ - ${AC_FLAGS} ${ENV_FLAGS} ${EXTRA_CFLAGS} \ - @EXTRA_CC_SWITCHES@ + ${AC_FLAGS} ${ENV_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@ \ + ${NO_DEPRECATED_FLAGS} -DMP_FIXED_CUTOFFS -DMP_NO_STDINT -CC_SWITCHES = $(STUB_CC_SWITCHES) ${NO_DEPRECATED_FLAGS} -DMP_FIXED_CUTOFFS -DMP_NO_STDINT +CC_SWITCHES = $(STUB_CC_SWITCHES) -DBUILD_tcl -APP_CC_SWITCHES = $(CC_SWITCHES) @EXTRA_APP_CC_SWITCHES@ +APP_CC_SWITCHES = $(STUB_CC_SWITCHES) @EXTRA_APP_CC_SWITCHES@ LIBS = @TCL_LIBS@ -- cgit v0.12 From 004fe2d35203d7d11d592e8808c83f8a04dfeb31 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Jul 2022 11:56:23 +0000 Subject: Updste stdlib.h (add missing functions). Restructure tclAppInit.c --- compat/stdlib.h | 14 +++++++++----- unix/tclAppInit.c | 10 ++++++---- win/tclAppInit.c | 26 ++++++++++++++------------ 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/compat/stdlib.h b/compat/stdlib.h index bb0f133..2f7eaf4 100644 --- a/compat/stdlib.h +++ b/compat/stdlib.h @@ -21,14 +21,18 @@ extern void abort(void); extern double atof(const char *string); extern int atoi(const char *string); extern long atol(const char *string); -extern char * calloc(unsigned int numElements, unsigned int size); +extern void * calloc(unsigned long numElements, unsigned long size); extern void exit(int status); -extern int free(char *blockPtr); +extern void free(void *blockPtr); extern char * getenv(const char *name); -extern char * malloc(unsigned int numBytes); -extern void qsort(void *base, int n, int size, int (*compar)( +extern void * malloc(unsigned long numBytes); +extern void qsort(void *base, unsigned long n, unsigned long size, int (*compar)( const void *element1, const void *element2)); -extern char * realloc(char *ptr, unsigned int numBytes); +extern void * realloc(void *ptr, unsigned long numBytes); +extern char * realpath(const char *path, char *resolved_path); +extern int mkstemps(char *templ, int suffixlen); +extern int mkstemp(char *templ); +extern char * mkdtemp(char *templ); extern long strtol(const char *string, char **endPtr, int base); extern unsigned long strtoul(const char *string, char **endPtr, int base); diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 3f69f45..51a4cb5 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -12,13 +12,15 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if defined(BUILD_tcl) || defined(USE_TCL_STUBS) -#error "Don't build with BUILD_tcl/USE_TCL_STUBS!" -#endif #include "tcl.h" -#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +#if TCL_MAJOR_VERSION < 9 +# if defined(BUILD_tcl) || defined(USE_TCL_STUBS) +# error "Don't build with BUILD_tcl/USE_TCL_STUBS!" +# endif +# if TCL_MINOR_VERSION < 7 # define Tcl_LibraryInitProc Tcl_PackageInitProc # define Tcl_StaticLibrary Tcl_StaticPackage +# endif #endif #ifdef TCL_TEST diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 4dd6c6e..53ac274 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -14,21 +14,15 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if defined(BUILD_tcl) || defined(USE_TCL_STUBS) -#error "Don't build with BUILD_tcl/USE_TCL_STUBS!" -#endif #include "tcl.h" -#define WIN32_LEAN_AND_MEAN -#define STRICT /* See MSDN Article Q83456 */ -#include -#undef STRICT -#undef WIN32_LEAN_AND_MEAN -#include -#include -#include -#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +#if TCL_MAJOR_VERSION < 9 +# if defined(BUILD_tcl) || defined(USE_TCL_STUBS) +# error "Don't build with BUILD_tcl/USE_TCL_STUBS!" +# endif +# if TCL_MINOR_VERSION < 7 # define Tcl_LibraryInitProc Tcl_PackageInitProc # define Tcl_StaticLibrary Tcl_StaticPackage +# endif #endif #ifdef TCL_TEST @@ -42,6 +36,14 @@ extern Tcl_LibraryInitProc Dde_Init; extern Tcl_LibraryInitProc Dde_SafeInit; #endif +#define WIN32_LEAN_AND_MEAN +#define STRICT /* See MSDN Article Q83456 */ +#include +#undef STRICT +#undef WIN32_LEAN_AND_MEAN +#include +#include +#include #if defined(__GNUC__) || defined(TCL_BROKEN_MAINARGS) int _CRT_glob = 0; #endif /* __GNUC__ || TCL_BROKEN_MAINARGS */ -- cgit v0.12