summaryrefslogtreecommitdiff
path: root/chromium/third_party/sqlite/src/tool/mksqlite3c.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/sqlite/src/tool/mksqlite3c.tcl')
-rw-r--r--chromium/third_party/sqlite/src/tool/mksqlite3c.tcl41
1 files changed, 40 insertions, 1 deletions
diff --git a/chromium/third_party/sqlite/src/tool/mksqlite3c.tcl b/chromium/third_party/sqlite/src/tool/mksqlite3c.tcl
index 596787d4fd0..8ea3e81c91c 100644
--- a/chromium/third_party/sqlite/src/tool/mksqlite3c.tcl
+++ b/chromium/third_party/sqlite/src/tool/mksqlite3c.tcl
@@ -224,6 +224,8 @@ proc copy_file {filename} {
if {![info exists varonly_hdr($tail)]
&& [regexp $declpattern $line all rettype funcname rest]} {
regsub {^SQLITE_API } $line {} line
+ regsub {^SQLITE_API } $rettype {} rettype
+
# Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
# so that linkage can be modified at compile-time.
if {[regexp {^sqlite3[a-z]*_} $funcname]} {
@@ -240,7 +242,13 @@ proc copy_file {filename} {
}
}
append line $funcname $rest
- puts $out $line
+ if {$funcname=="sqlite3_sourceid" && !$linemacros} {
+ # The sqlite3_sourceid() routine is synthesized at the end of
+ # the amalgamation
+ puts $out "/* $line */"
+ } else {
+ puts $out $line
+ }
} else {
puts $out "SQLITE_PRIVATE $line"
}
@@ -386,6 +394,7 @@ foreach file {
fts3_icu.c
sqlite3rbu.c
dbstat.c
+ dbpage.c
sqlite3session.c
json1.c
fts5.c
@@ -394,4 +403,34 @@ foreach file {
copy_file tsrc/$file
}
+# Synthesize an alternative sqlite3_sourceid() implementation that
+# that tries to detects changes in the amalgamation source text
+# and modify returns a modified source-id if changes are detected.
+#
+# The only detection mechanism we have is the __LINE__ macro. So only
+# edits that changes the number of lines of source code are detected.
+#
+if {!$linemacros} {
+ flush $out
+ set in2 [open sqlite3.c]
+ set cnt 0
+ set oldsrcid {}
+ while {![eof $in2]} {
+ incr cnt
+ gets $in2 line
+ if {[regexp {^#define SQLITE_SOURCE_ID } $line]} {set oldsrcid $line}
+ }
+ close $in2
+ regsub {[0-9a-flt]{4}"} $oldsrcid {alt2"} oldsrcid
+ puts $out \
+"#if __LINE__!=[expr {$cnt+0}]
+#undef SQLITE_SOURCE_ID
+$oldsrcid
+#endif
+/* Return the source-id for this library */
+SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }"
+}
+puts $out \
+"/************************** End of sqlite3.c ******************************/"
+
close $out