Skip to content

Commit

Permalink
Allow the 'testfixture.exe' target to be compiled with the __stdcall …
Browse files Browse the repository at this point in the history
…calling convention.
  • Loading branch information
Joe Mistachkin committed Jul 28, 2016
1 parent 5508212 commit 18cc1d2
Show file tree
Hide file tree
Showing 43 changed files with 245 additions and 56 deletions.
32 changes: 24 additions & 8 deletions Makefile.msc
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,12 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
!IF "$(PLATFORM)"=="x86"
CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
!ELSE
!IFNDEF PLATFORM
CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
Expand Down Expand Up @@ -1239,6 +1239,12 @@ SRC11 = \
parse.h \
$(SQLITE3H)

# Generated Tcl header files
#
SRC12 = \
sqlite_tcl.h \
sqlite_tclDecls.h

# All source code files.
#
SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11)
Expand Down Expand Up @@ -1503,7 +1509,7 @@ mptest: mptester.exe
# files are automatically generated. This target takes care of
# all that automatic generation.
#
.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c
.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c sqlite_tcl.h
-rmdir /Q/S tsrc 2>NUL
-mkdir tsrc
for %i in ($(SRC00)) do copy /Y %i tsrc
Expand All @@ -1518,6 +1524,7 @@ mptest: mptester.exe
for %i in ($(SRC09)) do copy /Y %i tsrc
for %i in ($(SRC10)) do copy /Y %i tsrc
for %i in ($(SRC11)) do copy /Y %i tsrc
for %i in ($(SRC12)) do copy /Y %i tsrc
copy /Y fts5.c tsrc
copy /Y fts5.h tsrc
del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
Expand Down Expand Up @@ -1799,10 +1806,10 @@ wherecode.lo: $(TOP)\src\wherecode.c $(HDR)
whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c

tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c

tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR)
tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h
$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c

tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
Expand Down Expand Up @@ -1974,7 +1981,16 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
!ENDIF

testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR)
sqlite_tclDecls.h:
echo #ifndef SQLITE_TCLAPI > sqlite_tclDecls.h
echo # define SQLITE_TCLAPI __cdecl >> sqlite_tclDecls.h
echo #endif >> sqlite_tclDecls.h
type "$(TCLINCDIR)\tclDecls.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?.*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" >> sqlite_tclDecls.h

sqlite_tcl.h: sqlite_tclDecls.h
type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h >> sqlite_tcl.h

testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) sqlite_tcl.h
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
-DBUILD_sqlite -I$(TCLINCDIR) \
$(TESTFIXTURE_SRC) \
Expand Down Expand Up @@ -2023,7 +2039,7 @@ smoketest: $(TESTPROGS)
@set PATH=$(LIBTCLPATH);$(PATH)
.\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)

sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl sqlite_tcl.h
echo #define TCLSH 2 > $@
echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
Expand Down Expand Up @@ -2103,7 +2119,7 @@ clean:
-rmdir /Q/S .libs 2>NUL
-rmdir /Q/S tsrc 2>NUL
del /Q .target_source 2>NUL
del /Q tclsqlite3.exe 2>NUL
del /Q tclsqlite3.exe sqlite_tcl.h sqlite_tclDecls.h 2>NUL
del /Q testloadext.dll 2>NUL
del /Q testfixture.exe test.db 2>NUL
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
Expand Down
6 changes: 5 additions & 1 deletion ext/fts2/fts2_tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ static void scalarFunc(

#ifdef SQLITE_TEST

#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <string.h>

/*
Expand Down
6 changes: 5 additions & 1 deletion ext/fts3/fts3_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly.
*/

#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <string.h>
#include <assert.h>

Expand Down
6 changes: 5 additions & 1 deletion ext/fts3/fts3_tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ int sqlite3Fts3InitTokenizer(

#ifdef SQLITE_TEST

#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <string.h>

/*
Expand Down
6 changes: 5 additions & 1 deletion ext/fts5/fts5_tcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@


#ifdef SQLITE_TEST
#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

#ifdef SQLITE_ENABLE_FTS5

Expand Down
12 changes: 10 additions & 2 deletions ext/rbu/test_rbu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)

#include "sqlite3rbu.h"
#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <assert.h>

/* From main.c */
Expand Down Expand Up @@ -347,7 +351,11 @@ int SqliteRbu_Init(Tcl_Interp *interp){
}

#else
#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
int SqliteRbu_Init(Tcl_Interp *interp){ return TCL_OK; }
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */
#endif /* defined(SQLITE_TEST) */
6 changes: 5 additions & 1 deletion ext/session/test_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
#include "sqlite3session.h"
#include <assert.h>
#include <string.h>
#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

typedef struct TestSession TestSession;
struct TestSession {
Expand Down
10 changes: 7 additions & 3 deletions src/tclsqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@
** If requested, include the SQLite compiler options file for MSVC.
*/
#if defined(INCLUDE_MSVC_H)
#include "msvc.h"
# include "msvc.h"
#endif

#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <errno.h>

/*
Expand Down Expand Up @@ -4123,7 +4127,7 @@ static void init_all(Tcl_Interp *interp){
Sqlitetesttclvar_Init(interp);
Sqlitetestfs_Init(interp);
SqlitetestThread_Init(interp);
SqlitetestOnefile_Init(interp);
SqlitetestOnefile_Init();
SqlitetestOsinst_Init(interp);
Sqlitetestbackup_Init(interp);
Sqlitetestintarray_Init(interp);
Expand Down
6 changes: 5 additions & 1 deletion src/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
#endif

#include "vdbeInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test2.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
** testing of the SQLite library.
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Expand Down
6 changes: 5 additions & 1 deletion src/test3.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
*/
#include "sqliteInt.h"
#include "btreeInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test4.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
** Code for testing the SQLite library in a multithreaded environment.
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#if SQLITE_OS_UNIX && SQLITE_THREADSAFE
#include <stdlib.h>
#include <string.h>
Expand Down
6 changes: 5 additions & 1 deletion src/test5.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test6.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
*/
#if SQLITE_TEST /* This file is used for testing only */
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

#ifndef SQLITE_OMIT_DISKIO /* This file is a no-op if disk I/O is disabled */

Expand Down
6 changes: 5 additions & 1 deletion src/test7.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
** Derived from test4.c.
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

/*
** This test only works on UNIX with a SQLITE_THREADSAFE build that includes
Expand Down
6 changes: 5 additions & 1 deletion src/test8.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
** testing of the SQLite library.
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test9.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
** as there is not much point in binding to Tcl.
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
*/

#define TCL_THREADS
#include <tcl.h>
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

#ifdef SQLITE_ENABLE_ASYNCIO

Expand Down
6 changes: 5 additions & 1 deletion src/test_autoext.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
*************************************************************************
** Test extension for testing the sqlite3_auto_extension() function.
*/
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include "sqlite3ext.h"

#ifndef SQLITE_OMIT_LOAD_EXTENSION
Expand Down
6 changes: 5 additions & 1 deletion src/test_backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
**
*/

#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include "sqlite3.h"
#include <assert.h>

Expand Down
6 changes: 5 additions & 1 deletion src/test_bestindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@


#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE

Expand Down
6 changes: 5 additions & 1 deletion src/test_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
**
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Expand Down
Loading

0 comments on commit 18cc1d2

Please sign in to comment.