From: mistachkin Date: Tue, 24 Mar 2015 21:52:12 +0000 (+0000) Subject: Update the 'mksqlite3c-noext' tool as well. X-Git-Tag: version-3.8.9~35^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8de1250638a76287cd94cbe8e4f312fbe77f9dd1;p=thirdparty%2Fsqlite.git Update the 'mksqlite3c-noext' tool as well. FossilOrigin-Name: a532256688c3a7a6385e041ec73913842e2c3ab3 --- diff --git a/manifest b/manifest index 8a9bcb9667..8d1f543c39 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sSQLITE_STDCALL\sand\sSQLITE_CDECL\smacros\son\spublic\sfunction\sdefinitions. -D 2015-03-24T21:27:27.369 +C Update\sthe\s'mksqlite3c-noext'\stool\sas\swell. +D 2015-03-24T21:52:12.248 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 88a3e6261286db378fdffa1124cad11b3c05f5bb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1212,7 +1212,7 @@ F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 94f196c9961e0ca3513e29f57125a3197808be2d F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 9ef48e1748dce7b844f67e2450ff9dfeb0fb4ab5 +F tool/mksqlite3c-noext.tcl 46dad185f91829a25b10291b244d2440ad4a88f4 F tool/mksqlite3c.tcl ab2cfb2191f1edaea0e72b6ad3bc3f71aa61a6b9 F tool/mksqlite3h.tcl c02e391f595bf91528341ffaa53e5084d8b595ce F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b @@ -1246,10 +1246,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 436314b5728c9413f9ac2d837e1c19364f31be72 -R 887ef727abd3a9965cbccad906bf79e4 -T *branch * stdcall -T *sym-stdcall * -T -sym-trunk * +P 242f09d4d1c92ee9058857a5e780442f4b7bad55 +R 4e80129117aa4b372475de5cd1490c7f U mistachkin -Z cb11de2c68ebf434af7cc941e8219588 +Z 6bcda5d8184063ac5fc3f1cb05a00dcd diff --git a/manifest.uuid b/manifest.uuid index d35f197244..52602f40c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -242f09d4d1c92ee9058857a5e780442f4b7bad55 \ No newline at end of file +a532256688c3a7a6385e041ec73913842e2c3ab3 \ No newline at end of file diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index 27522265bb..35c14093e9 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -83,6 +83,12 @@ if {$addstatic} { #endif #ifndef SQLITE_API # define SQLITE_API +#endif +#ifndef SQLITE_CDECL +# define SQLITE_CDECL +#endif +#ifndef SQLITE_STDCALL +# define SQLITE_STDCALL #endif} } @@ -106,6 +112,7 @@ foreach hdr { pager.h parse.h pcache.h + pragma.h sqlite3ext.h sqlite3.h sqliteicu.h @@ -113,12 +120,31 @@ foreach hdr { sqliteLimit.h vdbe.h vdbeInt.h + vxworks.h wal.h + whereInt.h } { set available_hdr($hdr) 1 } set available_hdr(sqliteInt.h) 0 +# These headers should be copied into the amalgamation without modifying any +# of their function declarations or definitions. +set varonly_hdr(sqlite3.h) 1 + +# These are the functions that accept a variable number of arguments. They +# always need to use the "cdecl" calling convention even when another calling +# convention (e.g. "stcall") is being used for the rest of the library. +set cdecllist { + sqlite3_config + sqlite3_db_config + sqlite3_log + sqlite3_mprintf + sqlite3_snprintf + sqlite3_test_control + sqlite3_vtab_config +} + # 78 stars used for comment formatting. set s78 \ {*****************************************************************************} @@ -135,21 +161,21 @@ proc section_comment {text} { # Read the source file named $filename and write it into the # sqlite3.c output file. If any #include statements are seen, -# process them approprately. +# process them appropriately. # proc copy_file {filename} { - global seen_hdr available_hdr out addstatic linemacros + global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros set ln 0 set tail [file tail $filename] section_comment "Begin file $tail" if {$linemacros} {puts $out "#line 1 \"$filename\""} set in [open $filename r] set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+(sqlite3[_a-zA-Z0-9]+)(\[|;| =)} - set declpattern {[a-zA-Z][a-zA-Z_0-9 ]+ \**(sqlite3[_a-zA-Z0-9]+)\(} + set declpattern {([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3[_a-zA-Z0-9]+)(\(.*)} if {[file extension $filename]==".h"} { set declpattern " *$declpattern" } - set declpattern ^$declpattern + set declpattern ^$declpattern\$ while {![eof $in]} { set line [gets $in] incr ln @@ -165,42 +191,67 @@ proc copy_file {filename} { if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} } } elseif {![info exists seen_hdr($hdr)]} { - set seen_hdr($hdr) 1 + if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} { + set seen_hdr($hdr) 1 + } + puts $out $line + } elseif {[regexp {/\*\s+amalgamator:\s+keep\s+\*/} $line]} { + # This include file must be kept because there was a "keep" + # directive inside of a line comment. puts $out $line } else { - puts $out "/* $line */" + # Comment out the entire line, replacing any nested comment + # begin/end markers with the harmless substring "**". + puts $out "/* [string map [list /* ** */ **] $line] */" } } elseif {[regexp {^#ifdef __cplusplus} $line]} { puts $out "#if 0" } elseif {!$linemacros && [regexp {^#line} $line]} { # Skip #line directives. } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} { - regsub {^SQLITE_API } $line {} line - if {[regexp $declpattern $line all funcname]} { + # Skip adding the SQLITE_PRIVATE or SQLITE_API keyword before + # functions if this header file does not need it. + if {![info exists varonly_hdr($tail)] + && [regexp $declpattern $line all rettype funcname rest]} { + regsub {^SQLITE_API } $line {} line # Add the SQLITE_PRIVATE or SQLITE_API keyword before functions. # so that linkage can be modified at compile-time. if {[regexp {^sqlite3_} $funcname]} { - puts $out "SQLITE_API $line" + set line SQLITE_API + append line " " [string trim $rettype] + if {[string index $rettype end] ne "*"} { + append line " " + } + if {[lsearch -exact $cdecllist $funcname] >= 0} { + append line SQLITE_CDECL + } else { + append line SQLITE_STDCALL + } + append line " " $funcname $rest + puts $out $line } else { puts $out "SQLITE_PRIVATE $line" } } elseif {[regexp $varpattern $line all varname]} { - # Add the SQLITE_PRIVATE before variable declarations or - # definitions for internal use - if {![regexp {^sqlite3_} $varname]} { - regsub {^extern } $line {} line - puts $out "SQLITE_PRIVATE $line" - } else { - if {[regexp {const char sqlite3_version\[\];} $line]} { - set line {const char sqlite3_version[] = SQLITE_VERSION;} + # Add the SQLITE_PRIVATE before variable declarations or + # definitions for internal use + regsub {^SQLITE_API } $line {} line + if {![regexp {^sqlite3_} $varname]} { + regsub {^extern } $line {} line + puts $out "SQLITE_PRIVATE $line" + } else { + if {[regexp {const char sqlite3_version\[\];} $line]} { + set line {const char sqlite3_version[] = SQLITE_VERSION;} + } + regsub {^SQLITE_EXTERN } $line {} line + puts $out "SQLITE_API $line" } - regsub {^SQLITE_EXTERN } $line {} line - puts $out "SQLITE_API $line" - } } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} { + regsub {^SQLITE_API } $line {} line regsub {^SQLITE_EXTERN } $line {} line - puts $out "SQLITE_PRIVATE $line" + puts $out $line } elseif {[regexp {^void \(\*sqlite3Os} $line]} { + regsub {^SQLITE_API } $line {} line puts $out "SQLITE_PRIVATE $line" } else { puts $out $line