aboutsummaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
Diffstat (limited to 'tool')
-rw-r--r--tool/buildtclext.tcl68
-rw-r--r--tool/lemon.c10
-rw-r--r--tool/mkshellc.tcl2
-rw-r--r--tool/split-sqlite3c.tcl2
-rw-r--r--tool/sqlite3_rsync.c3
-rw-r--r--tool/src-verify.c2
-rw-r--r--tool/warnings.sh18
7 files changed, 59 insertions, 46 deletions
diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl
index 8e5bef38a..535ed37e7 100644
--- a/tool/buildtclext.tcl
+++ b/tool/buildtclext.tcl
@@ -17,6 +17,7 @@ Options:
--uninstall Uninstall the extension
--version-check Check extension version against this source tree
--destdir DIR Installation root (used by "make install DESTDIR=...")
+ --tclConfig.sh FILE Use this tclConfig.sh instead of looking for one
Other options are retained and passed through into the compiler.}
@@ -29,6 +30,7 @@ set versioncheck 0
set CC {}
set OPTS {}
set DESTDIR ""; # --destdir "$(DESTDIR)"
+set tclConfigSh ""; # --tclConfig.sh FILE
for {set ii 0} {$ii<[llength $argv]} {incr ii} {
set a0 [lindex $argv $ii]
if {$a0=="--install-only"} {
@@ -56,6 +58,9 @@ for {set ii 0} {$ii<[llength $argv]} {incr ii} {
} elseif {$a0=="--destdir" && $ii+1<[llength $argv]} {
incr ii
set DESTDIR [lindex $argv $ii]
+ } elseif {$a0=="--tclConfig.sh" && $ii+1<[llength $argv]} {
+ incr ii
+ set tclConfigSh [lindex $argv $ii]
} elseif {[string match -* $a0]} {
append OPTS " $a0"
} else {
@@ -88,40 +93,47 @@ if {$tcl_platform(platform) eq "windows"} {
}
set OUT tclsqlite3.dll
} else {
- # Figure out the location of the tclConfig.sh file used by the
- # tclsh that is executing this script.
+ # Read the tclConfig.sh file into the $tclConfig variable
#
- if {[catch {
- set LIBDIR [tcl::pkgconfig get libdir,install]
- }]} {
- puts stderr "$argv0: tclsh does not support tcl::pkgconfig."
- exit 1
- }
- if {![file exists $LIBDIR]} {
- puts stderr "$argv0: cannot find the tclConfig.sh file."
- puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\
+ if {"" eq $tclConfigSh} {
+ # Figure out the location of the tclConfig.sh file used by the
+ # tclsh that is executing this script.
+ #
+ if {[catch {
+ set LIBDIR [tcl::pkgconfig get libdir,install]
+ }]} {
+ puts stderr "$argv0: tclsh does not support tcl::pkgconfig."
+ exit 1
+ }
+ if {![file exists $LIBDIR]} {
+ puts stderr "$argv0: cannot find the tclConfig.sh file."
+ puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\
does not exist."
- exit 1
- }
- if {![file exists $LIBDIR/tclConfig.sh]
- || [file size $LIBDIR/tclConfig.sh]<5000} {
- set n1 $LIBDIR/tcl$::tcl_version
- if {[file exists $n1/tclConfig.sh]
- && [file size $n1/tclConfig.sh]>5000} {
- set LIBDIR $n1
- } else {
- puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1"
exit 1
}
+ if {![file exists $LIBDIR/tclConfig.sh]
+ || [file size $LIBDIR/tclConfig.sh]<5000} {
+ set n1 $LIBDIR/tcl$::tcl_version
+ if {[file exists $n1/tclConfig.sh]
+ && [file size $n1/tclConfig.sh]>5000} {
+ set LIBDIR $n1
+ } else {
+ puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1"
+ exit 1
+ }
+ }
+ #puts "using $LIBDIR/tclConfig.sh"
+ set fd [open $LIBDIR/tclConfig.sh rb]
+ set tclConfig [read $fd]
+ close $fd
+ } else {
+ # User-provided tclConfig.sh
+ #
+ set fd [open $tclConfigSh rb]
+ set tclConfig [read $fd]
+ close $fd
}
- # Read the tclConfig.sh file into the $tclConfig variable
- #
- #puts "using $LIBDIR/tclConfig.sh"
- set fd [open $LIBDIR/tclConfig.sh rb]
- set tclConfig [read $fd]
- close $fd
-
# Extract parameter we will need from the tclConfig.sh file
#
set TCLMAJOR 8
diff --git a/tool/lemon.c b/tool/lemon.c
index f0f2c8d72..324dda0c5 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -2023,10 +2023,10 @@ static char *msort(
list = NEXT(list);
NEXT(ep) = 0;
for(i=0; i<LISTSIZE-1 && set[i]!=0; i++){
- ep = merge(ep,set[i],cmp,offset);
+ ep = merge(set[i],ep,cmp,offset);
set[i] = 0;
}
- set[i] = ep;
+ set[i] = merge(set[i],ep,cmp,offset);
}
ep = 0;
for(i=0; i<LISTSIZE; i++) if( set[i] ) ep = merge(set[i],ep,cmp,offset);
@@ -4035,10 +4035,10 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
}
}
if( lhsdirect ){
- sprintf(zLhs, "yymsp[%d].minor.yy%d",1-rp->nrhs,rp->lhs->dtnum);
+ lemon_sprintf(zLhs, "yymsp[%d].minor.yy%d",1-rp->nrhs,rp->lhs->dtnum);
}else{
rc = 1;
- sprintf(zLhs, "yylhsminor.yy%d",rp->lhs->dtnum);
+ lemon_sprintf(zLhs, "yylhsminor.yy%d",rp->lhs->dtnum);
}
append_str(0,0,0,0);
@@ -5925,7 +5925,7 @@ struct state **State_arrayof(void)
PRIVATE unsigned confighash(struct config *a)
{
unsigned h=0;
- h = h*571 + a->rp->index*37 + a->dot;
+ h = a->rp->index*37 + a->dot;
return h;
}
diff --git a/tool/mkshellc.tcl b/tool/mkshellc.tcl
index 85e14f849..2f7a6ea25 100644
--- a/tool/mkshellc.tcl
+++ b/tool/mkshellc.tcl
@@ -62,7 +62,7 @@ while {1} {
if {[regexp {^# *include "sqlite} $lx]} {
set lx "/* $lx */"
}
- if {[regexp {^# *include "test_windirent.h"} $lx]} {
+ if {[regexp {^# *include "windirent.h"} $lx]} {
set lx "/* $lx */"
}
set lx [string map [list __declspec(dllexport) {}] $lx]
diff --git a/tool/split-sqlite3c.tcl b/tool/split-sqlite3c.tcl
index de4db55a1..3554933cd 100644
--- a/tool/split-sqlite3c.tcl
+++ b/tool/split-sqlite3c.tcl
@@ -56,7 +56,7 @@ proc write_one_file {content} {
set label $filecnt
}
set out [open sqlite3-$label.c w]
- fconfigure $out -translation lf
+ fconfigure $out -translation text
puts -nonewline $out $content
close $out
puts $::out1 "#include \"sqlite3-$filecnt.c\""
diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c
index 46ff2e50e..03a74f365 100644
--- a/tool/sqlite3_rsync.c
+++ b/tool/sqlite3_rsync.c
@@ -1538,7 +1538,7 @@ static void originSide(SQLiteRsync *p){
sqlite3_finalize(pInsHash);
pCkHash = 0;
pInsHash = 0;
- if( mxHash<p->nPage ){
+ if( mxHash<=p->nPage ){
runSql(p, "WITH RECURSIVE c(n) AS"
" (VALUES(%d) UNION ALL SELECT n+1 FROM c WHERE n<%d)"
" INSERT INTO badHash SELECT n, 1 FROM c",
@@ -1797,6 +1797,7 @@ static void replicaSide(SQLiteRsync *p){
closeDb(p);
break;
}
+ sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0);
runSql(p, "ATTACH %Q AS 'replica'", p->zReplica);
if( p->wrongEncoding ){
p->wrongEncoding = 0;
diff --git a/tool/src-verify.c b/tool/src-verify.c
index 0c7ed6f4c..6dc9f7259 100644
--- a/tool/src-verify.c
+++ b/tool/src-verify.c
@@ -752,7 +752,7 @@ void sha1sum_file(const char *zFilename, char *zCksum){
SHA1Final(zResult, &ctx);
DigestToBase16(zResult, zCksum, 20);
}
-
+
/*
** Decode a fossilized string in-place.
*/
diff --git a/tool/warnings.sh b/tool/warnings.sh
index 2b962d15e..b589780ea 100644
--- a/tool/warnings.sh
+++ b/tool/warnings.sh
@@ -10,7 +10,7 @@ if uname | grep -i openbsd ; then
WARNING_ANDROID_OPTS=-Wall
else
# Use these for testing on Linux and Mac OSX:
- WARNING_OPTS="-Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long"
+ WARNING_OPTS="-Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -Wno-array-bounds"
gccvers=`gcc -v 2>&1 | grep '^gcc version'`
if test "$gccvers" '<' 'gcc version 6'
then
@@ -22,15 +22,15 @@ fi
rm -f sqlite3.c
make sqlite3.c
-echo '********** No optimizations. Includes FTS4/5, GEOPOLY, JSON1 ***'
-echo '********** ' Options: $WARNING_OPTS
+echo '**** No optimizations. Includes FTS4/5, GEOPOLY, JSON1 ***'
+echo '****' $WARNING_OPTS
gcc -c $WARNING_OPTS -std=c89 \
-ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_FTS5 \
sqlite3.c
if test x`uname` = 'xLinux'; then
-echo '********** Android configuration ******************************'
-echo '********** ' Options: $WARNING_ANDROID_OPTS
+echo '**** Android configuration ******************************'
+echo '****' $WARNING_ANDROID_OPTS
gcc -c \
-DSQLITE_HAVE_ISNAN \
-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \
@@ -52,13 +52,13 @@ gcc -c \
$WARNING_ANDROID_OPTS \
-Os sqlite3.c shell.c
fi
-echo '********** No optimizations. ENABLE_STAT4. THREADSAFE=0 *******'
-echo '********** ' Options: $WARNING_OPTS
+echo '**** No optimizations. ENABLE_STAT4. THREADSAFE=0 *******'
+echo '****' $WARNING_OPTS
gcc -c $WARNING_OPTS -std=c89 \
-ansi -DSQLITE_ENABLE_STAT4 -DSQLITE_THREADSAFE=0 \
sqlite3.c
-echo '********** Optimized -O3. Includes FTS4/5, GEOPOLY, JSON1 ******'
-echo '********** ' Options: $WARNING_OPTS
+echo '**** Optimized -O3. Includes FTS4/5, GEOPOLY, JSON1 ******'
+echo '****' $WARNING_OPTS
gcc -O3 -c $WARNING_OPTS -std=c89 \
-ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_FTS5 \