From: larrybr Date: Tue, 13 Jul 2021 01:45:04 +0000 (+0000) Subject: Amalgamation has #line directives by default. Minor mksqlite3c.tcl changes X-Git-Tag: version-3.37.0~339^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b1c3eb5f9a5b8d4c709d17d7eeadc40e97b7d2a;p=thirdparty%2Fsqlite.git Amalgamation has #line directives by default. Minor mksqlite3c.tcl changes FossilOrigin-Name: ba3eff71973064cbc0ddf51aa822a246c162bbb65387e9523692c60e5340acda --- diff --git a/Makefile.in b/Makefile.in index 2795ffa9e8..d04d81c164 100644 --- a/Makefile.in +++ b/Makefile.in @@ -165,6 +165,7 @@ LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) ############################################################################### USE_AMALGAMATION = @USE_AMALGAMATION@ +AMALGAMATION_LINE_TAGS = @AMALGAMATION_LINE_TAGS@ # Object files for the SQLite library (non-amalgamation). # @@ -756,7 +757,7 @@ mptest: mptester$(TEXE) touch .target_source sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl - $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl + $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_TAGS) cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . diff --git a/configure b/configure index 542ee5a1fe..52d8a120b2 100755 --- a/configure +++ b/configure @@ -774,6 +774,7 @@ USE_GCOV OPT_FEATURE_FLAGS HAVE_ZLIB USE_AMALGAMATION +AMALGAMATION_LINE_TAGS TARGET_DEBUG TARGET_HAVE_EDITLINE TARGET_HAVE_READLINE @@ -902,6 +903,7 @@ with_readline_lib with_readline_inc enable_debug enable_amalgamation +amalgamation_line_tags enable_load_extension enable_math enable_all @@ -10305,6 +10307,13 @@ done # USE_AMALGAMATION=1 +######### +# By default, amalgamation sqlite3.c will have #line directives. +# This is a build option not shown by ./configure --help +# To control it, use configure option: amalgamation_line_tags=? +# where ? is no to suppress #line directives or yes to create them. +AMALGAMATION_LINE_TAGS=--linemacros=1 + ######### # See whether we can run specific tclsh versions known to work well; # if not, then we fall back to plain tclsh. @@ -11275,6 +11284,19 @@ if test "${enable_amalgamation}" = "no" ; then USE_AMALGAMATION=0 fi +######## +# See whether --disable +if test "${amalgamation_line_tags+set}" = set; then : + enableval=$amalgamation_line_tags; +fi + +if test "${amalgamation_line_tags}" = "yes" ; then + AMALGAMATION_LINE_TAGS=--linemacros=1 +fi +if test "${amalgamation_line_tags}" = "no" ; then + AMALGAMATION_LINE_TAGS=--linemacros=0 +fi + ######### # Look for zlib. Only needed by extensions and by the sqlite3.exe shell diff --git a/manifest b/manifest index a354ffea57..6b80d1d47c 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Clarify\scomment\son\ssqlite3.h's\sinterface\sdecaration\smacros. -D 2021-07-09T23:12:42.486 +C Amalgamation\shas\s#line\sdirectives\sby\sdefault.\sMinor\smksqlite3c.tcl\schanges +D 2021-07-13T01:45:04.109 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in ff5ac24ec9cb700135ee4453fa14c18ea371e94250d3673bda1f2cb56e1108ce +F Makefile.in 31b3f386d47577c610dedf116aa5deab039c749d36b7735e9bc01a6f31c90f2b F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241 F Makefile.msc 8285e1ea7264f32b08702866d69dd127c0f663bbc2002323d853c68c27c6b6e4 F README.md 27fb76aa7eb57ed63a53bbba7292b6bf71f51125554f79f16b5d040edd1e6110 @@ -34,7 +34,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure 9712ea724ff2a1d48fadcf04b29fa1852f325792462c55f4fc71ab972653b20d x +F configure 0c8ec49c8c57e549748fd3c9df50f997272649fdba3be5b91ebf9f2546856157 x F configure.ac 4e4b58b32f88c8da9914a2f2c3158f80e69907eccc019fcc7e3ba14ffd91c640 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd @@ -1858,7 +1858,7 @@ F tool/mkshellc.tcl 5fe7e518112b262e25726f248c0f33dd153192867453984b6af0a76a88e9 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f -F tool/mksqlite3c.tcl b4a930a4c3f8f43273cde45a459eb8881479be3c2845526c92b2513a4995aab8 +F tool/mksqlite3c.tcl bfbdf3661d82a9d5913a52dfa8d78b2a069a8af1a4b457162609bd6b55700de0 F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5 @@ -1920,7 +1920,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ab1550a608684b6b9104b555a975482cfabca5053b7d7dcc60d63a0e3a8d707d -R ccb396cfbaef0a2b4107a89e839d38ef +P 7cb09aef49c0b98c0c5e332d953a2eeb71ae9e243b1e37ab1c8ed4af15d46f50 +R 6df1eb2d72698e3e5d1e65e62fb29077 +T *branch * line_tags +T *sym-line_tags * +T -sym-trunk * U larrybr -Z 05b6e9c94023ac4e996b4a1256a4c2d0 +Z 26f306c76e23d1272de3ca395f0d82ae diff --git a/manifest.uuid b/manifest.uuid index 44b147f611..84b3831a8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7cb09aef49c0b98c0c5e332d953a2eeb71ae9e243b1e37ab1c8ed4af15d46f50 \ No newline at end of file +ba3eff71973064cbc0ddf51aa822a246c162bbb65387e9523692c60e5340acda \ No newline at end of file diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 054e0fd1b9..ad2488d83f 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -17,31 +17,52 @@ # After the "tsrc" directory has been created and populated, run # this script: # -# tclsh mksqlite3c.tcl --srcdir $SRC +# tclsh mksqlite3c.tcl # # The amalgamated SQLite code will be written into sqlite3.c # +set help {Usage: tclsh mksqlite3c.tcl + where is zero or more of the following with these effects: + --nostatic => Do not generate with compile-time modifiable linkage. + --linemacros=? => Insert #line directives into the output or not. (1 or 0) + --useapicall => Prepend functions with SQLITE_APICALL or SQLITE_CDECL. + --srcdir $SRC => Specify the directory containing constituent sources. + --help => See this. +} + # Begin by reading the "sqlite3.h" header file. Extract the version number # from in this file. The version number is needed to generate the header # comment of the amalgamation. # + set addstatic 1 -set linemacros 0 +set linemacros 1 set useapicall 0 +set srcdir tsrc + for {set i 0} {$i<[llength $argv]} {incr i} { set x [lindex $argv $i] - if {[regexp {^-+nostatic$} $x]} { + if {[regexp {^-?-nostatic$} $x]} { set addstatic 0 - } elseif {[regexp {^-+linemacros} $x]} { - set linemacros 1 - } elseif {[regexp {^-+useapicall} $x]} { + } elseif {[regexp {^-?-linemacros=([01])$} $x ma ulm]} { + set linemacros $ulm + } elseif {[regexp {^-?-useapicall$} $x]} { set useapicall 1 + } elseif {[regexp {^-?-srcdir$} $x]} { + incr i + if {$i==[llength $argv]} { + error "No argument following $x" + } + set srcdir [lindex $argv $i] + } elseif {[regexp {^-?-((help)|\?)$} $x]} { + puts $help + exit 0 } else { error "unknown command-line option: $x" } } -set in [open tsrc/sqlite3.h] +set in [open $srcdir/sqlite3.h] set cnt 0 set VERSION ????? while {![eof $in]} { @@ -94,7 +115,7 @@ if {$addstatic} { # # then set the SQLITE_UDL_CAPABLE_PARSER flag in the amalgamation. # -set in [open tsrc/parse.c] +set in [open $srcdir/parse.c] if {[regexp {ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT} [read $in]]} { puts $out "#define SQLITE_UDL_CAPABLE_PARSER 1" } @@ -182,7 +203,7 @@ proc section_comment {text} { # proc copy_file {filename} { global seen_hdr available_hdr varonly_hdr cdecllist out - global addstatic linemacros useapicall + global addstatic linemacros useapicall srcdir set ln 0 set tail [file tail $filename] section_comment "Begin file $tail" @@ -204,7 +225,7 @@ proc copy_file {filename} { set available_hdr($hdr) 0 } section_comment "Include $hdr in the middle of $tail" - copy_file tsrc/$hdr + copy_file $srcdir/$hdr section_comment "Continuing where we left off in $tail" if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} } else { @@ -255,7 +276,7 @@ proc copy_file {filename} { } } append line $funcname $rest - if {$funcname=="sqlite3_sourceid" && !$linemacros} { + if {$funcname=="sqlite3_sourceid"} { # The sqlite3_sourceid() routine is synthesized at the end of # the amalgamation puts $out "/* $line */" @@ -417,36 +438,13 @@ foreach file { fts5.c stmt.c } { - copy_file tsrc/$file + copy_file $srcdir/$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 */ +puts $out \ +"/* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }" -} + puts $out \ "/************************** End of sqlite3.c ******************************/"